These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace MatthiasMullie\CI\Providers; |
||
4 | |||
5 | use MatthiasMullie\CI\Environment; |
||
6 | |||
7 | /** |
||
8 | * @see https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project#Buildingasoftwareproject-JenkinsSetEnvironmentVariables |
||
9 | * @see https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin#GitHubpullrequestbuilderplugin-EnvironmentVariables |
||
10 | * |
||
11 | * @author Matthias Mullie <[email protected]> |
||
12 | * @copyright Copyright (c) 2016, Matthias Mullie. All rights reserved. |
||
13 | * @license LICENSE MIT |
||
14 | */ |
||
15 | class Jenkins extends None implements Environment |
||
16 | { |
||
17 | /** |
||
18 | * {@inheritdoc} |
||
19 | */ |
||
20 | public static function isCurrent() |
||
21 | { |
||
22 | return getenv('JENKINS_URL') !== false; |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * {@inheritdoc} |
||
27 | */ |
||
28 | public function getProvider() |
||
29 | { |
||
30 | return 'jenkins'; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | */ |
||
36 | public function getRepo() |
||
37 | { |
||
38 | return getenv('GIT_URL'); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | public function getBranch() |
||
45 | { |
||
46 | return getenv('ghprbSourceBranch') ?: getenv('GIT_BRANCH') ?: getenv('CVS_BRANCH'); |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | public function getPullRequest() |
||
53 | { |
||
54 | return getenv('ghprbPullId') ?: ''; |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | public function getCommit() |
||
61 | { |
||
62 | return getenv('ghprbActualCommit') ?: getenv('GIT_COMMIT'); |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | public function getAuthor() |
||
69 | { |
||
70 | return getenv('ghprbActualCommitAuthor') ?: parent::getAuthor(); |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | public function getAuthorEmail() |
||
77 | { |
||
78 | return getenv('ghprbActualCommitAuthorEmail') ?: parent::getAuthor(); |
||
0 ignored issues
–
show
|
|||
79 | } |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | public function getBuild() |
||
85 | { |
||
86 | return getenv('BUILD_NUMBER'); |
||
87 | } |
||
88 | } |
||
89 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.