Checker.

@return Result
510651
public function check()
    {
        list($messages, $result) = $this->checkPresence();

        if ($result->count() == 0) {
            return $this->makeHealthyResult();
        }

        return $this->makeResult(
            false,
            $this->target->getErrorMessage().' - '.implode(' ', $messages)
        );
    }
204552
protected function getCheck()
    {
        $check = array(0 => '', 1 => '');
        $type  = $this->getType();

        switch ($type->getType()) {
            case 'int':
            case 'float':
                if ($type->isUnsigned()) {
                    $check[1] = '\UnderflowException';
                    $check[0] = '
        if ($this->' . $this->getPropertyName() . ' < 0) {
            throw new \UnderflowException(\'Value of "' . $this->getPropertyName() . '" must be greater than 0\');
        }';
                }
                break;
        }

        return $check;
    }
722817
public function check()
    {
        try {
            return $this->json($this->manager()->checkPackage());
        } catch (PackageManagerException $e) {
            return $this->getJsonException($e);
        }
    }
674647
public function checks()
    {
        foreach ($this->check as $checkName => $className) {
            $this
                ->getValidator($className, $checkName)
                ->check()
            ;
        }
    }
631787
public function check()
    {
        $this->loadDatabase();

        $current = $this->getCurrentUptime();

        $this->persist($current);

        $rebooted =
            ($cs = $this->uptimeInSeconds($current)) <
            ($ss = $this->uptimeInSeconds($this->database));

        return $this->makeResult(
            ! $rebooted,
            $this->makeMessage($current, $this->database)
        );
    }
1046720
public function match() {
		$result = false;

		$this->matchedStatus = $this->result->getStatus();

		if ($this->result->hasHandler()) {
			$result = true;
			$this->matchedHandler = $this->result->getHandler();
		} else {
			$this->matchedHandler = $this->notFoundHandler;
		}

		return $result;
	}
192206
public function performCheck()
    {
        $result = new PreconditionResult();
        if (!(
            extension_loaded('pdo')
            && extension_loaded('pdo_mysql')
        )) {
            $result
                ->setState(PreconditionResult::STATE_FAILED)
                ->setMessage(t('The PDO extension is not loaded.'))
            ;
        }

        return $result;
    }
1219409
public function check()
    {
        $this->pingBinFactory();

        $ipAddress = ip_address_from_hostname($this->target->hostname);

        $latency = $this->ping($ipAddress);

        $latencyFormatted = $latency ? "{$latency}ms" : 'error!';

        $this->target->setDisplay(
            "{$this->target->name} ({$latencyFormatted})"
        );

        if ($latency === false || $latency > $this->target->acceptedLatency) {
            $result = $this->makeResult(
                false,
                sprintf(
                    $this->target->getErrorMessage(),
                    $this->hosnameAndIp($this->target->hostname, $ipAddress),
                    $latency === false ? '[ping error]' : $latency,
                    $this->target->acceptedLatency
                )
            );
        } else {
            $result = $this->makeHealthyResult();
        }

        return $result->setValue($latency)->setValueHuman("{$latency}ms");
    }
1125768
protected function check()
  {
    if ( $this->slugAble() ){
      if ( !$this->checkTitleUnique($this->row->get('id'), $this->row->get('title')) ){
        return false;
      }
      
      if ( !$this->checkSlugUnique($this->row->get('id'), $this->row->get('slug')) ){
        return false;
      }
    }
    
    if ( $this->orderingAble() ){
      if ( $this->shouldBeOrdered() ){
        $conditions = $this->getReorderConditions();
        $this->row->set('ordering', $this->getNextOrder($conditions));
      }
    }
    
    if ( $this->statesAble() ){
      $userId   = $this->db->getUid();
      $nullDate = $this->db->getNullDate();
      $nowDate  = Date::getInstance()->format($this->db->getDateFormat());
      
      if ( !$this->row->get($this->tbl_key) ){
        $this->row->set('created', $nowDate);
        $this->row->set('created_by', $userId); 
      }
      else {
        $this->row->set('modified', $nowDate);
        $this->row->set('modified_by', $userId); 
      }
    }
    
    if ( $this->versionAble() ){
      $version = (int)$this->row->get('version');
      $this->row->set('version', ++$version);
    }
    
    foreach($this->getFields() as $fieldName => $fieldInfos){
      $v = $this->row->get($fieldName);
      
      if ( 'YES' === $fieldInfos->Null ){
        switch($fieldInfos->Type){
          case 'bigint':
          case 'mediumint':
          case 'smallint':
          case 'tinyint':
            if ( 0 === $this->row->get($fieldName) ){
              $this->row->set($fieldName, null);
            }
            break;
          
          case 'datetime':
          case 'timestamp':
            if ( $this->db->getNullDate(true) === $this->row->get($fieldName) ){
              $this->row->set($fieldName, null);
            }
            break;
          
          case 'date':
            if ( $this->db->getNullDate(false) === $this->row->get($fieldName) ){
              $this->row->set($fieldName, null);
            }
            break;
          
          case 'time':
            if ( '00:00:00' === $this->row->get($fieldName) ){
              $this->row->set($fieldName, null);
            }
            break;
        }
      }
    }
    
    return true;
  }
1178027
public function check()
    {
        $this->missing = [];
        $from          = $this->getDefaultLocale();
        $locales       = $this->getLocales();
        $ignored       = $this->getIgnoredTranslations();
        $fromTrans     = $this->getTranslations($from, $ignored);

        foreach ($locales as $to) {
            $toTrans = $this->getTranslations($to, $ignored);

            $this->diffMissing($toTrans, $fromTrans, $from);
            $this->diffMissing($fromTrans, $toTrans, $to);
        }

        return $this->missing;
    }
892327
public function check()
    {
        $pdoResult = extension_loaded('PDO');
        $pdoMySqlResult = extension_loaded('pdo_mysql');

        $result = ($pdoResult === true && $pdoMySqlResult === true);

        if ($pdoResult === true) {
            $this->pdoVersion = phpversion('PDO');
        }

        if ($pdoMySqlResult === true) {
            $this->pdoMySqlVersion = phpversion('pdo_mysql');
        }

        return $result;
    }
563345
public function check()
    {
        $this->notify(Status::CHECK, $this->loaded);
        $envArgs = explode('|', (string) getenv($this->envAllowXdebug));

        if (empty($envArgs[0]) && $this->requiresRestart((bool) $this->loaded)) {
            // Restart required
            $this->notify(Status::RESTART);

            if ($this->prepareRestart()) {
                $command = $this->getCommand();
                $this->notify(Status::RESTARTING, $command);
                $this->restart($command);
            }
            return;
        }

        if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
            // Restarting, so unset environment variable and use saved values
            $this->notify(Status::RESTARTED);

            Process::setEnv($this->envAllowXdebug);
            self::$inRestart = true;

            if (!$this->loaded) {
                // Skipped version is only set if xdebug is not loaded
                self::$skipped = $envArgs[1];
            }

            // Put restart settings in the environment
            $this->setEnvRestartSettings($envArgs);
            return;
        }

        $this->notify(Status::NORESTART);

        if ($settings = self::getRestartSettings()) {
            // Called with existing settings, so sync our settings
            $this->syncSettings($settings);
        }
    }
