1 | <?php |
||
15 | class FileLocator implements FileLocatorInterface |
||
16 | { |
||
17 | protected string $proxiesDirectory; |
||
|
|||
18 | |||
19 | /** |
||
20 | * @throws InvalidProxyDirectoryException |
||
21 | */ |
||
22 | public function __construct(string $proxiesDirectory) |
||
23 | { |
||
24 | $absolutePath = realpath($proxiesDirectory); |
||
25 | 2 | ||
26 | if ($absolutePath === false) { |
||
27 | 2 | throw InvalidProxyDirectoryException::proxyDirectoryNotFound($proxiesDirectory); |
|
28 | } |
||
29 | 2 | ||
30 | 1 | $this->proxiesDirectory = $absolutePath; |
|
31 | } |
||
32 | |||
33 | 1 | /** |
|
34 | 1 | * {@inheritDoc} |
|
35 | */ |
||
36 | public function getProxyFileName(string $className) : string |
||
37 | { |
||
38 | return $this->proxiesDirectory . DIRECTORY_SEPARATOR . str_replace('\\', '', $className) . '.php'; |
||
39 | 1 | } |
|
40 | } |
||
41 |