• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP AppendIterator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中AppendIterator的典型用法代码示例。如果您正苦于以下问题:PHP AppendIterator类的具体用法?PHP AppendIterator怎么用?PHP AppendIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: concat

 /**
  * Concatenates one or more foreach-able object into an Iterator.
  * If no objects provided, returns an empty iterator.
  * \AppendIterators provided will be deep copied.
  * 		This means changes to \AppendIterator parameters will not be reflected
  * 		in the resulting \Iterator.
  * @return \Iterator
  */
 public static function concat()
 {
     $argCount = \func_num_args();
     if ($argCount === 0) {
         return new \EmptyIterator();
     } elseif ($argCount === 1) {
         return Iterators::ensureIsIterator(\func_get_args()[0]);
     } else {
         $retval = new \AppendIterator();
         //Workaround for AppendIterator bugs
         //https://bugs.php.net/bug.php?id=49104
         //https://bugs.php.net/bug.php?id=62212
         $retval->append(new \ArrayIterator([0]));
         unset($retval->getArrayIterator()[0]);
         $recursiveAttach = static function ($iter) use(&$recursiveAttach, $retval) {
             foreach ($iter as $concatedIter) {
                 if ($concatedIter instanceof \AppendIterator) {
                     $recursiveAttach($concatedIter->getArrayIterator());
                 } elseif ($concatedIter instanceof \EmptyIterator) {
                     //Do not add it.
                 } else {
                     $retval->append($concatedIter);
                 }
             }
             return $retval;
         };
         return (new \Yasca\Core\FunctionPipe())->wrap(\func_get_args())->pipe([Iterators::_class, 'ensureIsIterator'])->pipe([Iterators::_class, 'select'], [Iterators::_class, 'ensureIsIterator'])->pipe($recursiveAttach)->unwrap();
     }
 }
开发者ID:pombredanne,项目名称:yasca,代码行数:37,代码来源:Iterators.php


示例2: expandCluster

 private function expandCluster(&$point_id, &$point, &$neighborhood)
 {
     // Add point to current cluster
     $this->toCluster($point);
     // Iterate all neighbors
     $iterator_array = $neighborhood;
     $iterator = new \AppendIterator();
     $iterator->append(new \ArrayIterator($iterator_array));
     foreach ($iterator as $neighbor_id => $neighbor) {
         // echo "  foreach in $neighbor ($neighbor_id)\n";
         // Neighbor not yet visited
         if (!$this->isVisited($neighbor_id)) {
             // Mark neighbor as visited
             $this->setVisited($neighbor_id);
             // Search the neighbor's neighborhood for new points
             $neighbor_neighborhood = $this->search->regionQuery($neighbor_id, $this->eps);
             // echo "  current neighbor $neighbor has this neighbor_neighborhood around:\n";
             // print_r($neighbor_neighborhood);
             if (count($neighbor_neighborhood) >= $this->minPoints) {
                 // Filter out the points already in the iterator
                 $filtered = array_diff_key($neighbor_neighborhood, $iterator_array);
                 // Add new points to the loop
                 $iterator_array = array_replace($iterator_array, $filtered);
                 $iterator->append(new \ArrayIterator($filtered));
                 // echo "  appended!!\n";
             }
         }
         // Add to cluster
         $this->toCluster($neighbor);
     }
     // echo "  END FOREACH\n";
 }
开发者ID:npoggi,项目名称:aloja,代码行数:32,代码来源:DBSCAN.php


示例3: init_iterator

 function init_iterator()
 {
     $tmp_core_dir = '';
     if (is_dir($this->target_app->app_dir . '/' . $this->path)) {
         $tmp_core_dir = $this->target_app->app_dir . '/' . $this->path;
     }
     if ($tmp_core_dir) {
         $cong_files = array();
         if (defined('EXTENDS_DIR') && is_dir(EXTENDS_DIR . '/' . $this->target_app->app_id . '/' . $this->path)) {
             $EXTENDS_DIR = new DirectoryIterator(EXTENDS_DIR . '/' . $this->target_app->app_id . '/' . $this->path);
             #从
             $EXTENDS_DIR = new NewCallbackFilterIterator($EXTENDS_DIR, function ($current) {
                 return !$current->isDot();
             });
             foreach ($EXTENDS_DIR as $v) {
                 $cong_files[] = $v->getFilename();
             }
         }
         $core_dir = new DirectoryIterator($tmp_core_dir);
         #主
         $core_dir = new NewCallbackFilterIterator($core_dir, function ($current, $key, $iterator, $params) {
             if (!$current->isDot() && !in_array($current->getFilename(), $params)) {
                 return $current;
             }
         }, $cong_files);
         $iterator = new AppendIterator();
         if ($EXTENDS_DIR) {
             $iterator->append($EXTENDS_DIR);
         }
         $iterator->append($core_dir);
         return $iterator;
     } else {
         return new ArrayIterator(array());
     }
 }
