Run the check and return a result.

Assume the checker is enabled and its config make sense.

@param Config $config The config instance.

@return ResultInterface
323654
protected function run(Config $config): ResultInterface
    {
        $outdatedPlugins = WP_CLI::runcommand(
            'plugin list --update=available --fields=name,version,update_version --format=json',
            [
                'return' => true,
                'parse' => 'json',
                'launch' => true,
                'exit_error' => false,
            ]
        );

        $excludes = $config->compileExcludes([]);
        $outdatedPlugins = array_filter($outdatedPlugins, function (array $plugin) use ($excludes): bool {
            return ! in_array($plugin['name'], $excludes, true);
        });

        $messages = array_map(function (array $plugin): string {
            return "${plugin['name']} (${plugin['version']} => ${plugin['update_version']})";
        }, $outdatedPlugins);

        return (empty($messages))
            ? ResultFactory::makeSuccess($this)
            : ResultFactory::makeFailure(
                $this,
                array_merge(['Plugin updates available:'], $messages)
            );
    }
1067897
public function setConfig(Config $config)
    {
        $this->checkConfigConsistency($config);

        $this->config = $config;

        return $this;
    }
619381
public function run(Config $config): ResultInterface
    {
        return get_option('permalink_structure')
            ? ResultFactory::makeSuccess($this)
            : ResultFactory::makeFailure($this, 'Permalink structure not defined');
    }
353970
public static function run(array $config) {
        static::init($config);
        static::moduleIsActivated();
        $cache = static::canCache();
        $name = join('/', static::getUrls());
        if ($cache && $out = $cache->fetch($name)) {
            echo $out;
        }
        else {
            $controller = static::getControllerClass();
            $action = static::getAction();
            if (!in_array($action, $controller->getActions())) {
                ControllerException::invalidAction($action);
            }

            $params = static::getParams();
            static::authenticate($controller, $action, $params);

            $refMethod = new ReflectionMethod($controller, $action . 'Action');

            if (count($params) < $refMethod->getNumberOfRequiredParameters()) {
                ControllerException::invalidParamCount();
            }
            $actionRet = call_user_func_array(array($controller, $action . 'Action'), $params);

            if (!is_array($actionRet)) {
                ControllerException::invalidActionResult();
            }
            static::terminate();
            
            header('Content-Type: application/json');
            die(json_encode($actionRet));
        }
    }
1293702
function checkAndPrepare(Config $config) {
		$this->merchantId = $config->merchantId;

		$this->dttm = date(Client::DATE_FORMAT);

		if (!$this->payOperation) {
			$this->payOperation = self::OPERATION_PAYMENT;
		}

		if (!$this->payMethod) {
			$this->payMethod = "card";
		}

		if (!$this->currency) {
			$this->currency = "CZK";
		}

		if (!$this->language) {
			$this->language = "CZ";
		}
		
		if (!$this->ttlSec or !is_numeric($this->ttlSec)) {
			$this->ttlSec = 1800;
		}

		if ($this->closePayment === null) {
			$this->closePayment = $config->closePayment ? true : false;
		}

		if (!$this->returnUrl) {
			$this->returnUrl = $config->returnUrl;
		}
		if (!$this->returnUrl) {
			throw new Exception("A ReturnUrl must be set - either by setting \$returnUrl property, or by specifying it in Config.");
		}

		if (!$this->returnMethod) {
			$this->returnMethod = $config->returnMethod;
		}

		if (!$this->description) {
			$this->description = $config->shopName.", ".$this->orderNo;
		}
		$this->description = Strings::shorten($this->description, 240, "...");

		$this->customerId = Strings::shorten($this->customerId, 50, "", true, true);

		if (!$this->cart) {
			throw new Exception("Cart is empty. Please add one or two items into cart using addCartItem() method.");
		}

		if (!$this->orderNo or !preg_match('~^[0-9]{1,10}$~', $this->orderNo)) {
			throw new Exception("Invalid orderNo - it must be a non-empty numeric value, 10 characters max.");
		}

		$sumOfItems = array_sum(Arrays::transform($this->cart, true, "amount"));
		$this->totalAmount = $sumOfItems;

		return $this;
	}
