{@inheritdoc}

@see PreconditionInterface::performCheck()
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;
    }
1213807
public function validate($checkCurrentVersion = true)
    {
        if (null === $this->moduleDescriptor) {
            throw new \Exception(
                $this->trans(
                    "The %name module definition has not been initialized.",
                    [ '%name' => $this->moduleDirName ]
                )
            );
        }

        $this->checkVersion();

        if (true === $checkCurrentVersion) {
            $this->checkModuleVersion();
        }

        $this->checkModuleDependencies();
    }
207468
public function performAllChecks() {
    $this->checkRequire();
    $this->checkBltRequireDev();
    if (!$this->getInspector()->isVmCli()) {
      $this->checkPrestissimo();
    }
    $this->checkComposerConfig();

    return $this->problems;
  }
840724
private function validateCheckerConditionsAndThrowFailureExceptionOnFailedCheck(
        CheckInterface $checker,
        array $arguments,
        $errorText
    ) {
        $validatorData = $checker($arguments);

        if ($validatorData !== true) {
            if (is_array($validatorData)) {
                throw new FailureException(sprintf($errorText, ...$validatorData));
            }

            throw new FailureException($errorText);
        }

        return true;
    }
122157
public function performCheck()
    {
        $result = null;
        $configuration = $this->installerOptions->getConfiguration();
        foreach ([
            'canonical-url' => t('The canonical URL must have the http:// scheme or the https:// scheme'),
            'canonical-url-alternative' => t('The alternative canonical URL must have the http:// scheme or the https:// scheme'),
        ] as $handle => $error) {
            if (isset($configuration[$handle]) && $configuration[$handle] !== '') {
                $originalUrl = $configuration[$handle];
                $url = UrlImmutable::createFromUrl($originalUrl);
                if (!preg_match('/^https?$/i', $url->getScheme())) {
                    $result = new PreconditionResult(PreconditionResult::STATE_FAILED, $error);
                    break;
                }
                $finalUrl = (string) $url;
                if ($originalUrl !== $finalUrl) {
                    $result = new PreconditionResult(PreconditionResult::STATE_FAILED, t('The canonical url "%1$s" should be specified as "%2$s"', $originalUrl, $finalUrl));
                }
            }
        }
        if ($result === null) {
            $result = new PreconditionResult(PreconditionResult::STATE_PASSED);
        }

        return $result;
    }
1162606
public static function verify()
    {
        // PHP interpreter version
        self::checkSystemVersion();

        // BCMath
        self::isFunctionExists('bcmul', self::getErrorMessage('bcmath'));
        self::isFunctionExists('bcdiv', self::getErrorMessage('bcmath'));

        // Filter
        self::isFunctionExists('filter_var', self::getErrorMessage('filter'));

        // Hash
        self::isFunctionExists('hash', self::getErrorMessage('hash'));

        // XMLReader
        self::isClassExists('XMLReader', self::getErrorMessage('xmlreader'));

        // XMLWriter
        if (\Genesis\Config::getInterface('builder') == 'xml') {
            self::isClassExists('XMLWriter', self::getErrorMessage('xmlwriter'));
        }

        // cURL
        if (\Genesis\Config::getInterface('network') == 'curl') {
            self::isFunctionExists('curl_init', self::getErrorMessage('curl'));
        }
    }
575451
public function performCheck()
    {
        try {
            $lctn = $this->connection->fetchColumn('SELECT @@lower_case_table_names');
            if (!is_numeric($lctn)) {
                $result = new PreconditionResult(PreconditionResult::STATE_WARNING, t('Failed to get the value of the %s MySQL variable', 'lower_case_table_names'));
            } else {
                $lctn = (int) $lctn;
                // https://dev.mysql.com/doc/refman/5.7/en/identifier-case-sensitivity.html
                switch ($lctn) {
                    case 0:
                        // Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement.
                        // Name comparisons are case sensitive.
                        // You should not set this variable to 0 if you are running MySQL on a system that has case-insensitive file names (such as Windows or OS X).
                        // If you force this variable to 0 with --lower-case-table-names=0 on a case-insensitive file system and access MyISAM tablenames using different lettercases, index corruption may result.
                        $result = new PreconditionResult(PreconditionResult::STATE_PASSED, t('Table names are stored in the specified lettercase (lookups are performed in a case-sensitive way).'));
                        break;
                    case 1:
                        // Table names are stored in lowercase on disk and name comparisons are not case-sensitive.
                        // MySQL converts all table names to lowercase on storage and lookup.
                        // This behavior also applies to database names and table aliases.
                        $result = new PreconditionResult(PreconditionResult::STATE_FAILED, t('Table names are stored in the lowercase: you may have problems if you plan to move this installation to another server (hint: you should set the %1$s MySQL variable to %2$s)', 'lower_case_table_names', 2));
                        break;
                    case 2:
                        // Table and database names are stored on disk using the lettercase specified in the CREATE TABLE or CREATE DATABASE statement, but MySQL converts them to lowercase on lookup.
                        // Name comparisons are not case sensitive.
                        // This works only on file systems that are not case-sensitive!
                        // InnoDB table names are stored in lowercase, as for lower_case_table_names=1.
                        $result = new PreconditionResult(PreconditionResult::STATE_PASSED, t('Table names are stored in the specified lettercase (lookups are performed in a case-insensitive way).'));
                        break;
                    default:
                        $result = new PreconditionResult(PreconditionResult::STATE_WARNING, t('Unknown value (%1$s) of the %2$s MySQL variable', $lctn, 'lower_case_table_names'));
                        break;
                }
            }
        } catch (Exception $x) {
            $result = new PreconditionResult(PreconditionResult::STATE_WARNING, $x->getMessage());
        }

        return $result;
    }
