public function emitShorteningEvents($url)
    {
        $host = Url::extractHost($url);
        list($privateDeferred, $userFacingPromise) = $this->preparePromises();

        $eventName = 'url.shorten.';
        if (count($this->emitter->listeners($eventName . $host)) > 0) {
            $eventName .= $host;
            $this->getLogger()->info('[Bigstock] emitting: ' . $eventName);
            $this->emitter->emit($eventName, [$url, $privateDeferred]);
        } elseif (count($this->emitter->listeners($eventName . 'all')) > 0) {
            $eventName .= 'all';
            $this->getLogger()->info('[Bigstock] emitting: ' . $eventName);
            $this->emitter->emit($eventName, [$url, $privateDeferred]);
        } else {
            $this->getLoop()->addTimer(0.1, function () use ($privateDeferred) {
                $privateDeferred->reject();
            });
        }

        return $userFacingPromise;
    }
public function emitShorteningEvents($url)
    {
        $host = Url::extractHost($url);
        list($privateDeferred, $userFacingPromise) = $this->preparePromises();

        $eventName = 'url.shorten.';
        if (count($this->emitter->listeners($eventName . $host)) > 0) {
            $eventName .= $host;
            $this->getLogger()->info('[Bigstock] emitting: ' . $eventName);
            $this->emitter->emit($eventName, [$url, $privateDeferred]);
        } elseif (count($this->emitter->listeners($eventName . 'all')) > 0) {
            $eventName .= 'all';
            $this->getLogger()->info('[Bigstock] emitting: ' . $eventName);
            $this->emitter->emit($eventName, [$url, $privateDeferred]);
        } else {
            $this->getLoop()->addTimer(0.1, function () use ($privateDeferred) {
                $privateDeferred->reject();
            });
        }

        return $userFacingPromise;
    }
public function emitShorteningEvents ( $ url ) { $ host = Url :: extractHost ( $ url ) ; list ( $ privateDeferred , $ userFacingPromise ) = $ this -> preparePromises ( ) ; $ eventName = 'url.shorten.' ; if ( count ( $ this -> emitter -> listeners ( $ eventName . $ host ) ) > 0 ) { $ eventName .= $ host ; $ this -> getLogger ( ) -> info ( '[Bigstock] emitting: ' . $ eventName ) ; $ this -> emitter -> emit ( $ eventName , [ $ url , $ privateDeferred ] ) ; } elseif ( count ( $ this -> emitter -> listeners ( $ eventName . 'all' ) ) > 0 ) { $ eventName .= 'all' ; $ this -> getLogger ( ) -> info ( '[Bigstock] emitting: ' . $ eventName ) ; $ this -> emitter -> emit ( $ eventName , [ $ url , $ privateDeferred ] ) ; } else { $ this -> getLoop ( ) -> addTimer ( 0.1 , function ( ) use ( $ privateDeferred ) { $ privateDeferred -> reject ( ) ; } ) ; } return $ userFacingPromise ; }
Emit URL shortening events

@param string $url
@return \React\Promise\Deferred
Emit URL shortening events