| @@ 57-66 (lines=10) @@ | ||
| 54 | public function import($filepath, callable $filter = null): bool |
|
| 55 | { |
|
| 56 | $file = new File($this->applicationRoot . "/" . $filepath); |
|
| 57 | if ($file->isFile()) { |
|
| 58 | if ($file->getFileExtension() === 'php') { |
|
| 59 | if ($filter === null || (is_callable($filter) && $filter($file->getFilePath()) === true)) { |
|
| 60 | include_once $file->getFilePath(); |
|
| 61 | $this->logger->debug($file->getFilePath() . " import success."); |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| 65 | return true; |
|
| 66 | } |
|
| 67 | ||
| 68 | return false; |
|
| 69 | } |
|
| @@ 89-94 (lines=6) @@ | ||
| 86 | } |
|
| 87 | $file = new File($filepath); |
|
| 88 | if ($file->isFile()) { |
|
| 89 | if ($file->getFileExtension() === 'php') { |
|
| 90 | if ($filter === null || (is_callable($filter) && $filter($file->getFilePath()) === true)) { |
|
| 91 | include_once $file->getFilePath(); |
|
| 92 | $this->logger->debug($file->getFilePath() . " import success."); |
|
| 93 | } |
|
| 94 | } |
|
| 95 | } else { |
|
| 96 | $this->logger->warn($filepath . " import failure."); |
|
| 97 | $isSuccess = false; |
|