当前位置: 首页>>代码示例>>PHP>>正文


PHP Finder::notName方法代码示例

本文整理汇总了PHP中Symfony\Component\Finder\Finder::notName方法的典型用法代码示例。如果您正苦于以下问题:PHP Finder::notName方法的具体用法?PHP Finder::notName怎么用?PHP Finder::notName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Finder\Finder的用法示例。


在下文中一共展示了Finder::notName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: findFiles

 /**
  * @return array
  */
 public function findFiles()
 {
     $files = array();
     $finder = new Finder();
     $iterate = false;
     $finder->ignoreUnreadableDirs();
     foreach ($this->items as $item) {
         if (!is_file($item)) {
             $finder->in($item);
             $iterate = true;
         } else {
             $files[] = realpath($item);
         }
     }
     foreach ($this->excludes as $exclude) {
         $finder->exclude($exclude);
     }
     foreach ($this->names as $name) {
         $finder->name($name);
     }
     foreach ($this->notNames as $notName) {
         $finder->notName($notName);
     }
     foreach ($this->regularExpressionsExcludes as $regularExpressionExclude) {
         $finder->notPath($regularExpressionExclude);
     }
     if ($iterate) {
         foreach ($finder as $file) {
             $files[] = $file->getRealpath();
         }
     }
     return $files;
 }
开发者ID:sakshika,项目名称:ATM,代码行数:36,代码来源:FinderFacade.php

示例2: testNotName

 public function testNotName()
 {
     $finder = new Finder();
     $this->assertSame($finder, $finder->notName('*.php'));
     $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'test.py', 'toto')), $finder->in(self::$tmpDir)->getIterator());
     $finder = new Finder();
     $finder->notName('*.php');
     $finder->notName('*.py');
     $this->assertIterator($this->toAbsolute(array('foo', 'foo/bar.tmp', 'toto')), $finder->in(self::$tmpDir)->getIterator());
     $finder = new Finder();
     $finder->name('test.ph*');
     $finder->name('test.py');
     $finder->notName('*.php');
     $finder->notName('*.py');
     $this->assertIterator(array(), $finder->in(self::$tmpDir)->getIterator());
 }
开发者ID:navassouza,项目名称:symfony,代码行数:16,代码来源:FinderTest.php

示例3: withFilters

 /**
  * @param array $filters
  * @return $this
  */
 public function withFilters(array $filters)
 {
     if (!empty($filters)) {
         foreach ($filters as $currentFilter) {
             if (!strpos($currentFilter, ':')) {
                 throw new \InvalidArgumentException(sprintf('The filter "%s" is not a valid filter. A valid filter has the format <name>:<value>.', $currentFilter));
             }
             $currentFilterElements = explode(':', $currentFilter, 2);
             switch (trim($currentFilterElements[0])) {
                 case 'exclude':
                     $this->finder->exclude($currentFilterElements[1]);
                     break;
                 case 'name':
                     $this->finder->name($currentFilterElements[1]);
                     break;
                 case 'notName':
                     $this->finder->notName($currentFilterElements[1]);
                     break;
                 case 'path':
                     $this->finder->path($currentFilterElements[1]);
                     break;
                 case 'size':
                     $this->finder->size($currentFilterElements[1]);
             }
         }
     }
     return $this;
 }
开发者ID:suralc,项目名称:pvra,代码行数:32,代码来源:FileFinderBuilder.php

示例4: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln($this->getDescription() . PHP_EOL);
     $target = $input->getArgument('target');
     $sources = $this->createArrayBy($input->getOption('source'));
     $excludes = $this->createArrayBy($input->getOption('exclude'));
     $noComments = (bool) $input->getOption('nocomments');
     $this->writer->setTarget($target);
     $this->finder->in($sources)->exclude($excludes);
     if ($notName = $input->getOption('notname')) {
         $this->finder->notName($notName);
     }
     $output->writeln(sprintf(Message::PROGRESS_FILTER, $this->finder->count()));
     $classMap = $this->filter->extractClassMapFrom($this->finder->getIterator());
     $output->writeln(sprintf(Message::PROGRESS_WRITE, $target));
     $this->writer->minify($classMap, $noComments);
     $output->writeln(PHP_EOL . Message::PROGRESS_DONE . PHP_EOL);
 }
