本文整理汇总了PHP中Illuminate\Filesystem\Filesystem::glob方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::glob方法的具体用法?PHP Filesystem::glob怎么用?PHP Filesystem::glob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Filesystem\Filesystem
的用法示例。
在下文中一共展示了Filesystem::glob方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeFiles
/**
* @param string $dir
*/
protected function removeFiles($dir)
{
$files = $this->filesystem->glob($dir . '/*');
foreach ($files as $file) {
$this->filesystem->delete($file);
}
}
示例2: findExtensions
/**
* Find the extensions.
*
* @param array $paths
* @return array
*/
public function findExtensions(array $paths)
{
$files = array();
// Iterate over the paths.
foreach ($paths as $path) {
// Find the extension files.
$found = $this->filesystem->glob($path . '/*/*/extension.php');
// Check if we found some files.
if (is_array($found)) {
// Merge the files.
$files = array_merge($files, $found);
}
}
$extensions = array();
// Iterate over the files.
foreach ($files as $file) {
// Get the extension attributes.
$attributes = $this->filesystem->getRequire($file);
// Check if the attributes are valid.
if (is_array($attributes) && isset($attributes['slug'])) {
// Initialise the extension class.
$extensions[$attributes['slug']] = new Extension(dirname($file), $attributes);
}
}
return $extensions;
}
示例3: findExtensionsInPath
/**
* {@inheritDoc}
*/
public function findExtensionsInPath($path)
{
$extensions = $this->filesystem->glob($path . '/*/*/extension.php');
if ($extensions === false) {
return array();
}
return $extensions;
}
示例4: fire
/**
* @return void
*/
public function fire()
{
$statics = $this->files->glob($this->notadd->publicPath() . DIRECTORY_SEPARATOR . 'cache' . '/*');
foreach ($statics as $static) {
$this->files->deleteDirectory($static);
}
$this->info('Static files cleared!');
}
示例5: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$views = $this->files->glob($this->laravel['config']['view.compiled'] . '/*');
foreach ($views as $view) {
$this->files->delete($view);
}
$this->info('Compiled views cleared!');
}
示例6: files
/**
* Get an array of paths to a given file.
* @param type $path
*/
public function files($filepath)
{
$out = array();
foreach ($this->modules as $dir) {
$files = $this->fs->glob(app_path() . "/../{$dir}/{$filepath}");
$out = array_merge($out, $files);
}
return $out;
}
示例7: determineFiles
/**
* Figure out what files are to be formatted
*
* @return string
*/
private function determineFiles()
{
// NOTE: Since we are using file, then it exist, but may not be set
if ($this->input->hasOption('file') && $this->input->getOption('file')) {
$this->output->writeln("<info>Formatting " . $this->input->getOption('file') . "</info>");
return $this->input->getOption('file');
}
$this->output->writeln("<info>Formatting code in " . $this->generator->generatedDirectory('*.php', false) . "</info>");
// Has a default, so don't have to check for existence
return implode(" ", $this->files->glob($this->generator->generatedDirectory('*.php', false)));
}
示例8: execute
/**
* Runs through the files int the API src dir, and pulls the public methods out
*
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int|null|void
*/
public function execute(InputInterface $input, OutputInterface $output)
{
$this->setInputOutput($input, $output);
$output->writeln("<info>Adding type hints to generated code...</info>");
$this->generator->setAndMakeApiDirectory($this->input->getOption('directory'), false, $this->output);
// Grab each file in the folder
foreach ($this->files->glob($this->generator->generatedDirectory('*.php', false)) as $file) {
$output->writeln("<comment>Adding type hints to " . $file . "</comment>");
$this->type_hinter->process($file);
}
}
示例9: fire
/**
* @return void
*/
public function fire()
{
$path = $this->laravel['config']['view.compiled'];
if (!$path) {
throw new RuntimeException('View path not found.');
}
foreach ($this->files->glob("{$path}/*") as $view) {
$this->files->delete($view);
}
$this->info('Compiled views cleared!');
}
示例10: init
/**
* 初始化匯入資料.
*
* @return void
*/
protected function init()
{
$dir = $this->option('dir') ? realpath($this->option('dir')) : false;
if (false !== $dir && $this->filesystem->isDirectory($dir)) {
$this->files = array_merge($this->files, $this->filesystem->glob(file_build_path($dir, '*.html')));
}
$file = $this->option('file') ? realpath($this->option('file')) : false;
if (false !== $file && ends_with($file, '.html') && $this->filesystem->isFile($file)) {
$this->files[] = $file;
}
}
示例11: fire
/**
* fire.
*
* @method fire
*/
public function fire()
{
$root = $this->getLaravel()->basePath();
$directories = ['.git', 'node_modules', 'vendor/**/**/.git', 'vendor/**/**/node_modules', 'vendor/**/**/vendor', 'vendor/**/**/Tests', 'vendor/**/**/tests', 'vendor/**/**/Test', 'vendor/**/**/test'];
(new Collection($directories))->map(function ($directory) use($root) {
return $this->filesystem->glob($root . '/' . $directory, GLOB_ONLYDIR);
})->collapse()->each(function ($directory) {
$this->filesystem->deleteDirectory($directory);
$this->error('delete directory: ' . $directory);
});
}
示例12: findPlugins
/**
* @return mixed
*/
private function findPlugins()
{
$directories = $this->filesystem->directories($this->config->get('plugins.path'));
return Collection::make($directories)->reduce(function (&$initial, $directory) {
$files = $this->filesystem->glob($directory . '/*.php');
foreach ($files as $file) {
$plugin = $this->get_plugin_data($file);
if (!empty($plugin['Title']) && !empty($plugin['Version'])) {
$plugin['Name'] = basename($directory);
$initial[] = $this->transformWPPluginToPlugin($plugin);
}
}
return $initial;
}, []);
}
示例13: getTranslationFilenamesFromPaths
/**
* Get all of the names of the Translations files from an array of Paths.
* Returns [ 'translationkeyprefix' => 'filepath' ]
* @param array $paths
* @return array
*/
protected function getTranslationFilenamesFromPaths(array $paths)
{
$files = [];
$locales = config('laravellocalization.supportedLocales');
foreach ($paths as $hint => $path) {
foreach ($locales as $locale => $language) {
foreach ($this->finder->glob("{$path}/{$locale}/*.php") as $file) {
$category = str_replace(["{$path}/", ".php", "{$locale}/"], "", $file);
$category = str_replace("/", ".", $category);
$category = !is_int($hint) ? "{$hint}::{$category}" : $category;
$files[$locale][$category] = $file;
}
}
}
return $files;
}
示例14: decompress
/**
* Decompress archive and delete non-used files.
*
* @return void
*/
protected function decompress()
{
$directory = dirname($this->archivePath);
$this->externalCommand("tar zxf {$this->archivePath}", $directory);
$specifics = [file_build_path($directory, 'index.html'), file_build_path($directory, 'all_english.html'), $this->archivePath];
$this->filesystem->delete(array_merge($this->filesystem->glob(file_build_path($directory, '*e.html')), $this->getOldFiles($directory), $specifics));
}
示例15: cleanupVendor
/**
* cleanupVendor.
*
* @method cleanupVendor
*
* @param string $vendorDirectory
*/
public function cleanupVendor($vendorDirectory)
{
$rules = static::getRules();
foreach ($rules as $packageDir => $rules) {
$packageDir = $vendorDirectory . '/' . $packageDir;
if ($this->filesystem->isDirectory($packageDir) === false) {
continue;
}
foreach ((array) $rules as $part) {
$patterns = explode(' ', trim($part));
foreach ($patterns as $pattern) {
$this->delete($this->filesystem->glob($packageDir . '/' . $pattern));
}
}
}
}