Ejemplo n.º 1
0
 public static final function map(\Traversable $traversable, UnaryFunktionInterface $functor) : \Traversable
 {
     $result = new \ArrayIterator();
     foreach ($traversable as $value) {
         $result->append($functor->apply($value));
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  *
  * {@inheritdoc}
  *
  * @see \intrawarez\sabertooth\optionals\OptionalInterface::map()
  */
 public function map(UnaryFunktionInterface $functor) : OptionalInterface
 {
     if ($this->isPresent()) {
         return self::of($functor->apply($this->get()));
     }
     return self::absent();
 }