开发者ID:mamuz,项目名称:squeezer,代码行数:18,代码来源:Command.php

示例5: add

 /**
  * 
  * @param type $filepattern
  * @param type $dir
  * @param type $excludepattern
  * @return \Awakenweb\Beverage\Beverage
  */
 public function add($filepattern, $dir, $excludepattern)
 {
     $finder = new Finder();
     $finder->files()->ignoreUnreadableDirs()->name($filepattern);
     if ($excludepattern) {
         $finder->notName($excludepattern);
     }
     foreach ($dir as $directory) {
         $finder->in($directory);
     }
     foreach ($finder as $matching_file) {
         $basename = $matching_file->getBasename();
         $this->current_state[$basename] = $matching_file->getContents();
     }
     return $this;
 }
开发者ID:awakenweb,项目名称:beverage,代码行数:23,代码来源:Beverage.php

示例6: run

 public function run()
 {
     $files = [];
     $this->console('<comment>Watch server running.</comment>');
     do {
         foreach ($this->files_iterators as $fi) {
             $finder = new Finder();
             $finder->files()->ignoreUnreadableDirs()->name($fi['filepattern']);
             if ($fi['excludepattern']) {
                 $finder->notName($fi['excludepattern']);
             }
             foreach ($fi['dir'] as $directory) {
                 $finder->in($directory);
             }
             foreach ($finder as $file) {
                 /**
                  * Register the file the first time it is encountered
                  */
                 if (!isset($files[$file->getBasename()])) {
                     $files[$file->getBasename()] = $file->getMTime();
                 }
                 /**
                  * Check if the file has changed
                  */
                 if ($files[$file->getBasename()] !== $file->getMTime()) {
                     $this->console('File ' . $file->getBasename() . ' has been modified');
                     $files[$file->getBasename()] = $file->getMTime();
                     try {
                         $this->runBefore();
                         foreach ($fi['tasks'] as $task) {
                             $this->console('Running ' . $task . ' task');
                             $task();
                             $this->console('Task ' . $task . ' successful');
                         }
                         $this->runAfter();
                     } catch (\Exception $ex) {
                         $this->console("<error>An error occured when running the tasks.</error>");
                     }
                 }
             }
             unset($finder);
         }
         sleep(3);
     } while (1);
 }
开发者ID:awakenweb,项目名称:beverage,代码行数:45,代码来源:Watcher.php

示例7: _findFiles

 private function _findFiles()
 {
     $finder = new Finder();
     $finder->files();
     foreach ($this->_excludePatterns as $excludePattern) {
         $finder->notName($excludePattern);
     }
     foreach ($this->_paths as $p) {
         $finder->in($p);
     }
     if ($this->_followLinks) {
         $finder->followLinks();
     }
     $files = array();
     foreach ($finder as $f) {
         $files[$f->getRealpath()] = array('mtime' => $f->getMTime(), 'perms' => $f->getPerms(), 'owner' => $f->getOwner(), 'group' => $f->getGroup());
     }
     return $files;
 }
开发者ID:koala-framework,项目名称:file-watcher,代码行数:19,代码来源:Poll.php

