Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Tells whether the filename is a directory
<?php is_dir(string $filename): bool
<?php         return match (true) {

            isset($_ENV['APP_BASE_PATH']) => $_ENV['APP_BASE_PATH'],

            default => match (true) {

                is_dir($basePath.'/app') => ($basePath.'/app'),

                is_dir($basePath.'/src') => ($basePath.'/src'),

                default => $basePath,

            },
<?php             isset($_ENV['APP_BASE_PATH']) => $_ENV['APP_BASE_PATH'],

            default => match (true) {

                is_dir($basePath.'/app') => ($basePath.'/app'),

                is_dir($basePath.'/src') => ($basePath.'/src'),

                default => $basePath,

            },

        };
<?php     public function getCacheFile(string $key): string

    {

        if (! is_dir($this->cacheDirectory) && ! mkdir($this->cacheDirectory, 0755, true)) {

            throw new RuntimeException("Could not create cache directory: {$this->cacheDirectory}");

        }
<?php     $dir = __DIR__.'/../.peck.cache';



    if (is_dir($dir)) {

        $files = scandir($dir);



        foreach ($files as $file) {
<?php it('should be possible to use other cache directories', function (): void {

    $dir = __DIR__.'/../../.peck-test.cache';



    if (is_dir($dir)) {

        foreach (array_diff(scandir($dir), ['.', '..']) as $file) {

            unlink("{$dir}/{$file}");

        }
<?php it('should return null when cache file exists but is not readable', function (): void {

    $dir = __DIR__.'/../../.peck-test.cache';



    if (is_dir($dir)) {

        foreach (array_diff(scandir($dir), ['.', '..']) as $file) {

            unlink("{$dir}/{$file}");

        }
<?php it('detects issues that always don\'t have cache', function (): void {

    $dir = __DIR__.'/../../.peck-test.cache';



    if (! is_dir($dir)) {

        mkdir($dir);

    }