Conditions | 7 |
Paths | 4 |
Total Lines | 72 |
Code Lines | 43 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
54 | $this->certExpirationWarning = $moduleConfig->getValue('certExpirationWarning', 28); |
||
55 | $this->setCategory('LDAP authentication source'); |
||
56 | |||
57 | parent::__construct($configuration); |
||
58 | } |
||
59 | |||
60 | |||
61 | /** |
||
62 | * @return void |
||
63 | */ |
||
64 | public function invokeTest() |
||
65 | { |
||
66 | // Test LDAP configuration |
||
67 | $confTest = new TestCase\AuthSource\Ldap\Configuration( |
||
68 | new TestData(['authSourceData' => $this->authSourceData]) |
||
69 | ); |
||
70 | $confTestResult = $confTest->getTestResult(); |
||
71 | $this->addTestResult($confTestResult); |
||
72 | |||
73 | if ($confTestResult->getState() === State::OK) { |
||
74 | $connection = $confTestResult->getOutput('connection'); |
||
75 | |||
76 | // Test connection for each configured LDAP-server |
||
77 | $failure = count($this->hosts); |
||
78 | foreach ($this->hosts as $hostname) { |
||
79 | $preparedTestData = $this->prepareConnection($hostname); |
||
80 | $connTest = new TestCase\Network\ConnectUri( |
||
81 | new TestData($preparedTestData) |
||
82 | ); |
||
83 | $connTestResult = $connTest->getTestResult(); |
||
84 | $this->addTestResult($connTestResult); |
||
85 | |||
86 | if ($connTestResult->getState() === State::OK) { |
||
87 | $certData = $connTestResult->getOutput('certData'); |
||
88 | |||
89 | // Test certificate when available |
||
90 | if ($certData !== null) { |
||
91 | $certTest = new TestCase\Cert( |
||
92 | new TestData([ |
||
93 | 'certData' => $certData, |
||
94 | 'category' => 'LDAP Server Certificate', |
||
95 | 'certExpirationWarning' => $this->certExpirationWarning, |
||
96 | ]) |
||
97 | ); |
||
98 | $certTestResult = $certTest->getTestResult(); |
||
99 | $this->addTestResult($certTestResult); |
||
100 | } |
||
101 | $failure--; |
||
102 | } |
||
103 | } |
||
104 | |||
105 | if ($failure === 0) { |
||
106 | // Test bind |
||
107 | $bindTest = new TestCase\AuthSource\Ldap\Bind( |
||
108 | new TestData([ |
||
109 | 'authSourceData' => $this->authSourceData, |
||
110 | 'connection' => $connection |
||
111 | ]) |
||
112 | ); |
||
113 | $bindTestResult = $bindTest->getTestResult(); |
||
114 | $this->addTestResult($bindTestResult); |
||
115 | |||
116 | if ($bindTestResult->getState() === State::OK) { |
||
117 | // Test search |
||
118 | $searchTest = new TestCase\AuthSource\Ldap\Search( |
||
119 | new TestData([ |
||
120 | 'authSourceData' => $this->authSourceData, |
||
121 | 'connection' => $connection |
||
122 | ]) |
||
123 | ); |
||
124 | $searchTestResult = $searchTest->getTestResult(); |
||
125 | $this->addTestResult($searchTestResult); |
||
126 | } |
||
174 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths