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


PHP AppendIterator::append方法代码示例

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


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

示例1: 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

示例2: 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

示例3: array

 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: 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

示例6: 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

示例7: 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

示例8: assertSequence

 private function assertSequence(\AppendIterator $it, $sequence)
 {
     $str = new TestStr();
     $i1 = new TestArrayIterator([1, 2, 3], $str);
     $i2 = new TestArrayIterator([4, 5, 6], $str);
     $it->append($i1);
     $it->append($i2);
     foreach ($it as $item) {
         $str->str .= $item;
     }
     $this->assertSame($sequence, $str->str);
 }
开发者ID:pkdevboxy,项目名称:filesystem,代码行数:12,代码来源:AppendIteratorTest.php

示例9: jumpstart

 /**
  * Publish th plugin to the WordPress plugin repository
  * @param Event $event
  */
 public static function jumpstart(Event $event)
 {
     // get information
     $info = static::questionnaire($event);
     // update file headers
     $files = new \AppendIterator();
     $files->append(new RegexIterator(new RecursiveDirectoryIterator('.'), static::$filePattern, RegexIterator::GET_MATCH));
     $files->append(new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator('src')), static::$filePattern, RegexIterator::GET_MATCH));
     static::updateFiles($event, $files, $info);
     // create composer.json
     static::mergeConfig($event, $info);
 }
开发者ID:mrgrain,项目名称:jumpstart-init,代码行数:16,代码来源:Init.php

示例10: getIterator

 public function getIterator()
 {
     $it = new AppendIterator();
     $it->append(new ArrayIterator(array($this->head())));
     if (is_string($this->_body)) {
         $it->append(new ArrayIterator(array($this->_body)));
     } elseif (is_array($this->_body)) {
         $it->append(new ArrayIterator($this->_body));
     } elseif ($this->_body instanceof Iterator) {
         $it->append($this->_body);
     }
     return $it;
 }
开发者ID:bobtfish,项目名称:kelpie,代码行数:13,代码来源:Response.php

示例11: __construct

 public function __construct($seq, $aSeq)
 {
     $iterator = null;
     $itAppend = new AppendIterator();
     if (!is_null($seq)) {
         $iterator = Sloth::iter($seq);
         $itAppend->append($iterator);
     }
     foreach ($aSeq as $mSeq) {
         $itAppend->append(Sloth::iter($mSeq));
     }
     $this->iterator = $itAppend;
 }
开发者ID:no22,项目名称:gongo,代码行数:13,代码来源:Append.php

示例12: addInput

 /**
  * Adds an input path
  *
  * @param \r8\FileSys $input
  * @return \vc\App\Paths Returns a self reference
  */
 public function addInput(\r8\FileSys $input)
 {
     $input = clone $input;
     if ($input->isFile()) {
         $this->inputs->append(new \ArrayIterator(array($input)));
     } else {
         if ($input->isDir()) {
             $input->setIncludeDots(FALSE);
             $this->inputs->append(new \RecursiveIteratorIterator($input));
         } else {
             throw new \r8\Exception\Argument(0, 'Input', 'Path does not exist');
         }
     }
     return $this;
 }
开发者ID:Nycto,项目名称:phpVocab,代码行数:21,代码来源:Paths.php

示例13: 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

示例14: 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

示例15: 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


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