Rx\Observable::share PHP Method

share() public method

This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
public share ( ) : Rx\Observable\RefCountObservable
return Rx\Observable\RefCountObservable An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
    public function share()
    {
        return $this->publish()->refCount();
    }