EvangelistStatus   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 6
Bugs 2 Features 1
Metric Value
wmc 8
c 6
b 2
f 1
lcom 1
cbo 1
dl 0
loc 39
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getStatus() 0 4 1
B setStatus() 0 12 6
1
<?php
2
/**
3
 * @file     EvangelistStatus.php
4
 * This file is a class that sets a developer's evangelist status based on
5
 * public repos
6
 * @package  Lib\EvangelistStatus
7
 * @author   andrew <[email protected]>
8
 * @license  MIT => https://opensource.org/licenses/MIT
9
 */
10
namespace Lib;
11
12
use Lib\GitHubAPI;
13
14
/**
15
 * @category Class
16
 * @package  Lib\EvangelistStatus
17
 */
18
class EvangelistStatus
19
{
20
    private $status;
21
22
    public function __construct($username)
23
    {
24
        $repos = GitHubAPI::getNumberOfRepos($username);
25
        $this->setStatus($repos);
26
    }
27
28
29
    /**
30
     * Sets the developer's evangelist status
31
     *
32
     * @param mixed $repos The number of public repos a developer has on GitHub
33
     */
34
    private function setStatus($repos)
35
    {
36
        if ($repos >= 5 && $repos <= 10) {
37
            $this->status = "Prodigal Junior Evangelist";
38
        } elseif ($repos >=11 && $repos <= 20) {
39
            $this->status = "Associate Evangelist";
40
        } elseif ($repos > 20) {
41
            $this->status = "Senior Evangelist";
42
        } else {
43
            $this->status = "You call yourself a programmer?!!";
44
        }
45
    }
46
47
    /**
48
     * Returns the developer's evangelist status
49
     *
50
     * @return string
51
     */
52
    public function getStatus()
53
    {
54
        return $this->status;
55
    }
56
}
57