813799
protected function performValidation()
    {
        $this->requireProperties(['type']);
        if (isset($this->type)) {
            if (!in_array($this->type, $this->knownTypes)) {
                $this->addError("Unknown Security Scheme type: $this->type");
            } else {
                switch ($this->type) {
                    case "apiKey":
                        $this->requireProperties(['name', 'in']);
                        if (isset($this->in)) {
                            if (!in_array($this->in, ["query", "header", "cookie"])) {
                                $this->addError("Invalid value for Security Scheme property 'in': $this->in");
                            }
                        }
                        break;
                    case "http":
                        $this->requireProperties(['scheme']);
                        break;
                    case "oauth2":
                        $this->requireProperties(['flows']);
                        break;
                    case "openIdConnect":
                        $this->requireProperties(['openIdConnectUrl']);
                        break;
                }
            }
        }
    }
570109
public function execute()
    {
        $txt = 'validator_email';
        $domain = '';
        
        $result = filter_var($this->value, FILTER_VALIDATE_EMAIL);
        
        if ($result) {
            
            list ($user, $domain) = explode("@", $this->value);
            
            // Perform dns check of mail domain
            if ($domain) {
                
                $result = checkdnsrr($domain, "MX");
                
                if (!$result) {
                    $txt = 'validator.rule.email.dnscheck';
                }
            }
        }
        
        if (!$result) {
            $this->msg = [
                $txt,
                [
                    $domain
                ]
            ];
        }
    }
334785
public function check(
        StatementsSource $source,
        CodeLocation $code_location,
        array $suppressed_issues,
        array $phantom_classes = [],
        $inferred = true
    ) {
        if ($this->checked) {
            return;
        }

        $all_good = true;

        foreach ($this->types as $atomic_type) {
            if ($atomic_type->check(
                $source,
                $code_location,
                $suppressed_issues,
                $phantom_classes,
                $inferred
            ) === false) {
                $all_good = false;
            }
        }

        if (!$all_good) {
            return false;
        } else {
            $this->checked = true;
        }
    }
145231
protected function executeChecker(
        ApplicableCheckerInterface $checker,
        ContextInterface $context,
        array $processorAttributes
    ) {
        return $checker->isApplicable($context, $processorAttributes);
    }
84399
private function checkPreconditions(\Concrete\Core\Application\Application $app, OutputInterface $output)
    {
        $result = true;
        $service = $app->make(PreconditionService::class);
        /* @var PreconditionService $service */
        $requiredPreconditions = [];
        $optionalPreconditions = [];
        foreach ($service->getPreconditions(false) as $precondition) {
            if ($precondition->isOptional()) {
                $optionalPreconditions[] = $precondition;
            } else {
                $requiredPreconditions[] = $precondition;
            }
        }
        foreach ([
            'Checking required preconditions:' => $requiredPreconditions,
            'Checking optional preconditions:' => $optionalPreconditions,
        ] as $text => $preconditions) {
            if (empty($preconditions)) {
                continue;
            }
            if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
                $output->writeln($text);
            }
            foreach ($preconditions as $precondition) {
                if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
                    $output->write(sprintf('- %s... ', $precondition->getName()));
                } elseif ($precondition->isOptional()) {
                    continue;
                }
                $preconditionResult = $precondition->performCheck();
                switch ($preconditionResult->getState()) {
                    case PreconditionResult::STATE_PASSED:
                        if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
                            $message = $preconditionResult->getMessage();
                            $message = $message ? sprintf('passed (%s).', $message) : 'passed.';
                            $output->writeln(sprintf('<info>%s</info>', $message));
                        }
                        break;
                    case PreconditionResult::STATE_WARNING:
                        if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
                            $output->writeln(sprintf('<comment>%s</comment>', $preconditionResult->getMessage()));
                        }
                        break;
                    case PreconditionResult::STATE_SKIPPED:
                        if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
                            $output->writeln(sprintf('<comment>%s</comment>', $preconditionResult->getMessage() ?: 'skipped.'));
                        }
                        break;
                    case PreconditionResult::STATE_FAILED:
                    default:
                        if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
                            $output->writeln(sprintf('<error>%s</error>', $preconditionResult->getMessage()));
                        }
                        if (!$precondition->isOptional()) {
                            $result = false;
                        }
                        break;
                }
            }
        }

        return $result;
    }
