src/Theme.php
private function preventDirectoryTraversal(string $themePath, string $filePath)
    {
        $themePath = realpath($themePath);
        $filePath  = realpath($filePath);

        if ($filePath === false || strpos($filePath, $themePath) !== 0) {
            throw new DirectoryTraversalException('Trying to load a file outside of the theme directory.');
        }
    }
private function preventDirectoryTraversal(string $themePath, string $filePath)
    {
        $themePath = realpath($themePath);
        $filePath  = realpath($filePath);

        if ($filePath === false || strpos($filePath, $themePath) !== 0) {
            throw new DirectoryTraversalException('Trying to load a file outside of the theme directory.');
        }
    }
private function preventDirectoryTraversal ( string $ themePath , string $ filePath ) { $ themePath = realpath ( $ themePath ) ; $ filePath = realpath ( $ filePath ) ; if ( $ filePath === false || strpos ( $ filePath , $ themePath ) !== 0 ) { throw new DirectoryTraversalException ( 'Trying to load a file outside of the theme directory.' ) ; } }
Validates the file path to prevent directory traversal

@param string $themePath The base path of the theme
@param string $filePath  The file path

@throws DirectoryTraversalException
Validates the file path to prevent directory traversal