| @@ 125-145 (lines=21) @@ | ||
| 122 | * @param Finder $finder |
|
| 123 | * @return ClassLocator |
|
| 124 | */ |
|
| 125 | public function classLocator( |
|
| 126 | array $directories = [], |
|
| 127 | array $exclude = [], |
|
| 128 | Finder $finder = null |
|
| 129 | ) { |
|
| 130 | $finder = !empty($finder) ?: new Finder(); |
|
| 131 | ||
| 132 | if (empty($directories)) { |
|
| 133 | $directories = $this->config->getDirectories(); |
|
| 134 | } |
|
| 135 | ||
| 136 | if (empty($exclude)) { |
|
| 137 | $exclude = $this->config->getExcludes(); |
|
| 138 | } |
|
| 139 | ||
| 140 | //Configuring finder |
|
| 141 | return new ClassLocator( |
|
| 142 | $this, |
|
| 143 | $finder->files()->in($directories)->exclude($exclude)->name('*.php') |
|
| 144 | ); |
|
| 145 | } |
|
| 146 | ||
| 147 | /** |
|
| 148 | * Get pre-configured invocation locator. |
|
| @@ 155-175 (lines=21) @@ | ||
| 152 | * @param Finder $finder |
|
| 153 | * @return ClassLocator |
|
| 154 | */ |
|
| 155 | public function invocationLocator( |
|
| 156 | array $directories = [], |
|
| 157 | array $exclude = [], |
|
| 158 | Finder $finder = null |
|
| 159 | ) { |
|
| 160 | $finder = !empty($finder) ?: new Finder(); |
|
| 161 | ||
| 162 | if (empty($directories)) { |
|
| 163 | $directories = $this->config->getDirectories(); |
|
| 164 | } |
|
| 165 | ||
| 166 | if (empty($exclude)) { |
|
| 167 | $exclude = $this->config->getExcludes(); |
|
| 168 | } |
|
| 169 | ||
| 170 | //Configuring finder |
|
| 171 | return new InvocationLocator( |
|
| 172 | $this, |
|
| 173 | $finder->files()->in($directories)->exclude($exclude)->name('*.php') |
|
| 174 | ); |
|
| 175 | } |
|
| 176 | ||
| 177 | /** |
|
| 178 | * {@inheritdoc} |
|