开发者ID:yindonghai,项目名称:msk.com,代码行数:35,代码来源:filepath.php


示例4: getExpressionPartsPattern

 private function getExpressionPartsPattern()
 {
     $signs = ' ';
     $patterns = ['\\$[a-zA-Z_]+[a-zA-Z_0-9]+' => 25, ':[a-zA-Z_\\-0-9]+' => 16, '"(?:\\\\.|[^"\\\\])*"' => 21, "'(?:\\\\.|[^'\\\\])*'" => 21, '(?<!\\w)\\d+(?:\\.\\d+)?' => 20];
     $iterator = new \AppendIterator();
     $iterator->append(new \CallbackFilterIterator(new \ArrayIterator(self::$operators), function ($operator) {
         return !ctype_alpha($operator);
     }));
     $iterator->append(new \ArrayIterator(self::$punctuation));
     foreach ($iterator as $symbol) {
         $length = strlen($symbol);
         if ($length === 1) {
             $signs .= $symbol;
         } else {
             if (strpos($symbol, ' ') !== false) {
                 $symbol = "(?<=^|\\W){$symbol}(?=[\\s()\\[\\]]|\$)";
             } else {
                 $symbol = preg_quote($symbol, '/');
             }
             $patterns[$symbol] = $length;
         }
     }
     arsort($patterns);
     $patterns = implode('|', array_keys($patterns));
     $signs = preg_quote($signs, '/');
     return "/({$patterns}|[{$signs}])/i";
 }
开发者ID:bugadani,项目名称:minty,代码行数:27,代码来源:ExpressionTokenizer.php


示例5: getIterator

 /**
  * Index the all the files in the directory and sub directories
  *
  * @param string|null $directory
  * @return RecursiveDirectoryIterator
  */
 protected function getIterator($directory = null)
 {
     $directories = $this->config['content_directories'];
     // some flags to filter . and .. and follow symlinks
     $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS;
     if ($directory) {
         //Iterate only this directory
         return new \RecursiveDirectoryIterator($directory, $flags);
     }
     if ($directories) {
         $directoryIterators = [];
         foreach ($directories as $directory) {
             //Create an array of the paths
             $directoryIterators[] = new \RecursiveDirectoryIterator(each($directory)[1], $flags);
         }
         $iterator = new \AppendIterator();
         foreach ($directoryIterators as $directoryIterator) {
             //Append the directory iterator to the iterator
             $iterator->append(new \RecursiveIteratorIterator($directoryIterator));
         }
     } else {
         throw new Exception("Unable to read the content path, check the configuration file.");
     }
     if (iterator_count($iterator) == 0) {
         throw new Exception("The content directory is empty.");
     }
     return $iterator;
 }
开发者ID:sebas7dk,项目名称:popstop,代码行数:34,代码来源:Scan.php


示例6: getFileIterator

 /**
  *
  * @param array|string $paths        	
  * @param array|string $suffixes        	
  * @param array|string $prefixes        	
  * @param array $exclude        	
  * @return AppendIterator
  */
 public function getFileIterator($paths, $suffixes = '', $prefixes = '', array $exclude = array())
 {
     if (is_string($paths)) {
         $paths = array($paths);
     }
     $paths = $this->getPathsAfterResolvingWildcards($paths);
     $exclude = $this->getPathsAfterResolvingWildcards($exclude);
     if (is_string($prefixes)) {
         if ($prefixes != '') {
             $prefixes = array($prefixes);
         } else {
             $prefixes = array();
         }
     }
     if (is_string($suffixes)) {
         if ($suffixes != '') {
             $suffixes = array($suffixes);
         } else {
             $suffixes = array();
         }
     }
     $iterator = new AppendIterator();
     foreach ($paths as $path) {
         if (is_dir($path)) {
             $iterator->append(new File_Iterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::FOLLOW_SYMLINKS)), $suffixes, $prefixes, $exclude, $path));
         }
     }
     return $iterator;
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:37,代码来源:Factory.php


