Skip to content

Commit 9434399

Browse files
authored
Add exclude paths option
2 parents 518ae93 + ce3f012 commit 9434399

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"require": {
2626
"php": ">=8.1",
2727
"nette/php-generator": "^4.0",
28-
"okapi/code-transformer": "1.3.6",
28+
"okapi/code-transformer": "1.3.7",
2929
"okapi/wildcards": "^1.0",
3030
"okapi/singleton": "^1.0",
3131
"php-di/php-di": "^7.0"

src/AopKernel.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ abstract class AopKernel extends CodeTransformerKernel
5757
*/
5858
protected ?string $cacheDir = null;
5959

60+
/**
61+
* The exclude paths. Paths/directories in this array will be excluded
62+
*
63+
* @var array
64+
*/
65+
protected array $excludePaths = [];
66+
6067
// endregion
6168

6269
/**

src/Core/AutoloadInterceptor/ClassLoader.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ public function findFile($namespacedClass): false|string
5858

5959
$filePath = Path::resolve($filePath);
6060

61+
foreach ($this->options->getExcludePaths() as $path) {
62+
if (str_starts_with($filePath, Path::resolve($path))) {
63+
return $filePath;
64+
}
65+
}
6166

6267
// Query cache state
6368
$cacheState = $this->cacheStateManager->queryCacheState($filePath);

0 commit comments

Comments
 (0)