| @@ 137-157 (lines=21) @@ | ||
| 134 | * @param Finder $finder |
|
| 135 | * @return ClassLocator |
|
| 136 | */ |
|
| 137 | public function classLocator( |
|
| 138 | array $directories = [], |
|
| 139 | array $exclude = [], |
|
| 140 | Finder $finder = null |
|
| 141 | ) { |
|
| 142 | $finder = !empty($finder) ?: new Finder(); |
|
| 143 | ||
| 144 | if (empty($directories)) { |
|
| 145 | $directories = $this->config->getDirectories(); |
|
| 146 | } |
|
| 147 | ||
| 148 | if (empty($exclude)) { |
|
| 149 | $exclude = $this->config->getExcludes(); |
|
| 150 | } |
|
| 151 | ||
| 152 | //Configuring finder |
|
| 153 | return new ClassLocator( |
|
| 154 | $this, |
|
| 155 | $finder->files()->in($directories)->exclude($exclude)->name('*.php') |
|
| 156 | ); |
|
| 157 | } |
|
| 158 | ||
| 159 | /** |
|
| 160 | * Get pre-configured invocation locator. |
|
| @@ 167-187 (lines=21) @@ | ||
| 164 | * @param Finder $finder |
|
| 165 | * @return ClassLocator |
|
| 166 | */ |
|
| 167 | public function invocationLocator( |
|
| 168 | array $directories = [], |
|
| 169 | array $exclude = [], |
|
| 170 | Finder $finder = null |
|
| 171 | ) { |
|
| 172 | $finder = !empty($finder) ?: new Finder(); |
|
| 173 | ||
| 174 | if (empty($directories)) { |
|
| 175 | $directories = $this->config->getDirectories(); |
|
| 176 | } |
|
| 177 | ||
| 178 | if (empty($exclude)) { |
|
| 179 | $exclude = $this->config->getExcludes(); |
|
| 180 | } |
|
| 181 | ||
| 182 | //Configuring finder |
|
| 183 | return new InvocationLocator( |
|
| 184 | $this, |
|
| 185 | $finder->files()->in($directories)->exclude($exclude)->name('*.php') |
|
| 186 | ); |
|
| 187 | } |
|
| 188 | ||
| 189 | /** |
|
| 190 | * {@inheritdoc} |
|