deleteEverything example

private static ?array $instances = null;

    public static function clearInstancesMemory(): void
    {
        if (!static::$instances) {
            static::$instances = [];

            return;
        }

        foreach (static::$instances as $memoryAdapter) {
            $memoryAdapter->deleteEverything();
        }
    }

    public static function resetInstances(): void
    {
        static::clearInstancesMemory();
        static::$instances = [];
    }

    public function create(array $config): FilesystemAdapter
    {
        

class InMemoryFilesystemAdapterTest extends TestCase
{
    public function testDelete(): void
    {
        $memoryFilesystemAdapter = new MemoryFilesystemAdapter();
        $fs = new Filesystem($memoryFilesystemAdapter);
        $fs->write('a.txt', 'foo');
        static::assertTrue($fs->fileExists('a.txt'));
        static::assertFalse($fs->directoryExists('a.txt'));
        $memoryFilesystemAdapter->deleteEverything();

        static::assertFalse($fs->fileExists('a.txt'));
        static::assertFalse($fs->directoryExists('a.txt'));

        $fs->write('a.txt', 'foo');
        static::assertTrue($fs->fileExists('a.txt'));
        $fs->delete('a.txt');
        static::assertFalse($fs->fileExists('a.txt'));
    }

    public function testDeleteDirectory(): void
    {
Home | Imprint | This part of the site doesn't use cookies.