Delete any created files and folders from assets directory

@AfterScenario @assets
970805
public function cleanAssetsAfterScenario(ScenarioEvent $event) {
        foreach(\File::get() as $file) {
            if(file_exists($file->getFullPath())) $file->delete();
        }
    }
1233196
protected function removeAllImages()
    {
        //Delete old images
        $obImageList = $this->obModel->images;
        if ($obImageList->isEmpty()) {
            return;
        }

        /** @var \System\Models\File $obFile */
        foreach ($obImageList as $obFile) {
            $obFile->deleteThumbs();
            $obFile->delete();
        }
    }
1208120
public function deleteFiles()
    {
        $files = [];
        foreach ([
            DIR_CONFIG_SITE . '/site_install.php',
            DIR_CONFIG_SITE . '/site_install_user.php',
        ] as $file) {
            if ($this->filesystem->isFile($file)) {
                OpCache::clear($file);
                $files[] = $file;
            }
        }
        if (!empty($files)) {
            $this->filesystem->delete($files);
        }
    }
328433
function remove()
    {
        $path = $this->path();
        if ( file_exists( $path ) )
        {
            eZDir::recursiveDelete( $path );
        }
        $this->setInstalled( false );
    }
1210629
public function cleanup()
    {
        if ($this->option('force')) {
            $this->deleteDirs();
        } elseif ($this->confirm('Delete all subdirectories in migrations folder?', true)) {
            $this->deleteDirs();
        }
    }
872059
public function clean() {
		if (!empty($this->args[0])) {
			$folder = realpath($this->args[0]);
		} elseif ($this->params['plugin']) {
			$folder = Plugin::path(Inflector::classify($this->params['plugin']));
		} else {
			$folder = APP;
		}
		$App = new Folder($folder);
		$this->out('Checking *.php in ' . $folder);

		$files = $App->findRecursive('.*\.php');
		$this->out('Found ' . count($files) . ' files.');

		$action = $this->in('Continue? [y]/[n]', ['y', 'n'], 'n');
		if ($action !== 'y') {
			$this->abort('Aborted');
		}

		$folders = [];

		foreach ($files as $file) {
			$errors = [];
			$action = '';
			$this->out('Processing ' . $file, 1, Shell::VERBOSE);

			$c = file_get_contents($file);
			if (preg_match('/^[\n\r|\n|\r|\s]+\<\?php/', $c)) {
				$errors[] = 'leading';
			}
			if (preg_match('/\?\>[\n\r|\n|\r|\s]+$/', $c)) {
				$errors[] = 'trailing';
			}

			if (!$errors) {
				continue;
			}
			foreach ($errors as $e) {
				$this->report[$e][0]++;
			}
			$this->out('');
			$this->out('contains ' . implode(' and ', $errors) . ' whitespaces: ' . $this->shortPath($file));

			$dirname = dirname($file);
			if (in_array($dirname, $folders)) {
				$action = 'y';
			}

			while (!$action) {
				$action = $this->in('Remove? [y]/[n], [a] for all in this folder, [r] for all below, [*] for all files(!), [q] to quit', ['y', 'n', 'r', 'a', 'q', '*'], 'q');
			}

			if ($action === '*') {
				$action = 'y';

			} elseif ($action === 'a') {
				$action = 'y';
				$folders[] = $dirname;
				$this->out('All: ' . $dirname);
			}

			if ($action === 'q') {
				$this->abort('Abort... Done');
			}

			if ($action === 'y') {
				if (in_array('leading', $errors)) {
					$c = preg_replace('/^\s+\<\?php/', '<?php', $c);
				}
				if (in_array('trailing', $errors)) {
					$c = preg_replace('/\?\>\s+$/', '?>', $c);
				}

				file_put_contents($file, $c);
				foreach ($errors as $e) {
					$this->report[$e][1]++;
				}
				$this->out('fixed ' . implode(' and ', $errors) . ' whitespaces: ' . $this->shortPath($file));
			}
		}

		// Report.
		$this->out('--------');
		$this->out('found ' . $this->report['leading'][0] . ' leading, ' . $this->report['trailing'][0] . ' trailing ws');
		$this->out('fixed ' . $this->report['leading'][1] . ' leading, ' . $this->report['trailing'][1] . ' trailing ws');
	}
87226
protected function removeFilesAndDirectories()
    {
        $this->laravel['files']->deleteDirectory(config('lia.directory'));
        $this->laravel['files']->deleteDirectory(public_path('vendor/lia/'));
        $this->laravel['files']->delete(config_path('lia.php'));
        $this->laravel['files']->delete(config_path('terminal.php'));
    }
