Skip to content

Commit

Permalink
Add exclude paths option
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterWoshid authored Sep 7, 2024
2 parents 20e748c + 4c87494 commit ce3f012
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/AopKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ abstract class AopKernel extends CodeTransformerKernel
*/
protected ?string $cacheDir = null;

/**
* The exclude paths. Paths/directories in this array will be excluded
*
* @var array
*/
protected array $excludePaths = [];

// endregion

/**
Expand Down
5 changes: 5 additions & 0 deletions src/Core/AutoloadInterceptor/ClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public function findFile($namespacedClass): false|string

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

foreach ($this->options->getExcludePaths() as $path) {
if (str_starts_with($filePath, Path::resolve($path))) {
return $filePath;
}
}

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

0 comments on commit ce3f012

Please sign in to comment.