示例8: registerCommands

 /**
  * {@inheritdoc}
  */
 public function registerCommands(Application $application)
 {
     if (!is_dir($dir = $this->getPath() . '/Command')) {
         return;
     }
     $finder = new Finder();
     $finder->files()->name('*Command.php')->in($dir);
     // Don't enable the generate command when SensioGeneratorBundle is not installed
     if (!class_exists('Sensio\\Bundle\\GeneratorBundle\\Command\\GenerateBundleCommand')) {
         $finder->notName('GenerateUserSysCommand.php');
     }
     $prefix = $this->getNamespace() . '\\Command';
     foreach ($finder as $file) {
         $ns = $prefix;
         if ($relativePath = $file->getRelativePath()) {
             $ns .= '\\' . strtr($relativePath, '/', '\\');
         }
         $class = $ns . '\\' . $file->getBasename('.php');
         $r = new \ReflectionClass($class);
         if ($r->isSubclassOf('Symfony\\Component\\Console\\Command\\Command') && !$r->isAbstract() && !$r->getConstructor()->getNumberOfRequiredParameters()) {
             $application->add($r->newInstance());
         }
     }
 }
开发者ID:buddhikajay,项目名称:RollerworksMultiUserBundle,代码行数:27,代码来源:RollerworksMultiUserBundle.php

示例9: getConfigFiles

 /**
  * @return array|\Iterator
  */
 public function getConfigFiles()
 {
     try {
         $f = new Finder();
         $f->name('*.xml.skeleton');
         $f->name('*.yml.skeleton');
         $f->notName('*.orm.xml.skeleton');
         $f->notName('*.orm.yml.skeleton');
         $f->notPath('doctrine/');
         $f->notPath('serializer/');
         $f->in($this->getMappingConfigDirectory());
         return $f->getIterator();
     } catch (\Exception $e) {
         return array();
     }
 }
开发者ID:rapemer,项目名称:init-cms-bundle,代码行数:19,代码来源:GenerateCommand.php

示例10: _parseIterator

 /**
  * @param \DOMNode $node
  * @return \Iterator|null
  */
 protected function _parseIterator(DOMNode $node)
 {
     $finder = new Finder();
     $finder->files();
     foreach ($node->childNodes as $option) {
         if ($option->nodeType === XML_ELEMENT_NODE) {
             $nodeName = strtolower($option->nodeName);
             $value = $option->nodeValue;
             switch ($nodeName) {
                 case 'name':
                     $finder->name($value);
                     break;
                 case 'notname':
                     $finder->notName($value);
                     break;
                 case 'path':
                     $finder->in($value);
                     break;
                 case 'size':
                     $finder->size($value);
                     break;
                 case 'exclude':
                     $finder->exclude($value);
                     break;
             }
         }
     }
     return $finder->getIterator();
 }
开发者ID:robo47,项目名称:php-manipulator,代码行数:33,代码来源:Xml.php

