Rx\Observable::pluck PHP Method

pluck() public method

Returns an Observable containing the value of a specified array index (if array) or property (if object) from all elements in the Observable sequence. If a property can't be resolved the observable will error.
public pluck ( mixed $property ) : Observable
$property mixed
return Observable
    public function pluck($property)
    {
        return $this->map(function ($x) use($property) {
            if (is_array($x) && isset($x[$property])) {
                return $x[$property];
            }
            if (is_object($x) && isset($x->{$property})) {
                return $x->{$property};
            }
            throw new \Exception('Unable to pluck "' . $property . '"');
        });
    }