Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 8 |
Ratio | 50 % |
Changes | 0 |
1 | <?php |
||
17 | protected function getRepoFromGithubConfig() |
||
18 | { |
||
19 | $remote = `git remote get-url origin 2> /dev/null`; |
||
20 | if (! starts_with($remote, ['[email protected]:','https://github.com/'])) { |
||
21 | return ''; |
||
22 | } |
||
23 | |||
24 | View Code Duplication | if (starts_with($remote, '[email protected]:')) { |
|
|
|||
25 | // [email protected]:acacha/forge-publish.git |
||
26 | return explode('.', explode(":", $remote)[1])[0]; |
||
27 | } |
||
28 | View Code Duplication | if (starts_with($remote, 'https://github.com/')) { |
|
29 | // https://github.com/acacha/llum.git |
||
30 | return explode('.', str_replace('https://github.com/', '', $remote))[0]; |
||
31 | } |
||
32 | } |
||
33 | } |
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.