예제 #1
0
 protected function __construct($value)
 {
     if ($value instanceof \IteratorAggregate) {
         $value = $value->getIterator();
     } else {
         if (!$value instanceof \Traversable) {
             if (!is_array($value)) {
                 $value = [$value];
             }
             $value = new \ArrayIterator($value);
         }
     }
     parent::__construct($value);
 }
예제 #2
0
파일: Chain.php 프로젝트: iddqdby/f7
 /**
  * Apply function only if the value is not NULL.
  *
  * @see \monad\Monad::bind($function)
  * @see \monad\Chain::emptyChain()
  */
 public function continue(callable $function) : Chain
 {
     return parent::bind(conditionally(negation(is_null), $function));
 }
예제 #3
0
파일: Stream.php 프로젝트: iddqdby/f7
 /**
  * {@inheritDoc}
  *
  * This is a closing operation (it calls <code>$this->close()</code> internally).
  *
  * @see \monad\Monad::extract()
  * @see \monad\Stream::close()
  */
 public function extract() : array
 {
     $value = parent::extract();
     $this->close();
     return $value;
 }