public function run()
    {
        $successful = true;

        $this->initReport();

        $checks = array();
        foreach ($this->config->getCheckDefinitions() as $check_definition) {
            $checks[] = $this->getCheckInstance($check_definition);
        }

        $progress = $this->command->getHelperSet()->get('progress');
        $progress->setFormat(' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed% ');

        $progress->start($this->command->getOutput(), count($checks));

        // run all checks defined in the configuration
        foreach ($checks as $check) {
            // process the check
            $succeeded = (bool) $check->run();

            // collect the result
            $result = $check->getResult();

            if (!$result instanceof IResult) {
                throw new \LogicException(
                    'The result of check "' . $check->getName() . '" (group "' . $check->getGroup() . '", class "' .
                    get_class($check) . '") must implement IResult.'
                );
            }

            // mark the check's result as success or failure
            if (!$succeeded) {
                $result->setStatus(IResult::FAIL);
            } else {
                $result->setStatus(IResult::SUCCESS);
            }

            // add the check's result to the report
            $this->report->addResult($result);

            $successful &= $succeeded;

            $progress->advance();
        }

        $progress->finish();

        return $successful;
    }
public function run()
    {
        $successful = true;

        $this->initReport();

        $checks = array();
        foreach ($this->config->getCheckDefinitions() as $check_definition) {
            $checks[] = $this->getCheckInstance($check_definition);
        }

        $progress = $this->command->getHelperSet()->get('progress');
        $progress->setFormat(' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed% ');

        $progress->start($this->command->getOutput(), count($checks));

        // run all checks defined in the configuration
        foreach ($checks as $check) {
            // process the check
            $succeeded = (bool) $check->run();

            // collect the result
            $result = $check->getResult();

            if (!$result instanceof IResult) {
                throw new \LogicException(
                    'The result of check "' . $check->getName() . '" (group "' . $check->getGroup() . '", class "' .
                    get_class($check) . '") must implement IResult.'
                );
            }

            // mark the check's result as success or failure
            if (!$succeeded) {
                $result->setStatus(IResult::FAIL);
            } else {
                $result->setStatus(IResult::SUCCESS);
            }

            // add the check's result to the report
            $this->report->addResult($result);

            $successful &= $succeeded;

            $progress->advance();
        }

        $progress->finish();

        return $successful;
    }
public function run ( ) { $ successful = true ; $ this -> initReport ( ) ; $ checks = array ( ) ; foreach ( $ this -> config -> getCheckDefinitions ( ) as $ check_definition ) { $ checks [ ] = $ this -> getCheckInstance ( $ check_definition ) ; } $ progress = $ this -> command -> getHelperSet ( ) -> get ( 'progress' ) ; $ progress -> setFormat ( ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed% ' ) ; $ progress -> start ( $ this -> command -> getOutput ( ) , count ( $ checks ) ) ; // run all checks defined in the configuration foreach ( $ checks as $ check ) { // process the check $ succeeded = ( bool ) $ check -> run ( ) ; // collect the result $ result = $ check -> getResult ( ) ; if ( ! $ result instanceof IResult ) { throw new \ LogicException ( 'The result of check "' . $ check -> getName ( ) . '" (group "' . $ check -> getGroup ( ) . '", class "' . get_class ( $ check ) . '") must implement IResult.' ) ; } // mark the check's result as success or failure if ( ! $ succeeded ) { $ result -> setStatus ( IResult :: FAIL ) ; } else { $ result -> setStatus ( IResult :: SUCCESS ) ; } // add the check's result to the report $ this -> report -> addResult ( $ result ) ; $ successful &= $ succeeded ; $ progress -> advance ( ) ; } $ progress -> finish ( ) ; return $ successful ; }
Execute the checks that are defined in the config
and generate a report to consume by others.
Execute the checks that are defined in the config and generate a report to consume by others .