EvangelistStatus::setStatus()   B
last analyzed

Complexity

Conditions 6
Paths 4

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 12
rs 8.8571
cc 6
eloc 9
nc 4
nop 1
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