525738
@Override
	public CheckResult check() {
		try {
			post(new byte[] { '[', ']' });
			return CheckResult.OK;
		}
		catch (Exception e) {
			return CheckResult.failed(e);
		}
	}
115495
public function check()
    {
        $this->state = self::STATE_UNCHECKED;
        
        // check all conditions
        /* @var $processor \Sokil\FraudDetector\ProcessorInterface */
        foreach($this->processorDeclarationList->getKeys() as $processorName) {
            $processor = $this->getProcessor($processorName);

            if($processor->isPassed()) {
                $processor->afterCheckPassed();
                $this->trigger(self::STATE_PASSED . ':' . $processorName);
                
                // check passed if all processors passes their cheks
                if ($this->state === self::STATE_UNCHECKED) {
                    $this->state = self::STATE_PASSED;
                }
            } else {
                $processor->afterCheckFailed();
                $this->trigger(self::STATE_FAILED . ':' . $processorName);
                // if any processor failed - all check failed
                $this->state = self::STATE_FAILED;
            }
        }

        $this->trigger($this->state);
    }
1082702
public function check() {
        if ($this->_exist) {
            foreach ($this->_constraints as $constraint) {
                switch ($constraint['type']) {
                    case self::ACCEPT:
                        if (!is_array($this->_data[$this->_field]['type'])) {
                            $this->_data[$this->_field]['type'] = [$this->_data[$this->_field]['type']];
                        }

                        foreach ($this->_data[$this->_field]['type'] as $value) {
                            if ($value != '') {
                                if (!in_array($value, $constraint['value'])) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::EXTENSION:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        foreach ($this->_data[$this->_field]['name'] as $value) {
                            if ($value != '') {
                                if (!in_array(pathinfo($value)['extension'], $constraint['value'])) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::SIZEMIN:
                        if (!is_array($this->_data[$this->_field]['size'])) {
                            $this->_data[$this->_field]['size'] = [$this->_data[$this->_field]['size']];
                        }

                        foreach ($this->_data[$this->_field]['size'] as $value) {
                            if ($value != 0) {
                                if ($value < $constraint['value']) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::SIZEMAX:
                        if (!is_array($this->_data[$this->_field]['size'])) {
                            $this->_data[$this->_field]['size'] = [$this->_data[$this->_field]['size']];
                        }

                        foreach ($this->_data[$this->_field]['size'] as $value) {
                            if ($value != 0) {
                                if ($value > $constraint['value']) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::SIZEBETWEEN:
                        if (!is_array($this->_data[$this->_field]['size'])) {
                            $this->_data[$this->_field]['size'] = [$this->_data[$this->_field]['size']];
                        }

                        foreach ($this->_data[$this->_field]['size'] as $value) {
                            if ($value != 0) {
                                if ($value < $constraint['value'][0] || $value > $constraint['value'][1]) {
                                    array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                                }
                            }
                        }
                        break;

                    case self::COUNT:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        if (count($this->_data[$this->_field]['name']) != $constraint['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                        }
                        break;

                    case self::COUNTMIN:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        if (count($this->_data[$this->_field]['name']) < $constraint['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                        }
                        break;

                    case self::COUNTMAX:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        if (count($this->_data[$this->_field]['name']) > $constraint['value']) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                        }
                        break;

                    case self::COUNTIN:
                        if (!is_array($this->_data[$this->_field]['name'])) {
                            $this->_data[$this->_field]['name'] = [$this->_data[$this->_field]['name']];
                        }

                        if (!in_array(count($this->_data[$this->_field]['name']), $constraint['value'])) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraint['message']]);
                        }
                        break;

                    case self::CUSTOM:
                        /** @var object[] $constraints */
                        if ($constraints['value']->filter() == false) {
                            array_push($this->_errors, ['name' => $this->_field, 'field' => $this->_label, 'message' => $constraints['value']->error()]);
                        }
                        break;
                }
            }
        }
    }
1030148
public function performCheck()
    {
        $notWritableDirectories = [];
        foreach ([
            DIR_CONFIG_SITE => DIRNAME_APPLICATION . '/' . DIRNAME_CONFIG . '/',
            DIR_FILES_UPLOADED_STANDARD => DIRNAME_APPLICATION . '/files/',
            DIR_PACKAGES => DIRNAME_PACKAGES . '/',
        ] as $path => $name) {
            if (!$this->fs->isDirectory($path) || !$this->fs->isWritable($path)) {
                $notWritableDirectories[] = $name;
            }
        }
        $result = new PreconditionResult();
        $numNotWritableDirectories = count($notWritableDirectories);
        if ($numNotWritableDirectories > 0) {
            $message = t2('This directory must exist and it must be writable by your web server:', 'These directories must exist and they must be writable by your web server:', $numNotWritableDirectories);
            $message .= ' ' . \Punic\Misc::join($notWritableDirectories);
            $result
                ->setState(PreconditionResult::STATE_FAILED)
                ->setMessage($message)
            ;
        }

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