framework/requirements/YiiRequirementChecker.php
function check($requirements)
    {
        if (is_string($requirements)) {
            $requirements = require $requirements;
        }
        if (!is_array($requirements)) {
            $this->usageError('Requirements must be an array, "' . gettype($requirements) . '" has been given!');
        }
        if (!isset($this->result) || !is_array($this->result)) {
            $this->result = array(
                'summary' => array(
                    'total' => 0,
                    'errors' => 0,
                    'warnings' => 0,
                ),
                'requirements' => array(),
            );
        }
        foreach ($requirements as $key => $rawRequirement) {
            $requirement = $this->normalizeRequirement($rawRequirement, $key);
            $this->result['summary']['total']++;
            if (!$requirement['condition']) {
                if ($requirement['mandatory']) {
                    $requirement['error'] = true;
                    $requirement['warning'] = true;
                    $this->result['summary']['errors']++;
                } else {
                    $requirement['error'] = false;
                    $requirement['warning'] = true;
                    $this->result['summary']['warnings']++;
                }
            } else {
                $requirement['error'] = false;
                $requirement['warning'] = false;
            }
            $this->result['requirements'][] = $requirement;
        }

        return $this;
    }
function check($requirements)
    {
        if (is_string($requirements)) {
            $requirements = require $requirements;
        }
        if (!is_array($requirements)) {
            $this->usageError('Requirements must be an array, "' . gettype($requirements) . '" has been given!');
        }
        if (!isset($this->result) || !is_array($this->result)) {
            $this->result = array(
                'summary' => array(
                    'total' => 0,
                    'errors' => 0,
                    'warnings' => 0,
                ),
                'requirements' => array(),
            );
        }
        foreach ($requirements as $key => $rawRequirement) {
            $requirement = $this->normalizeRequirement($rawRequirement, $key);
            $this->result['summary']['total']++;
            if (!$requirement['condition']) {
                if ($requirement['mandatory']) {
                    $requirement['error'] = true;
                    $requirement['warning'] = true;
                    $this->result['summary']['errors']++;
                } else {
                    $requirement['error'] = false;
                    $requirement['warning'] = true;
                    $this->result['summary']['warnings']++;
                }
            } else {
                $requirement['error'] = false;
                $requirement['warning'] = false;
            }
            $this->result['requirements'][] = $requirement;
        }

        return $this;
    }
function check ( $ requirements ) { if ( is_string ( $ requirements ) ) { $ requirements = require $ requirements ; } if ( ! is_array ( $ requirements ) ) { $ this -> usageError ( 'Requirements must be an array, "' . gettype ( $ requirements ) . '" has been given!' ) ; } if ( ! isset ( $ this -> result ) || ! is_array ( $ this -> result ) ) { $ this -> result = array ( 'summary' => array ( 'total' => 0 , 'errors' => 0 , 'warnings' => 0 , ) , 'requirements' => array ( ) , ) ; } foreach ( $ requirements as $ key => $ rawRequirement ) { $ requirement = $ this -> normalizeRequirement ( $ rawRequirement , $ key ) ; $ this -> result [ 'summary' ] [ 'total' ] ++ ; if ( ! $ requirement [ 'condition' ] ) { if ( $ requirement [ 'mandatory' ] ) { $ requirement [ 'error' ] = true ; $ requirement [ 'warning' ] = true ; $ this -> result [ 'summary' ] [ 'errors' ] ++ ; } else { $ requirement [ 'error' ] = false ; $ requirement [ 'warning' ] = true ; $ this -> result [ 'summary' ] [ 'warnings' ] ++ ; } } else { $ requirement [ 'error' ] = false ; $ requirement [ 'warning' ] = false ; } $ this -> result [ 'requirements' ] [ ] = $ requirement ; } return $ this ; }
Check the given requirements, collecting results into internal field.
This method can be invoked several times checking different requirement sets.
Use [[getResult()]] or [[render()]] to get the results.
@param array|string $requirements requirements to be checked.
If an array, it is treated as the set of requirements;
If a string, it is treated as the path of the file, which contains the requirements;
@return $this self instance.
Check the given requirements collecting results into internal field . This method can be invoked several times checking different requirement sets . Use [[ getResult () ]] or [[ render () ]] to get the results .