--
This package aims to provide an analysis based on the number of open source projects an individual possess on Github.This Package uses PSR-4 Autoload Standard.
Number of repository < 5: None Evangelist.
Number of repository >= 5 and Number of repository <= 10 : Junior Evangelist.
Number of repository >= 11 and Number of repository <= 20 : Associate Evangelist.
Number of repository >= 21 : Senior Evangelist.
Via Composer
$ composer require pyjac/opensourceevangelist
require 'vendor/autoload.php';
use Pyjac\OpenSourceEvangelist\OpenSourceEvangelist;
use Pyjac\OpenSourceEvangelist\OpenSourceEvangelistDataSource;
use Pyjac\OpenSourceEvangelist\OpenSourceEvangelistFactory;
use Pyjac\OpenSourceEvangelist\Exception\OpenSourceEvangelistNotFoundException;
try
{
$openSourceEvangelist = new OpenSourceEvangelist(new OpenSourceEvangelistDataSource(), new OpenSourceEvangelistFactory());
$evangelist = $openSourceEvangelist->getEvangelist('pyjac');
echo $evangelist->getStatus();
} catch(OpenSourceEvangelistNotFoundException $ex){
echo $ex->getMessage();
}
The OpenSourceEvangelist
class receives two instances of OpenSourceEvangelistDataSource
and OpenSourceEvangelistFactory
class.
$openSourceEvangelist = new OpenSourceEvangelist(new OpenSourceEvangelistDataSource(), new OpenSourceEvangelistFactory());
You can implement your own by implementing the below interface for the class OpenSourceEvangelistDataSource
.
//Pyjac\OpenSourceEvangelist\OpenSourceEvangelistDataSourceInterface
interface OpenSourceEvangelistDataSourceInterface
{
/**
* Get data of the provided username from the data source.
*
* @param string $username
*
* @throws Pyjac\OpenSourceEvangelist\Exception\OpenSourceEvangelistNotFoundException
*
* @return \stdClass
*/
public function getEvangelistData($username);
}
And the below interface for the class OpenSourceEvangelistFactory
.
//Pyjac\OpenSourceEvangelist\OpenSourceEvangelistFactoryInterface
interface OpenSourceEvangelistFactoryInterface
{
/**
* Factory method to create an instance of an evangelist.
*
* @param string $username
* @param int $repos
*
* @return Pyjac\OpenSourceEvangelist\Evangelist\EvangelistAbstract
*/
public function createEvangelist($username, $repos);
}
The getEvangelist
method returns an object of an evangelist.
$evangelist = $openSourceEvangelist->getEvangelist('pyjac');
echo $evangelist->getStatus();
echo $evangelist->getUsername();
echo $evangelist->getRank();
echo $evangelist->getNumberOfRepos();
`OpenSourceEvangelistNotFoundException`: This exception is thrown when the provided Github username is not found.
If you discover any security related issues, please email Oyebanji Jacob or create an issue.
Copyright (c) 2016 Oyebanji Jacob [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.