public function start($checkInterval = 1000000, $timeLimit = null)
    {
        $totalTime = 0;
        $this->watching = true;

        while ($this->watching) {
            usleep($checkInterval);
            $totalTime += $checkInterval;

            if (null !== $timeLimit && $totalTime > $timeLimit) {
                break;
            }

            foreach ($this->getTracker()->getEvents() as $event) {
                $trackedResource = $event->getTrackedResource();

                // fire global event
                $this->getEventDispatcher()->dispatch(
                    'resource_watcher.all',
                    $event
                );

                // fire specific trackingId event
                $this->getEventDispatcher()->dispatch(
                    sprintf('resource_watcher.%s', $trackedResource->getTrackingId()),
                    $event
                );
            }
        }

        $this->watching = false;
    }
public function start($checkInterval = 1000000, $timeLimit = null)
    {
        $totalTime = 0;
        $this->watching = true;

        while ($this->watching) {
            usleep($checkInterval);
            $totalTime += $checkInterval;

            if (null !== $timeLimit && $totalTime > $timeLimit) {
                break;
            }

            foreach ($this->getTracker()->getEvents() as $event) {
                $trackedResource = $event->getTrackedResource();

                // fire global event
                $this->getEventDispatcher()->dispatch(
                    'resource_watcher.all',
                    $event
                );

                // fire specific trackingId event
                $this->getEventDispatcher()->dispatch(
                    sprintf('resource_watcher.%s', $trackedResource->getTrackingId()),
                    $event
                );
            }
        }

        $this->watching = false;
    }
public function start ( $ checkInterval = 1000000 , $ timeLimit = null ) { $ totalTime = 0 ; $ this -> watching = true ; while ( $ this -> watching ) { usleep ( $ checkInterval ) ; $ totalTime += $ checkInterval ; if ( null !== $ timeLimit && $ totalTime > $ timeLimit ) { break ; } foreach ( $ this -> getTracker ( ) -> getEvents ( ) as $ event ) { $ trackedResource = $ event -> getTrackedResource ( ) ; // fire global event $ this -> getEventDispatcher ( ) -> dispatch ( 'resource_watcher.all' , $ event ) ; // fire specific trackingId event $ this -> getEventDispatcher ( ) -> dispatch ( sprintf ( 'resource_watcher.%s' , $ trackedResource -> getTrackingId ( ) ) , $ event ) ; } } $ this -> watching = false ; }
Starts watching on tracked resources.

@param integer $checkInterval check interval in microseconds
@param integer $timeLimit     maximum watching time limit in microseconds
Starts watching on tracked resources .