示例7: iterator

 public function iterator()
 {
     $aIterator = $this->arrMsgQueue ? new \org\jecat\framework\pattern\iterate\ArrayIterator($this->arrMsgQueue) : new \EmptyIterator();
     // for child container's children
     if ($this->arrChildren) {
         foreach ($this->arrChildren as $aChild) {
             if ($aChild instanceof IMessageQueue) {
                 $aQueue = $aChild;
             } else {
                 if ($aChild instanceof IMessageQueueHolder) {
                     $aQueue = $aChild->messageQueue(false);
                 } else {
                     Assert::wrong("未知的错误");
                 }
             }
             if ($aQueue) {
                 if (empty($aMergedIterator)) {
                     $aMergedIterator = new \AppendIterator();
                     $aMergedIterator->append($aIterator);
                 }
                 $aMergedIterator->append($aQueue->iterator());
             }
         }
     }
     // return merged iterators
     if (!empty($aMergedIterator)) {
         return $aMergedIterator;
     } else {
         return $aIterator;
     }
 }
开发者ID:JeCat,项目名称:framework,代码行数:31,代码来源:MessageQueue.php


示例8: union

 /**
  * @param array|\Traversable $enumerable
  * @param callable           $equalityComparer
  *
  * @return \Cubiche\Core\Enumerable\EnumerableInterface
  */
 public function union($enumerable, callable $equalityComparer = null)
 {
     $iterator = new \AppendIterator();
     $iterator->append(Enumerable::from($this)->getIterator());
     $iterator->append(Enumerable::from($enumerable)->getIterator());
     return Enumerable::from($iterator)->distinct($equalityComparer);
 }
开发者ID:cubiche,项目名称:cubiche,代码行数:13,代码来源:Set.php


示例9: getIterator

 /**
  * {@inheritdoc}
  */
 public function getIterator()
 {
     $iterator = new \AppendIterator();
     foreach ($this->currencies as $currencies) {
         $iterator->append($currencies->getIterator());
     }
     return $iterator;
 }
开发者ID:squigg,项目名称:money,代码行数:11,代码来源:AggregateCurrencies.php


示例10: collect

 /**
  * @inheritDoc
  */
 public function collect() : \Iterator
 {
     $iterator = new \AppendIterator();
     foreach ($this->collectors as $collector) {
         $iterator->append($collector->collect());
     }
     return $iterator;
 }
开发者ID:igaponov,项目名称:shop,代码行数:11,代码来源:UrlCollector.php


示例11: testIteratorCombining

 /**
  * Iterator can be combine, chained, filter, there are many in the SPL
  * and sadly they are rarely used.
  */
 public function testIteratorCombining()
 {
     // a fancy way to add a joker to the deck :
     $joker = array('JK' => 'Joker');
     $newDeck = new \AppendIterator();
     $newDeck->append($this->deck);
     $newDeck->append(new \ArrayIterator($joker));
     $this->assertCount(33, $newDeck);
 }
开发者ID:Vildulv,项目名称:DesignPatternsPHP,代码行数:13,代码来源:IteratorTest.php


示例12: build

 /**
  * @inheritdoc
  */
 public function build(CreateGoalsTask $createTask, array $options = [])
 {
     $options = array_merge($this->defaultOptions, $options);
     $result = new \AppendIterator();
     foreach ($options as $builderAlias => $builderOptions) {
         $result->append($this->findBuilder($builderAlias)->build($createTask, $builderOptions));
     }
     return $result;
 }
开发者ID:skieff,项目名称:ymtt,代码行数:12,代码来源:Collection.php