702344
private function removeDefaultStructure ()
    {
        $confirm = $this->confirm ('Are you sure? It will delete some directories with all files in them.)');

        if ($confirm) {
            try {

                $this->makeBackup();

                // deleting files and folders
                if (!file_exists (HCNewProject::CONFIG))
                    $this->abort ('Missing project configuration file for laravel version');

                $json = validateJSONFromPath (HCNewProject::CONFIG);

                foreach ($json['remove_folders'] as $location)
                    $this->deleteDirectory ($location, true);

                foreach ($json['remove_files'] as $location) {
                    $this->info ('Deleting file: ' . $location);
                    File::delete ($location);
                }

                foreach ($json['create_folders'] as $location) {
                    $this->info ('Creating folder: ' . $location);
                    $this->createDirectory ($location);
                }

                $this->createFileFromTemplate ([
                    "destination"         => 'app/' . HCNewService::CONFIG_PATH,
                    "templateDestination" => __DIR__ . '/templates/shared/hc.config.hctpl',
                    "content"             => [
                        "serviceProviderNameSpace" => "app",
                    ],
                ]);

                foreach ($json['create_files'] as $source => $destinations)
                {
                    if (!is_array($destinations))
                        $this->createProjectFile($source, $destinations);
                    else
                        foreach ($destinations as $destination)
                            $this->createProjectFile($source, $destination);
                }

                foreach ($json['copy_folders'] as $source => $destinations)
                {
                    if (!is_array($destinations))
                        File::copyDirectory(__DIR__ . "/templates/$source", base_path($destinations));
                    else
                        foreach ($destinations as $destination)
                            File::copyDirectory(__DIR__ . "/templates/$source", base_path($destination));
                }


                replaceTextInFile('composer.json', ['"App\\\\"' => '"app\\\\"']);
                replaceTextInFile('config/auth.php', ['=> App\User::class' => '=> interactivesolutions\honeycombacl\app\models\HCUsers::class']);
                replaceTextInFile('config/auth.php', ['password_resets' => 'hc_users_password_resets']);
                replaceTextInFile('config/database.php', ['utf8\'' => 'utf8mb4\'', 'utf8_' => 'utf8mb4_']);

            } catch (Exception $e) {
                $this->comment ('Error occurred!');
                $this->error ('Error code: ' . $e->getCode ());
                $this->error ('Error message: ' . $e->getMessage ());
                $this->info ('');
                $this->info ('Rolling back configuration.');
                $this->restore();
                $this->abort ('');
            }
        }
    }
468486
public function clean()
    {
        foreach($this->listFolder() as $f){
            if($f instanceof Folder){
                $f->delete(Folder::DELETE_FOLDER_RECURSIVE);
            } else if($f instanceof File){
                $f->delete();
            }
        }
    }
528060
public static function clear()
    {
        $path = root().'resources/controllers/*.php';

        $files = File::glob($path);
        //
        foreach ($files as $file) {
            File::delete($file);
        }
        //
        return true;
    }
103562
public static function deleteArchiveTables()
    {
        foreach (ArchiveTableCreator::getTablesArchivesInstalled() as $table) {
            Log::debug("Dropping table $table");

            Db::query("DROP TABLE IF EXISTS `$table`");
        }

        ArchiveTableCreator::refreshTableList($forceReload = true);
    }
92199
protected function removeFiles()
    {
        $generator = $this->getFilenameOption();
        $pattern = $this->cacheDir . DIRECTORY_SEPARATOR . $generator('*');

        $objects = new GlobIterator($pattern);

        foreach ($objects as $object) {
            unlink($object);
        }
    }
196340
public function clear()
	{
		// Path to cache folder
		$cacheDir = PATH_APP . DS . 'cache' . DS . '*';

		// Remove recursively
		foreach (glob($cacheDir) as $cacheFileOrDir)
		{
			$readable = str_replace(PATH_APP . DS, '', $cacheFileOrDir);
			if (is_dir($cacheFileOrDir))
			{
				if (!Filesystem::deleteDirectory($cacheFileOrDir))
				{
					$this->output->addLine('Unable to delete cache directory: ' . $readable, 'error');
				}
				else
				{
					$this->output->addLine($readable . ' deleted', 'success');
				}
			}
			else
			{
				// Don't delete index.html
				if ($cacheFileOrDir != PATH_APP . DS . 'cache' . DS . 'index.html')
				{
					if (!Filesystem::delete($cacheFileOrDir))
					{
						$this->output->addLine('Unable to delete cache file: ' . $readable, 'error');
					}
					else
					{
						$this->output->addLine($readable . ' deleted', 'success');
					}
				}
			}
		}

		$this->output->addLine('Clear cache complete', 'success');
	}
844456
public function purge() {
        // Get all files from the cache folder
        $contents = glob($this->_storage_path . '*');

        // Remove cache files
        foreach ($contents as $content) {
            if (is_file($content)) {
                unlink($content);
            }
        }
    }
392390
protected function cleanUp()
    {
        $files = glob(__DIR__.DIRECTORY_SEPARATOR.'Mapping'.DIRECTORY_SEPARATOR.'{DataType,Property,Type}'.DIRECTORY_SEPARATOR.'*.php', GLOB_BRACE);
        foreach ($files as $file) {
            unlink($file);
        }
    }
1114957
public function delete() : void
    {
        $files = $this->getFiles();
        foreach($files as $file) {
            $file->delete();
        }
        rmdir($this->path);
    }
1018816
public static function cleanupNotRemovedFiles()
    {
        $timeOneWeekAgo = strtotime('-1 week');

        $files = _glob(self::getTmpPath() . '/*');
        if (empty($files)) {
            return;
        }

        foreach ($files as $file) {
            if (file_exists($file)) {
                $timeLastModified = filemtime($file);

                if ($timeLastModified !== false && $timeOneWeekAgo > $timeLastModified) {
                    unlink($file);
                }
            }
        }
    }