Check resource.

@return Result
555472
public function check()
    {
        $outdated = $this->executeCommand();

        if ($outdated->count() > $this->target->resource->shouldCountAtMost) {
            return $this->makeResult(
                false,
                sprintf($this->target->getErrorMessage(), $outdated->count())
            );
        }

        return $this->makeHealthyResult();
    }
1101169
public function check()
    {
        if (!DB::get_schema()->hasTable($this->checkTable)) {
            return [EnvironmentCheck::ERROR, "$this->checkTable not present in the database"];
        }

        $count = DB::query("SELECT COUNT(*) FROM \"$this->checkTable\"")->value();

        if ($count > 0) {
            return [EnvironmentCheck::OK, ''];
        }

        return [EnvironmentCheck::WARNING, "$this->checkTable queried ok but has no records"];
    }
278530
public function getResource()
    {
        if ($this->getEvent() && $this->event->getTarget() instanceof ResourceInterface) {
            return $this->event->getTarget();
        }

        return null;
    }
707552
public function performCheck()
    {
        $result = new PreconditionResult();
        if (version_compare(PHP_VERSION, static::MINIMUM_PHP_VERSION) < 0) {
            $result
                ->setState(PreconditionResult::STATE_FAILED)
                ->setMessage(t('concrete5 requires at least PHP version %1$s (you are running PHP version %2$s).', static::MINIMUM_PHP_VERSION, PHP_VERSION))
            ;
        } else {
            $result->setMessage(t('you are running PHP version %s', PHP_VERSION));
        }

        return $result;
    }
562109
public function check()
    {
        $session = $this->request->session();
        $validationTime = Carbon::createFromTimestamp($session->get($this->key.'.life', 0));

        return $session->get($this->key.'.authenticated', false) &&
            ($validationTime->diffInMinutes() <= $this->reauthTime);
    }
795440
public function isConnected()
    {
        try {
            return \is_resource($this->connection) && \ftp_rawlist($this->connection, $this->getRoot()) !== false;
        } catch (\ErrorException $e) {
            if (\strpos($e->getMessage(), 'ftp_rawlist') === false) {
                throw $e;
            }

            return false;
        }
    }
1302338
function result()
    {
        if ($this->result == null || count($this->result) == 0) {
            return false;
        }
        return $this->result;
    }
147793
public function fetchResult()
    {
        if ($this->checkValid()) {
            try {
                return $this->getAdapter()->fetchAssoc($this->resultSQL);
            } catch (Exception $e) {
                $e->log();
            }
        }

        return false;
    }
932834
public function check(): bool
  {
    if ( $this->current !== null ){
      // if $on_error is set to E_CONTINUE returns true
      if ( $this->on_error === self::E_CONTINUE ){
        return true;
      }
      // If any connection has an error with mode E_STOP_ALL
      if ( self::$has_error_all && ($this->on_error !== self::E_STOP_ALL) ){
        return false;
      }
      // If this connection has an error with mode E_STOP
      if ( $this->has_error && ($this->on_error !== self::E_STOP) ){
        return false;
      }
      return true;
    }
    return false;
  }
280679
protected function _actionCheck()
    {
        $actions = $this->getConfig('actions');
        if (is_bool($actions)) {
            return $actions;
        }

        return in_array($this->request->getParam('action'), (array)$actions, true);
    }
196204
protected function matchesResource(Resource $resource = null)
    {
        // If the resource is null we should only return true if the current resource is also null.
        if ($resource === null) {
            return $this->getResource() === null || (
                $this->getResourceType() === null && $this->getResourceId() === null
            );
        }

        // If the permission's resource id is null then all resources with a specific ID are accepted.
        if ($this->getResourceId() === null) {
            return $this->getResourceType() === $resource->getResourceType();
        }

        // Otherwise make sure that we're matching a specific resource.
        return (
            $this->getResourceType() === $resource->getResourceType() &&
            $this->getResourceId() === $resource->getResourceId()
        );
    }
1097013
public function isSimpleResource()
    {
        if ($this->data instanceof \FreeFW\JsonApi\V1\Model\ResourceObject) {
            return true;
        }
        return false;
    }
84600
public function check()
    {
        $result = true;

        $configurationSettings = [
            'Database.Host',
            'Database.Username',
            'Database.Password',
            'Database.Port',
            'Database.Name',
        ];

        foreach ($configurationSettings as $setting) {
            if ($this->configuration->hasConfigurationKey($setting) === false) {
                $this->missingConfiguration[] = $setting;
                $result = false;
            }
        }

        return $result;
    }
1829
public function check()
    {
        foreach ($this->target->paths as $path) {
            if (! $this->getFilesystem()->isWritable($path)) {
                return $this->makeResult(
                    false,
                    sprintf($this->target->getErrorMessage(), $path)
                );
            }
        }

        return $this->makeHealthyResult();
    }
173567
public function hasChanges()
    {
        if ($this->hasChanges) {
            return $this->hasChanges;
        }

        $this->hasChanges = count($this->newResources) > 0 || count($this->deletedResources) > 0 || count($this->updatedResources) > 0;

        return $this->hasChanges;
    }
143324
public function check()
    {
        $result = true;

        // TODO This check tries only to connect to the database
        // But it would make sense to check
        //  a) insert, select, update, delete, etc. access
        //  a) a) Which access rights do i need? Topic hardening?
        try {
            $this->database->connect($this->database->getConfig());
        } catch (\Exception $e) {
            $result = false;
        }

        return $result;
    }
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'];
    }