public function monitor($item)
    {
        if ($item instanceof PoolInterface) {
            $item->addListener(PoolRunEvent::POOL_RUN_ADDED, [$this, 'onPoolRunAdded']);
            $item->addListener(PoolRunEvent::UPDATED, [$this, 'onPoolUpdated']);
            array_map([$this, 'monitor'], $item->getAll());
        }
        if ($item instanceof RunInterface) {
            $item->addListener(RunEvent::STARTED, [$this, 'onRunStarted']);
            $item->addListener(RunEvent::SUCCESSFUL, [$this, 'onRunSuccessful']);
            $item->addListener(RunEvent::FAILED, [$this, 'onRunFailed']);
            $item->addListener(RunEvent::COMPLETED, [$this, 'onRunCompleted']);
        }
    }
public function monitor($item)
    {
        if ($item instanceof PoolInterface) {
            $item->addListener(PoolRunEvent::POOL_RUN_ADDED, [$this, 'onPoolRunAdded']);
            $item->addListener(PoolRunEvent::UPDATED, [$this, 'onPoolUpdated']);
            array_map([$this, 'monitor'], $item->getAll());
        }
        if ($item instanceof RunInterface) {
            $item->addListener(RunEvent::STARTED, [$this, 'onRunStarted']);
            $item->addListener(RunEvent::SUCCESSFUL, [$this, 'onRunSuccessful']);
            $item->addListener(RunEvent::FAILED, [$this, 'onRunFailed']);
            $item->addListener(RunEvent::COMPLETED, [$this, 'onRunCompleted']);
        }
    }
public function monitor ( $ item ) { if ( $ item instanceof PoolInterface ) { $ item -> addListener ( PoolRunEvent :: POOL_RUN_ADDED , [ $ this , 'onPoolRunAdded' ] ) ; $ item -> addListener ( PoolRunEvent :: UPDATED , [ $ this , 'onPoolUpdated' ] ) ; array_map ( [ $ this , 'monitor' ] , $ item -> getAll ( ) ) ; } if ( $ item instanceof RunInterface ) { $ item -> addListener ( RunEvent :: STARTED , [ $ this , 'onRunStarted' ] ) ; $ item -> addListener ( RunEvent :: SUCCESSFUL , [ $ this , 'onRunSuccessful' ] ) ; $ item -> addListener ( RunEvent :: FAILED , [ $ this , 'onRunFailed' ] ) ; $ item -> addListener ( RunEvent :: COMPLETED , [ $ this , 'onRunCompleted' ] ) ; } }
Monitor a Pool or Run, and log all activity

@param PoolInterface|RunInterface $item
Monitor a Pool or Run and log all activity