private function subscribeStreamEvent($stream, $flag)
    {
        $key = (int) $stream;

        if (isset($this->streamEvents[$key])) {
            $event = $this->streamEvents[$key];
            $flags = $this->streamFlags[$key] |= $flag;

            event_del($event);
            event_set($event, $stream, EV_PERSIST | $flags, $this->streamCallback);
        } else {
            $event = event_new();

            event_set($event, $stream, EV_PERSIST | $flag, $this->streamCallback);
            event_base_set($event, $this->eventBase);

            $this->streamEvents[$key] = $event;
            $this->streamFlags[$key] = $flag;
        }

        event_add($event);
    }
private function subscribeStreamEvent($stream, $flag)
    {
        $key = (int) $stream;

        if (isset($this->streamEvents[$key])) {
            $event = $this->streamEvents[$key];
            $flags = $this->streamFlags[$key] |= $flag;

            event_del($event);
            event_set($event, $stream, EV_PERSIST | $flags, $this->streamCallback);
        } else {
            $event = event_new();

            event_set($event, $stream, EV_PERSIST | $flag, $this->streamCallback);
            event_base_set($event, $this->eventBase);

            $this->streamEvents[$key] = $event;
            $this->streamFlags[$key] = $flag;
        }

        event_add($event);
    }
private function subscribeStreamEvent ( $ stream , $ flag ) { $ key = ( int ) $ stream ; if ( isset ( $ this -> streamEvents [ $ key ] ) ) { $ event = $ this -> streamEvents [ $ key ] ; $ flags = $ this -> streamFlags [ $ key ] |= $ flag ; event_del ( $ event ) ; event_set ( $ event , $ stream , EV_PERSIST | $ flags , $ this -> streamCallback ) ; } else { $ event = event_new ( ) ; event_set ( $ event , $ stream , EV_PERSIST | $ flag , $ this -> streamCallback ) ; event_base_set ( $ event , $ this -> eventBase ) ; $ this -> streamEvents [ $ key ] = $ event ; $ this -> streamFlags [ $ key ] = $ flag ; } event_add ( $ event ) ; }
Create a new ext-libevent event resource, or update the existing one.

@param stream  $stream
@param integer $flag   EV_READ or EV_WRITE
Create a new ext - libevent event resource or update the existing one .