| Conditions | 9 |
| Paths | 9 |
| Total Lines | 37 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 2 |
| 1 | <?php |
||
| 15 | public function handle(Configuration $config, array $data) |
||
| 16 | { |
||
| 17 | // Write extensions folder |
||
| 18 | if (!is_dir(EXTENSIONS)) { |
||
| 19 | // Create extensions folder |
||
| 20 | $this->logger->info('WRITING: Creating ‘extensions’ folder (/extensions)'); |
||
| 21 | if (!General::realiseDirectory(EXTENSIONS, $config->get('write_mode', 'directory'))) { |
||
|
|
|||
| 22 | throw new Exception('Could not create ‘extension’ directory. Check permission on the root folder.'); |
||
| 23 | } |
||
| 24 | |||
| 25 | return true; |
||
| 26 | } |
||
| 27 | |||
| 28 | // Install existing extensions |
||
| 29 | $this->logger->info('CONFIGURING: Installing existing extensions'); |
||
| 30 | foreach (new DirectoryIterator(EXTENSIONS) as $e) { |
||
| 31 | if ($e->isDot() || $e->isFile() || !is_file($e->getRealPath() . '/extension.driver.php')) { |
||
| 32 | continue; |
||
| 33 | } |
||
| 34 | |||
| 35 | $handle = $e->getBasename(); |
||
| 36 | try { |
||
| 37 | $this->logger->debug('Enabling the extension ‘' . $handle . '’.'); |
||
| 38 | if (!ExtensionManager::enable($handle)) { |
||
| 39 | $this->logger->warning('Could not enable the extension ‘' . $handle . '’.'); |
||
| 40 | } |
||
| 41 | } catch (Exception $ex) { |
||
| 42 | $this->logger->warning(sprintf( |
||
| 43 | 'Could not enable the extension ‘%s’. %s', |
||
| 44 | $handle, |
||
| 45 | $ex->getMessage() |
||
| 46 | )); |
||
| 47 | } |
||
| 48 | } |
||
| 49 | |||
| 50 | return true; |
||
| 51 | } |
||
| 52 | } |
||
| 53 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: