| Conditions | 2 |
| Paths | 2 |
| Total Lines | 56 |
| Code Lines | 33 |
| 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 |
||
| 122 | protected function setupHelpers( |
||
| 123 | ITask $page, |
||
| 124 | SiteConfiguration $siteConfiguration, |
||
| 125 | PdoDatabase $database, |
||
| 126 | PdoDatabase $notificationsDatabase = null |
||
| 127 | ) { |
||
| 128 | $page->setSiteConfiguration($siteConfiguration); |
||
| 129 | |||
| 130 | // setup the global database object |
||
| 131 | $page->setDatabase($database); |
||
| 132 | |||
| 133 | // set up helpers and inject them into the page. |
||
| 134 | $httpHelper = new HttpHelper( |
||
| 135 | $siteConfiguration->getUserAgent(), |
||
| 136 | $siteConfiguration->getCurlDisableVerifyPeer() |
||
| 137 | ); |
||
| 138 | |||
| 139 | $page->setEmailHelper(new EmailHelper()); |
||
| 140 | $page->setHttpHelper($httpHelper); |
||
| 141 | $page->setWikiTextHelper(new WikiTextHelper($siteConfiguration, $page->getHttpHelper())); |
||
| 142 | |||
| 143 | if ($siteConfiguration->getLocationProviderApiKey() === null) { |
||
| 144 | $page->setLocationProvider(new FakeLocationProvider()); |
||
| 145 | } |
||
| 146 | else { |
||
| 147 | $page->setLocationProvider( |
||
| 148 | new IpLocationProvider( |
||
| 149 | $database, |
||
| 150 | $siteConfiguration->getLocationProviderApiKey(), |
||
| 151 | $httpHelper |
||
| 152 | )); |
||
| 153 | } |
||
| 154 | |||
| 155 | $page->setXffTrustProvider(new XffTrustProvider($siteConfiguration->getSquidList(), $database)); |
||
| 156 | |||
| 157 | $page->setRdnsProvider(new CachedRDnsLookupProvider($database)); |
||
| 158 | |||
| 159 | $page->setAntiSpoofProvider(new CachedApiAntispoofProvider( |
||
| 160 | $database, |
||
| 161 | $this->getConfiguration()->getMediawikiWebServiceEndpoint(), |
||
| 162 | $httpHelper)); |
||
| 163 | |||
| 164 | $page->setOAuthHelper(new OAuthHelper( |
||
| 165 | $siteConfiguration->getOAuthBaseUrl(), |
||
| 166 | $siteConfiguration->getOAuthConsumerToken(), |
||
| 167 | $siteConfiguration->getOAuthConsumerSecret(), |
||
| 168 | $httpHelper, |
||
| 169 | $siteConfiguration->getMediawikiWebServiceEndpoint() |
||
| 170 | )); |
||
| 171 | |||
| 172 | $page->setNotificationHelper(new IrcNotificationHelper( |
||
| 173 | $siteConfiguration, |
||
| 174 | $database, |
||
| 175 | $notificationsDatabase)); |
||
| 176 | |||
| 177 | $page->setTorExitProvider(new TorExitProvider($database)); |
||
| 178 | } |
||
| 179 | } |
||
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