1035751
public function check()
    {
        if (class_exists($this->className)) {
            return [EnvironmentCheck::OK, 'Class ' . $this->className.' exists'];
        }
        return [EnvironmentCheck::ERROR, 'Class ' . $this->className.' doesn\'t exist'];
    }
1157814
public function check()
    {
        return $this->executeAndCheck()
            ? $this->makeHealthyResult()
            : $this->makeResult(false, $this->target->getErrorMessage());
    }
486837
public function checkedLock()
    {
        $isLocked = ! flock($this->handle, LOCK_EX | LOCK_NB);
        if ($isLocked) {
            $this->lock();

        }
        return $isLocked;
    }
1264200
public function check()
    {
        $returnValue = null;

        
        $name = $this->getName();
        $min = $this->getMin();
        $max = $this->getMax();
        $validity = null;
        $message = null;
        
        if (extension_loaded($name)){
            $current = $this->getValue();
            
            if (!empty($min) && !empty($max)){
                // Both min and max are specified.
                if (version_compare($current, $min, '>=') && version_compare($current, $max, '<=')){
                    $validity = common_configuration_Report::VALID;
                    $message = "PHP Extension '${name}' version (${current}) is between ${min} and ${max}.";
                }
                else{
                    $validity = common_configuration_Report::INVALID;
                    $message = "PHP Extension '${name}' version (${current}) is not between ${min} and ${max}.";
                }
            }
            else if (!empty($min) && empty($max)){
                // Only min is specified.
                if (version_compare($current, $min, '>=')){
                    $validity = common_configuration_Report::VALID;
                    $message = "PHP Extension '${name}' version (${current}) is greater or equal to ${min}.";
                }
                else{
                    $validity = common_configuration_Report::INVALID;
                    $message = "PHP Extension '${name}' version (${current}) is lesser than ${min}.";
                }
            }
            else if (empty($min) && !empty($max)){
                // Only max is specified.
                if (version_compare($current, $max, '<=')){
                    $validity = common_configuration_Report::VALID;
                    $message = "PHP Extension '${name}' version (${current}) is lesser or equal to ${max}.";
                }
                else{
                    $validity = common_configuration_Report::INVALID;
                    $message = "PHP Extension '${name}' version (${current}) is greater than ${max}.";
                }
            }
            else{
                // No min and max are provided, we just check the
                // existence of the extension (already done).
                $validity = common_configuration_Report::VALID;
                $message = "PHP Extension '${name}' is loaded.";
            }
        }
        else{
            $validity = common_configuration_Report::UNKNOWN;
            $message = "PHP Extension '${name}' could not be found.";
        }

        $returnValue = new common_configuration_Report($validity, $message, $this);
        

        return $returnValue;
    }
558868
public function check()
    {
        if ($this->user !== null) {
            return $this->user;
        }

        if (! $code = $this->persistences->check()) {
            return false;
        }

        if (! $user = $this->persistences->findUserByPersistenceCode($code)) {
            return false;
        }

        if (! $this->cycleCheckpoints('check', $user)) {
            return false;
        }

        return $this->user = $user;
    }