Beispiel #1
0
 public function __get($field)
 {
     if (!property_exists($this->object, $field)) {
         return Optional::absent();
     }
     return Optional::fromNullable($this->object->{$field});
 }
Beispiel #2
0
 /**
  * @return Node|null
  */
 public function getReturnNode()
 {
     return Optional::fromNullable($this->return)->getNode()->or(null);
 }
Beispiel #3
0
 /**
  * @test
  */
 public function shouldFlattenNullValue()
 {
     //given
     $optional = Optional::of(Optional::of(Optional::fromNullable(null)));
     //when
     $result = $optional->flatten()->orNull();
     //then
     Assert::that($result)->isNull();
 }