示例13: split

 /**
  * Split arguments by date range
  *
  * @param array $arguments
  */
 public function split(array $arguments = array())
 {
     $splittedArguments = new AppendIterator();
     foreach ($this->_options['Period'] as $Date) {
         $_arguments = $arguments;
         $_arguments['--range'] = $Date->format(Configure::read('Task.dateFormat'));
         $splittedArguments->append($this->splitInner($_arguments));
     }
     return $splittedArguments;
 }
开发者ID:imsamurai,项目名称:cakephp-advancedshell,代码行数:15,代码来源:ScheduleSplitByRange.php


示例14: getDirectoryIterator

 /**
  * Return iterator to walk through directories
  *
  * @return \AppendIterator
  */
 public function getDirectoryIterator()
 {
     $result = new \AppendIterator();
     foreach ($this->getDirs() as $dir) {
         if (\Includes\Utils\FileManager::isDir($dir)) {
             $result->append($this->getDirectorySPLIterator($dir));
         }
     }
     return $result;
 }
开发者ID:kingsj,项目名称:core,代码行数:15,代码来源:Module.php


示例15: test3

function test3($firstData, $secondData)
{
    $firstIterator = new ArrayIterator($firstData);
    $secondIterator = new ArrayIterator($secondData);
    $append = new AppendIterator();
    $append->append($firstIterator);
    $append->append($secondIterator);
    foreach ($append as $key => $value) {
        printf("F: %s, S: %s, A: %s=>%s (%s)\n", $firstIterator->key(), $secondIterator->key(), $key, $value, $append->getIteratorIndex());
    }
}
开发者ID:Eldahar,项目名称:PHP_Library,代码行数:11,代码来源:AppendIterator1.php


示例16: execute

 protected function execute(InputInterface $input)
 {
     $iterator = new \AppendIterator();
     $writer = $this->getWriter($input);
     foreach ($input->getArgument('files') as $i => $file) {
         $iterator->append($this->getReader($input, $i));
     }
     foreach ($iterator as $data) {
         $writer->write($data);
     }
 }
开发者ID:jerive,项目名称:csvtool,代码行数:11,代码来源:AppendCommand.php


示例17: getIterator

 /**
  * {@inheritDoc}
  */
 public function getIterator()
 {
     if (1 === count($this->dirs)) {
         return $this->searchInDir($this->dirs[0]);
     }
     $iterator = new \AppendIterator();
     foreach ($this->dirs as $dir) {
         $iterator->append($this->searchInDir($dir));
     }
     return $iterator;
 }
开发者ID:judimator,项目名称:simple-search-bundle,代码行数:14,代码来源:JuFinderEngine.php


示例18: packageIterator

 public function packageIterator($sLanguage = null, $sCountry = null, $sLibName = null)
 {
     if (empty($this->arrFolders)) {
         return new \EmptyIterator();
     } else {
         $aIterator = new \AppendIterator();
         foreach ($this->arrFolders as $sFolderPath) {
             $aIterator->append(new PackageIterator($sFolderPath, $sLanguage, $sCountry, $sLibName));
         }
         return $aIterator;
     }
 }
开发者ID:JeCat,项目名称:framework,代码行数:12,代码来源:LanguagePackageFolders.php


示例19: findTypes

 private function findTypes(array $paths)
 {
     $types = new \AppendIterator();
     foreach ($paths as $path) {
         $finder = Finder::create()->in($path['path']);
         $finder->name($path['match']);
         $iterator = new ClassExtractorIterator($finder);
         $iterator = new DoctrineTypeIterator($iterator, $path['suffix']);
         $types->append(new \IteratorIterator($iterator));
     }
     return $types;
 }
开发者ID:shopery,项目名称:doctrine-type-bundle,代码行数:12,代码来源:ShoperyDoctrineTypeExtension.php


示例20: items

 function items($cacheId)
 {
     $iter = new \AppendIterator();
     foreach ($this->backends as $backend) {
         $backendIter = $backend->items($cacheId);
         if (is_array($backendIter)) {
             $backendIter = new \ArrayIterator($backendIter);
         }
         $iter->append($backendIter);
     }
     return new \Cachet\Util\ReindexingIterator($iter);
 }
开发者ID:shabbyrobe,项目名称:cachet,代码行数:12,代码来源:Sharding.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Apple类代码示例发布时间:2022-05-23
下一篇:
PHP App_Model_DbTable_Factory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap