These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Automation tool mixed with code generator for easier continuous development |
||
4 | * |
||
5 | * @link https://github.com/hiqdev/hidev |
||
6 | * @package hidev |
||
7 | * @license BSD-3-Clause |
||
8 | * @copyright Copyright (c) 2015-2018, HiQDev (http://hiqdev.com/) |
||
9 | */ |
||
10 | |||
11 | namespace hidev\components; |
||
12 | |||
13 | /** |
||
14 | * GitHub component. |
||
15 | */ |
||
16 | class GitHub extends \hidev\base\Component |
||
17 | { |
||
18 | protected $_name; |
||
19 | protected $_vendor; |
||
20 | protected $_description; |
||
21 | |||
22 | /** |
||
23 | * @var string GitHub OAuth access token |
||
24 | */ |
||
25 | protected $_token; |
||
26 | |||
27 | public function setFull_name($value) |
||
28 | { |
||
29 | list($this->_vendor, $this->_name) = explode('/', $value, 2); |
||
30 | } |
||
31 | |||
32 | public function getFull_name() |
||
33 | { |
||
34 | return $this->getVendor() . '/' . $this->getName(); |
||
35 | } |
||
36 | |||
37 | public function setFullName($value) |
||
38 | { |
||
39 | return $this->setFull_name($value); |
||
40 | } |
||
41 | |||
42 | public function getFullName() |
||
43 | { |
||
44 | return $this->getFull_name(); |
||
45 | } |
||
46 | |||
47 | public function setName($value) |
||
48 | { |
||
49 | $this->_name = $value; |
||
50 | } |
||
51 | |||
52 | public function getName() |
||
53 | { |
||
54 | if (!$this->_name) { |
||
55 | $this->_name = $this->take('package')->name; |
||
56 | } |
||
57 | |||
58 | return $this->_name; |
||
59 | } |
||
60 | |||
61 | public function setVendor($value) |
||
62 | { |
||
63 | $this->_vendor = $value; |
||
64 | } |
||
65 | |||
66 | public function getVendor() |
||
67 | { |
||
68 | if (!$this->_vendor) { |
||
69 | $this->_vendor = $this->take('vendor')->name; |
||
70 | } |
||
71 | |||
72 | return $this->_vendor; |
||
73 | } |
||
74 | |||
75 | public function setDescription($value) |
||
76 | { |
||
77 | $this->_description = $value; |
||
78 | } |
||
79 | |||
80 | View Code Duplication | public function getDescription() |
|
0 ignored issues
–
show
|
|||
81 | { |
||
82 | if ($this->_description === null) { |
||
83 | $this->_description = $this->take('package')->getTitle(); |
||
84 | } |
||
85 | |||
86 | return $this->_description; |
||
87 | } |
||
88 | } |
||
89 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.