Ouzo\Utilities\Optional::fromNullable PHP Method

fromNullable() public static method

public static fromNullable ( $object )
    public static function fromNullable($object)
    {
        return new self($object);
    }

Usage Example

示例#1
0
 public function __get($field)
 {
     if (!property_exists($this->object, $field)) {
         return Optional::absent();
     }
     return Optional::fromNullable($this->object->{$field});
 }
All Usage Examples Of Ouzo\Utilities\Optional::fromNullable