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


PHP self::push方法代码示例

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


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

示例1: create

 public static function create(callable $handler = null) : self
 {
     $stack = new self($handler ?: choose_handler());
     $stack->push(Middleware::httpErrors());
     $stack->push(Middleware::prepareBody());
     return $stack;
 }
开发者ID:php-opencloud,项目名称:openstack,代码行数:7,代码来源:HandlerStack.php

示例2: create

 /**
  * Creates a default handler stack that can be used by clients.
  *
  * The returned handler will wrap the provided handler or use the most
  * appropriate default handler for you system. The returned HandlerStack has
  * support for cookies, redirects, HTTP error exceptions, and preparing a body
  * before sending.
  *
  * The returned handler stack can be passed to a client in the "handler"
  * option.
  *
  * @param callable $handler HTTP handler function to use with the stack. If no
  *                          handler is provided, the best handler for your
  *                          system will be utilized.
  *
  * @return HandlerStack
  */
 public static function create(callable $handler = null)
 {
     $stack = new self($handler ?: choose_handler());
     $stack->push(Middleware::httpErrors(), 'http_errors');
     $stack->push(Middleware::redirect(), 'allow_redirects');
     $stack->push(Middleware::cookies(), 'cookies');
     $stack->push(Middleware::prepareBody(), 'prepare_body');
     return $stack;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:26,代码来源:HandlerStack.php

示例3: range

 static function range(date $first, date $last)
 {
     $week = new self();
     $day = $first;
     $week->push($day);
     do {
         $day = $day->tomorrow();
         $week->push($day);
     } while (!$day->is_equal($last));
     return $week;
 }
开发者ID:LupusMichaelis,项目名称:horn,代码行数:11,代码来源:duration.php

示例4: fromArray

 /**
  * Only used for tests.
  * @param string[] $displayNames
  * @return array|CurrentPath
  */
 public static function fromArray(array $displayNames)
 {
     $path = new self();
     foreach ($displayNames as $v) {
         $path->push(new ResourceField(new ResourceDefinition(null), $v));
     }
     return $path;
 }
开发者ID:catlabinteractive,项目名称:charon,代码行数:13,代码来源:CurrentPath.php

示例5: from

 /**
  * @param Traversable $from
  *
  * @return Collection
  */
 public static function from(Traversable $from)
 {
     $self = new self();
     foreach ($from as $item) {
         $self->push($item);
     }
     return $self;
 }
开发者ID:schpill,项目名称:standalone,代码行数:13,代码来源:Cursor.php

示例6: reduce

 public function reduce(callable $callback, $preserveKeys = false)
 {
     $collection = new self();
     foreach ($this->collection as $key => $item) {
         if ($callback($item)) {
             $collection->push($item, $preserveKeys ? $key : null);
         }
     }
     return $collection;
 }
开发者ID:pckg,项目名称:collection,代码行数:10,代码来源:Collection.php

示例7: whereRecip

 public function whereRecip($email)
 {
     $coll = new self();
     foreach ($this as $msg) {
         if ($msg->recipients->contains('email', $email)) {
             $coll->push($msg);
         }
     }
     return $coll;
 }
开发者ID:agouticreative,项目名称:laravel-mailcatcher,代码行数:10,代码来源:Collection.php

示例8: sequence

 /**
  * @param int[]|\BitWasp\Bitcoin\Script\Interpreter\Number[]|BufferInterface[] $sequence
  * @return $this
  */
 public function sequence(array $sequence)
 {
     $new = new self($this->math, $this->opcodes, null);
     foreach ($sequence as $operation) {
         if (is_int($operation)) {
             if (!$this->opcodes->offsetExists($operation)) {
                 throw new \RuntimeException('Unknown opcode');
             }
             $new->script .= chr($operation);
         } elseif ($operation instanceof Number) {
             $new->push($operation->getBuffer());
         } elseif ($operation instanceof BufferInterface) {
             $new->push($operation);
         } else {
             throw new \RuntimeException('Input was neither an opcode or BufferInterfacecc');
         }
     }
     $this->concat($new->getScript());
     return $this;
 }
开发者ID:nmarley,项目名称:bitcoin-php,代码行数:24,代码来源:ScriptCreator.php

示例9: copyFromContext

 private function copyFromContext(LinkedNode $context)
 {
     $list = new self();
     for ($n = $context; $n !== $this->tail; $n = $n->next()) {
         /**
          * @var LinkedDataNode $n
          */
         $list->push($n->value());
     }
     return $list;
 }
开发者ID:RadekDvorak,项目名称:Ardent,代码行数:11,代码来源:LinkedList.php

示例10: unique

 /**
  * Get all the unique values in the collection.
  *
  * @param bool $preserveKeys
  *
  * @return CollectionInterface
  */
 public function unique($preserveKeys = true)
 {
     $values = new self();
     $this->each(function ($item) use($values, $preserveKeys) {
         if (!$values->contains($item)) {
             if ($preserveKeys) {
             }
             $values->push($item);
         }
     });
     return $values;
 }
开发者ID:warrickbayman,项目名称:charms,代码行数:19,代码来源:Collection.php

示例11: diff

 public function diff(Delta $other)
 {
     $delta = new self();
     if ($this->getOperations() === $other->getOperations()) {
         return $delta;
     }
     $strings = array_map(function (OperationCollection $operations) use($other) {
         return implode(array_map(function (OperationInterface $operation) use($operations, $other) {
             if ($operation->getType() === OperationInterface::TYPE_INSERT) {
                 return is_string($operation->getValue()) ? $operation->getValue() : chr(0);
             }
             throw new \RuntimeException(sprintf('diff() called %s non-document', $operations === $other->getOperations() ? 'on' : 'with'));
         }, $operations->toArray()));
     }, [$this->getOperations(), $other->getOperations()]);
     $diffResults = FastDiff::diff($strings[0], $strings[1]);
     $thisIterator = $this->getOperations()->getIterator();
     $otherIterator = $other->getOperations()->getIterator();
     foreach ($diffResults as $diffResult) {
         $length = mb_strlen($diffResult[1]);
         while ($length > 0) {
             $operationLength = 0;
             switch ($diffResult[0]) {
                 case FastDiff::DIFF_INSERT:
                     $operationLength = min($otherIterator->getPeekLength(), $length);
                     $delta->push($otherIterator->next($operationLength));
                     break;
                 case FastDiff::DIFF_DELETE:
                     $operationLength = min($length, $thisIterator->getPeekLength());
                     $thisIterator->next($operationLength);
                     $delta->delete($operationLength);
                     break;
                 case FastDiff::DIFF_EQUAL:
                     $operationLength = min($thisIterator->getPeekLength(), $otherIterator->getPeekLength(), $length);
                     $thisOperation = $thisIterator->next($operationLength);
                     $otherOperation = $otherIterator->next($operationLength);
                     if ($thisOperation->getValue() === $otherOperation->getValue()) {
                         $delta->retain($operationLength, $this->diffAttributes($thisOperation->getAttributes(), $otherOperation->getAttributes()));
                     } else {
                         $delta->push($otherOperation)->delete($operationLength);
                     }
                     break;
             }
             $length -= $operationLength;
         }
     }
     return $delta->chop();
 }
开发者ID:webstronauts,项目名称:operational-transformation,代码行数:47,代码来源:Delta.php

示例12: fromSlice

 static function fromSlice(array $tokens) : self
 {
     $ts = new self();
     $ts->first = new NodeStart();
     $ts->last = new NodeEnd();
     self::link($ts->first, $ts->last);
     foreach ($tokens as $token) {
         $ts->push($token);
     }
     $ts->reset();
     return $ts;
 }
开发者ID:lastguest,项目名称:yay,代码行数:12,代码来源:TokenStream.php

示例13: map

 public function map($callback)
 {
     if (!is_callable($callback)) {
         throw new \InvalidArgumentException('Invalid (not callable) callback given');
     }
     $result = new self();
     for ($i = 0; $i < $this->count(); $i++) {
         $value = $callback($this->storage[$i]);
         if (null !== $value) {
             $result->push($value);
         }
     }
     return $result;
 }
开发者ID:brainsware,项目名称:sauce,代码行数:14,代码来源:Vector.php

示例14: filter

 public function filter($var, $value)
 {
     $result = new self();
     foreach ($this as $e) {
         if ($e->{$var} == $value) {
             $result->push($e);
         }
     }
     return $result;
 }
开发者ID:thinkscape,项目名称:activerecord,代码行数:10,代码来源:Collection.php


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