示例11: index

 public function index()
 {
     /*
     |--------------------------------------------------------------------------
     | Paramers
     |--------------------------------------------------------------------------
     |
     | Match overrides Extension. Exclusion applies in both cases.
     |
     */
     $match = $this->fetchParam('match', false);
     $exclude = $this->fetchParam('exclude', false);
     $extension = $this->fetchParam(array('extension', 'type'), false);
     $in = $this->fetchParam(array('in', 'folder', 'from'), false);
     $not_in = $this->fetchParam('not_in', false);
     $file_size = $this->fetchParam('file_size', false);
     $file_date = $this->fetchParam('file_date', false);
     $depth = $this->fetchParam('depth', false);
     $sort_by = $this->fetchParam(array('sort_by', 'order_by'), false);
     $sort_dir = $this->fetchParam(array('sort_dir', 'sort_direction'), 'asc');
     $limit = $this->fetchParam('limit', false);
     if ($in) {
         $in = Helper::explodeOptions($in);
     }
     if ($not_in) {
         $not_in = Helper::explodeOptions($not_in);
     }
     if ($file_size) {
         $file_size = Helper::explodeOptions($file_size);
     }
     if ($extension) {
         $extension = Helper::explodeOptions($extension);
     }
     /*
     |--------------------------------------------------------------------------
     | Finder
     |--------------------------------------------------------------------------
     |
     | Get_Files implements most of the Symfony Finder component as a clean
     | tag wrapper mapped to matched filenames.
     |
     */
     $finder = new Finder();
     if ($in) {
         foreach ($in as $location) {
             $finder->in(Path::fromAsset($location));
         }
     }
     /*
     |--------------------------------------------------------------------------
     | Name
     |--------------------------------------------------------------------------
     |
     | Match is the "native" Finder name() method, which is supposed to
     | implement string, glob, and regex. The glob support is only partial,
     | so "extension" is a looped *single* glob rule iterator.
     |
     */
     if ($match) {
         $finder->name($match);
     } elseif ($extension) {
         foreach ($extension as $ext) {
             $finder->name("*.{$ext}");
         }
     }
     /*
     |--------------------------------------------------------------------------
     | Exclude
     |--------------------------------------------------------------------------
     |
     | Exclude directories from matching. Remapped to "not in" to allow more
     | intuitive differentiation between filename and directory matching.
     |
     */
     if ($not_in) {
         foreach ($not_in as $location) {
             $finder->exclude($location);
         }
     }
     /*
     |--------------------------------------------------------------------------
     | Not Name
     |--------------------------------------------------------------------------
     |
     | Exclude files matching a given pattern: string, regex, or glob.
     | By default we don't allow looking for PHP files. Be smart.
     |
     */
     if ($this->fetchParam('allow_php', false) !== TRUE) {
         $finder->notName("*.php");
     }
     if ($exclude) {
         $finder->notName($exclude);
     }
     /*
     |--------------------------------------------------------------------------
     | File Size
     |--------------------------------------------------------------------------
     |
     | Restrict files by size. Can be chained and allows comparison operators.
//.........这里部分代码省略.........
开发者ID:andorpandor,项目名称:git-deploy.eu2.frbit.com-yr-prototype,代码行数:101,代码来源:pi.get_files.php

示例12: getAllFiles

 /**
  * Lista carpeta y archivos segun el path ingresado, no recursivo, ordenado por tipo y nombre
  * 
  * @param string $path Ruta de la carpeta o archivo
  * @return array|null Listado de archivos o null si no existe
  */
 public function getAllFiles($path)
 {
     $fullpath = $this->getFullPath() . $path;
     if (file_exists($fullpath)) {
         $file = new \SplFileInfo($fullpath);
         if ($file->isDir()) {
             $r = array();
             // if($path != "/") $r[] = $this->folderParent($path);
             $finder = new Finder();
             $directories = $finder->notName('_thumbs')->notName('web.config')->notName('.htaccess')->depth(0)->sortByType();
             // $directories = $directories->files()->name('*.jpg');
             $directories = $directories->in($fullpath);
             foreach ($directories as $key => $directorie) {
                 $namefile = $directorie->getFilename();
                 if ($directorie->isDir() && $this->validNameFile($namefile, false)) {
                     $t = $this->fileInfo($directorie, $path);
                     if ($t) {
                         $r[] = $t;
                     }
                 } elseif ($directorie->isFile() && $this->validNameFile($namefile)) {
                     $t = $this->fileInfo($directorie, $path);
                     if ($t) {
                         $r[] = $t;
                     }
                 }
             }
             return $r;
         } elseif ($file->isFile()) {
             $t = $this->fileInfo($file, $path);
             if ($t) {
                 return $t;
             } else {
                 $result = array("query" => "BE_GETFILEALL_NOT_LEIBLE", "params" => array());
                 $this->setInfo(array("msg" => $result));
                 if ($this->config['debug']) {
                     $this->_log(__METHOD__ . " - Archivo no leible - {$fullpath}");
                 }
                 return;
             }
         } elseif ($file->isLink()) {
             $result = array("query" => "BE_GETFILEALL_NOT_PERMITIDO", "params" => array());
             $this->setInfo(array("msg" => $result));
             if ($this->config['debug']) {
                 $this->_log(__METHOD__ . " - path desconocido - {$fullpath}");
             }
             return;
         }
     } else {
         $result = array("query" => "BE_GETFILEALL_NOT_EXISTED", "params" => array());
         $this->setInfo(array("msg" => $result));
         if ($this->config['debug']) {
             $this->_log(__METHOD__ . " - No existe el archivo - {$fullpath}");
         }
         return;
     }
 }
开发者ID:guillermomartinez,项目名称:filemanager-php,代码行数:62,代码来源:Filemanager.php

示例13: cleanCustom

 /**
  * @param OutputInterface $output
  * @return void
  */
 protected function cleanCustom(OutputInterface $output)
 {
     if (empty($this->options['custom'])) {
         return;
     }
     foreach ($this->options['custom'] as $options) {
         try {
             $finder = new Finder();
             $finder->ignoreDotFiles(false);
             $finder->ignoreVCS(false);
             $finder->ignoreUnreadableDirs(true);
             $in = [];
             if (!is_array($options['in'])) {
                 $options['in'] = [$options['in']];
             }
             foreach ($options['in'] as $dir) {
                 $in[] = $this->baseDir . $dir;
             }
             $finder->in($in);
             if (!empty($options['type'])) {
                 switch ($options['type']) {
                     case 'files':
                         $finder->files();
                         break;
                     case 'dirs':
                     case 'directories':
                         $finder->directories();
                         break;
                 }
             }
             if (!empty($options['notName'])) {
                 if (!is_array($options['notName'])) {
                     $options['notName'] = [$options['notName']];
                 }
                 foreach ($options['notName'] as $notName) {
                     $finder->notName($notName);
                 }
             }
             if (!empty($options['name'])) {
                 if (!is_array($options['name'])) {
                     $options['name'] = [$options['name']];
                 }
                 foreach ($options['name'] as $notName) {
                     $finder->name($notName);
                 }
             }
             if (!empty($options['depth'])) {
                 $finder->depth($options['depth']);
             }
             foreach ($finder as $file) {
                 $this->files[] = $file->getRealPath();
             }
         } catch (\Exception $e) {
             // ignore errors
         }
     }
 }
开发者ID:mediamonks,项目名称:composer-vendor-cleaner,代码行数:61,代码来源:CleanCommand.php

示例14: findFiles

 /**
  * Find all files to merge.
  *
  * @param string $directory
  * @param array  $names
  * @param array  $ignoreNames
  *
  * @return Finder
  */
 private function findFiles($directory, array $names, array $ignoreNames)
 {
     $finder = new Finder();
     $finder->files()->in($directory);
     foreach ($names as $name) {
         $finder->name($name);
     }
     foreach ($ignoreNames as $name) {
         $finder->notName($name);
     }
     $finder->sortByName();
     return $finder;
 }
开发者ID:andreas-weber,项目名称:php-junit-merge,代码行数:22,代码来源:Command.php

示例15: getFiles

 /**
  * Get a list of plugin files.
  *
  * @param Finder $finder The finder to use, can be pre-configured
  *
  * @return array Of files
  */
 public function getFiles(Finder $finder)
 {
     $finder->files()->in($this->directory)->ignoreUnreadableDirs();
     // Ignore third party libraries.
     foreach ($this->getThirdPartyLibraryPaths() as $libPath) {
         $finder->notPath($libPath);
     }
     // Extra ignores for CI.
     $ignores = $this->getIgnores();
     if (!empty($ignores['notPaths'])) {
         foreach ($ignores['notPaths'] as $notPath) {
             $finder->notPath($notPath);
         }
     }
     if (!empty($ignores['notNames'])) {
         foreach ($ignores['notNames'] as $notName) {
             $finder->notName($notName);
         }
     }
     $files = [];
     foreach ($finder as $file) {
         /* @var \SplFileInfo $file */
         $files[] = $file->getRealpath();
     }
     return $files;
 }
开发者ID:gjb2048,项目名称:moodle-plugin-ci,代码行数:33,代码来源:MoodlePlugin.php


注:本文中的Symfony\Component\Finder\Finder::notName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。