506053
public static function run($name, array $config = array())
    {
        $generator = self::create($name, $config);

        if (!$generator->validate()) {
            $generator->renderErrors();
        }

        return $generator->generate();
    }
887275
public function check($config)
    {
        if ($this->key && !empty($config['allow_key']) && !in_array($this->key, $config['allow_key'])) {
            return false;
        }

        return true;
    }
1172987
public function init($config)
    {
        $this->pdo = null;

        $dns = '';
        if (is_array($config)) {
            $config += array('user' => null, 'password' => null);
            $dns = "{$config['type']}:host={$config['host']};port={$config['port']};dbname={$config['name']}";
        } else if (is_string($config)) {
            $dns = $config;
        } else if ($config instanceof PDO) {
            $this->pdo = $config;
            return $this;
        }

        try {

            // Use pipe for merging fields - sqlite compatibility
            $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET sql_mode='PIPES_AS_CONCAT'");
            $this->pdo = new PDO($dns, $config['user'], $config['password'], $options);
            $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        } catch (Exception $ex) {
            $this->pdo = null;
            throw new RuntimeException('Cannot connect to database: ' . $ex->getMessage());
        }

        return $this;
    }
856606
public function load(Config $config)
    {
        if (null === $config) {
            $config = new Config();
        }

        $this->loadExtensions($config);

        return $this
            ->applyCommands($config)
            ->applyHooks($config)
        ;
    }
585982
public function bootstrap( $config = [] ) {
		if ( $this->isBootstrapped() ) {
			throw new ConfigurationException( static::class . ' already bootstrapped.' );
		}

		$this->bootstrapped = true;
		$this->bootstrapApplication( $config );
	}
434524
protected function checkConfig(array $config): void
    {
        foreach (['host', 'username', 'password', 'database', 'persistent'] as $key) {
            if (!isset($config[$key])) {
                $class = get_class($this);
                throw new ConfigException("Missing configuration key={$key} in {$class}");
            }
        }
    }
1013841
public static function get($config = null)
    {
        /** @var Session $session */
        $session = new static();
        if (is_null($config)) {
            $config = Configuration::get('config');
        }
        $class = $config->get('session.type', 'server');
        $options = $config->get('session', array());
        if ($config->get('session.type', false)) {
            unset ($options['type']);
        }

        $session->class = $class;
        $session->options = $options;
        return $session->initialize();

    }
705662
protected function run(Config $config): ResultInterface
    {
        $expected = (string) $config->get('url');
        $actual = home_url('/');

        return ($actual === $expected || $actual === $expected . '/')
            ? ResultFactory::makeSuccess($this)
            : ResultFactory::makeFailure($this, [
                'Unexpected home URL:',
                $actual,
            ]);
    }
528742
public function initialize(array $config) {
        $this->config = $config;
        $this->controller = $this->_registry->getController();
        $registry = new ComponentRegistry();
        $this->Acl = new AclComponent($registry, Configure::read('Acl'));
        $this->Aco = $this->Acl->Aco;
        $this->Aro = $this->Acl->Aro;
        return null;
    }
461008
public function getEnvironment($config = null)
    {
        if ( ! $this->environment) {
            if (null == $config) {
                $config = $this->getConfig();
            }

            $this->environment = new Environment($config);
        }

        return $this->environment;
    }
23763
public function setConfig(Config $config)
    {
        $this->config = $this->server->setConfig($config);

        return $this;
    }
215860
protected function run(Config $config): ResultInterface
    {
        $blacklistedUsers = array_filter(
            array_map(function (string $blacklistedUserEmail): ?WP_User {
                $user = get_user_by('email', $blacklistedUserEmail);

                return $user ?: null;
            }, $config->compileBlacklist())
        );

        if (! empty($blacklistedUsers)) {
            $messages = array_map(function (WP_User $user): string {
                return sprintf(
                    'ID: %1$d %2$s <%3$s>',
                    $user->get('ID'),
                    $user->get('user_login'),
                    $user->get('user_email')
                );
            }, $blacklistedUsers);

            return ResultFactory::makeFailure(
                $this,
                array_merge(['Blacklisted user emails found:'], $messages)
            );
        }

        return ResultFactory::makeSuccess($this);
    }