file_exists

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Checks whether a file or directory exists
<?php file_exists(string $filename): bool
<?php         $directory = $this->getAddon()->directory();

        $origin = "{$directory}config/{$filename}.php";



        if (! $this->config || ! file_exists($origin)) {

            return $this;

        }
<?php         $directory = $this->getAddon()->directory();

        $origin = "{$directory}resources/lang";



        if (! $this->translations || ! file_exists($origin)) {

            return $this;

        }
<?php     protected function bootViews()

    {

        if (file_exists($this->getAddon()->directory().'resources/views')) {

            $this->loadViewsFrom(

                $this->getAddon()->directory().'resources/views',

                $this->viewNamespace ?? $this->getAddon()->packageName()
<?php         $path = 'resources/lang/'.$lang.'.json';

        $fullPath = __DIR__.'/../../../'.$path;



        $exists = file_exists($fullPath);

        $existing = $exists ? json_decode($existingJson = $this->files->get($fullPath), true) : [];



        $json = $strings->mapWithKeys(function ($string) use ($existing) {
<?php         $path = 'resources/lang/'.$lang.'/'.$file.'.php';

        $fullPath = __DIR__.'/../../../'.$path;



        $exists = file_exists($fullPath);

        $existing = $exists ? require $fullPath : [];



        $translations = $translationCallback($existing);
<?php         $this->assertNotNull($item = $this->repo->findByHandle('new'));

        $this->assertEquals($container, $item);

        $this->assertTrue(file_exists($this->directory.'/new.yaml'));

        @unlink($this->directory.'/new.yaml');

    }

}
<?php         $this->assertNotNull($item = $this->repo->findByHandle('new'));

        $this->assertEquals(['foo' => 'bar'], $item->cascade()->all());

        $this->assertTrue(file_exists($this->directory.'/new.yaml'));

        @unlink($this->directory.'/new.yaml');

    }

}
<?php         $this->assertNotNull($item = $this->repo->findByHandle('new'));

        $this->assertEquals(['foo' => 'bar'], $item->cascade()->all());

        $this->assertTrue(file_exists($this->directory.'/new.yaml'));

        @unlink($this->directory.'/new.yaml');

    }

}
<?php         ], $files->all());




        $this->assertTrue(file_exists($this->tempDir.'/three.txt'));

    }
<?php         ], $files->all());




        $this->assertTrue(file_exists($this->tempDir.'/top-level-non-yaml-file.md'));

    }
<?php         ], $files->all());




        $this->assertTrue(file_exists($dir.'/non-yaml-file.md'));

    }
<?php         ], $files->all());




        $this->assertTrue(file_exists($dir.'/no-collection.yaml'));

        $this->assertTrue(file_exists($dir.'/no-structure.yaml'));

    }
<?php         $this->assertTrue(file_exists($dir.'/no-collection.yaml'));

        $this->assertTrue(file_exists($dir.'/no-structure.yaml'));

    }
<?php         ], $files->all());




        $this->assertTrue(file_exists($dir.'/subdirectory/nested-one.yaml'));

        $this->assertTrue(file_exists($dir.'/subdirectory/nested-two.yaml'));

        $this->assertTrue(file_exists($dir.'/three.txt'));

    }
<?php         $this->assertTrue(file_exists($dir.'/subdirectory/nested-one.yaml'));

        $this->assertTrue(file_exists($dir.'/subdirectory/nested-two.yaml'));

        $this->assertTrue(file_exists($dir.'/three.txt'));

    }