执行校验并返回布尔值

@return boolean
198669
public function validate()
    {
        foreach ($this->dateBindRule as $bind) {
            foreach ($bind['field'] as $field) {
                if (strpos($field, '.')) {
                    $values = Cml::doteToArr($field, $this->data);
                } else {
                    $values = isset($this->data[$field]) ? $this->data[$field] : null;
                }

                if (isset(static::$rules[$bind['rule']])) {
                    $callback = static::$rules[$bind['rule']];
                } else {
                    $callback = [$this, 'is' . ucfirst($bind['rule'])];
                }

                $result = true;
                if ($bind['rule'] == 'arr') {
                    $result = call_user_func($callback, $values, $bind['params'], $field);
                } else {
                    is_array($values) || $values = [$values];// GET|POST的值为数组的时候每个值都进行校验
                    foreach ($values as $value) {
                        $result = $result && call_user_func($callback, $value, $bind['params'], $field);
                        if (!$result) {
                            break;
                        }
                    }
                }

                if (!$result) {
                    $this->error($field, $bind);
                }
            }
        }

        return count($this->getErrors()) === 0;
    }
313010
public function run()
    {
        $result = $this->getCommand()->run();

        if ($result->getExitCode() != 0) {
            throw new \RuntimeException(sprintf(
                'Command failed. Exit code %d, output %s',
                $result->getExitCode(),
                $result->getStdErr()));
        }

        return $this->parse($result->getStdOut());
    }
318308
public function coroutineRun(): bool
    {
        // $ch = new Coroutine\Channel(1);
        $ok = Coroutine::create(function () {
            $this->execute($this->input, $this->output);
            // $ch->push($result);
        });

        // create co fail:
        if ((int)$ok === 0) {
            // if open debug, output a tips
            if ($this->isDebug()) {
                $this->output->warning('The coroutine create failed!');
            }

            // exec by normal flow
            $result = $this->execute($this->input, $this->output);
        } else { // success: wait coroutine exec.
            Event::wait();
            $result = 0;
            // $result = $ch->pop(10);
        }

        return $result;
    }
816952
public function execute()
    {
        $stmt = $this->pdo->prepare($this->build());

        if ($stmt->execute($this->getValues())) {
            $this->rowCount = $stmt->rowCount();

            return $stmt;
        } else {
            return false;
        }
    }
219280
public function run()
    {
        if (is_object($this->connection())) {
            try {
                $stmt = $this->connection()->prepare($this->schema);

                if ($this->checkSchemaExistence) {
                    return $stmt->rowCount();
                } elseif ($return = $stmt->execute()) {
                    return $return;
                } else {
                    return false;
                }
            } catch (\PDOException $e) {
                throw new \Exception($e->getMessage());
            }
        }
    }
1034211
public function execute()
    {
        if ($this->executed) {
            return true;
        }
      
        $check = $this->checkInputs();
        
        if (!$check) {
            return false;
        }
        
        $request = new Request(Request::POST);
        $request->setHost($this->app->getHost())
            ->setEndpoint(self::ENDPOINT)
            ->setCredentials($this->app->getAppId(), $this->app->getSecretKey());
        
        $result = $request->send(
            [
                "request_id" => $this->requestId,
                "connect_id" => $this->connectId,
                "auth_code" => $this->getParam("code")
            ]
        );
        
        $data = $result->getData();
        
        if (!(isset($data["access_token"]) && isset($data["expiration"]))) {
            throw new EndpointException("Invalid result structure: " . $result->getBody());
        }
        
        $this->accessToken = $data["access_token"];
        $this->accessTokenExpiration = $data["expiration"];
        $this->grantedScope = isset($data["scope"]) ? $data["scope"] : [];
        $this->executed = true;
        
        return true;
    }
804435
public function Run()
    {
        $bSuccess = false;

        set_time_limit(1800);
        TCacheManager::SetDisableCaching(true);
        TCacheManagerRuntimeCache::SetEnableAutoCaching(false);
        if ($this->Prepare()) {
            $bSuccess = $this->Perform();
        }
        $this->Cleanup($bSuccess);
        TCacheManager::SetDisableCaching(false);
        TCacheManagerRuntimeCache::SetEnableAutoCaching(true);

        return $bSuccess;
    }
427770
public function execute()
    {
        try {
            $opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
            $pdo  = new PDO('mysql:host=' . $this->host, $this->user, $this->pass, $opts);

            foreach ($this->queries as $query) {
                if (!is_array($query)) {
                    // Simple query
                    $pdo->query($this->phpci->interpolate($query));
                } elseif (isset($query['import'])) {
                    // SQL file execution
                    $this->executeFile($query['import']);
                } else {
                    throw new \Exception(Lang::get('invalid_command'));
                }
            }
        } catch (\Exception $ex) {
            $this->phpci->logFailure($ex->getMessage());
            return false;
        }
        return true;
    }
1207581
public function isRunning() {
		if( !$this->pid ) {
			return false;
		}

		$result = shell_exec(sprintf('ps %d',
			$this->pid));
		if( count(preg_split("/\n/", $result)) > 2 ) {
			return true;
		}

		return false;
	}
328176
public function run()
    {
        try {
            return $this
                ->preRun()
                ->check();
        } catch (Exception $e) {
            return $this
                ->setMessage($e->getMessage())
                ->setCode($e->getCode());
        }
    }
111362
public function run()
	{
		$null = null;
		$this->db =& ConnectionManager::getDataSource($this->connection);
		$this->db->cacheSources = false;
		$this->db->begin($null);

		if (!isset($this->args[0]) || !in_array($this->args[0], array('insert', 'remove'))) {
			$this->out(__d('Auditable', 'Invalid option'));
			return $this->_displayHelp(null);
		}

		try {
			$this->_run($this->args[0]);
			$this->_clearCache();

		} catch (Exception $e) {
			$this->db->rollback($null);
			throw $e;
		}

		return $this->db->commit($null);

		$this->out(__d('Auditable', 'All tables are updated.'));
		$this->out('');
		return true;
	}
1003588
public function start()
    {
        $httpServer = $this->getHttpServer();

        // 是否正在运行
        if ($httpServer->isRunning()) {
            $serverStatus = $httpServer->getServerSetting();

            \output()->writeln("<error>The server have been running!(PID: {$serverStatus['masterPid']})</error>", true, true);
        } else {
            $serverStatus = $httpServer->getServerSetting();
        }

        // 启动参数
        $this->setStartArgs($httpServer);
        $httpStatus = $httpServer->getHttpSetting();
        $tcpStatus = $httpServer->getTcpSetting();

        // Setting
        $workerNum = $httpServer->setting['worker_num'];

        // HTTP 启动参数
        $httpHost = $httpStatus['host'];
        $httpPort = $httpStatus['port'];
        $httpMode = $httpStatus['mode'];
        $httpType = $httpStatus['type'];

        // TCP 启动参数
        $tcpEnable = $serverStatus['tcpable'];
        $tcpHost = $tcpStatus['host'];
        $tcpPort = $tcpStatus['port'];
        $tcpType = $tcpStatus['type'];
        $tcpEnable = $tcpEnable ? '<info>Enabled</info>' : '<warning>Disabled</warning>';

        // 信息面板
        $lines = [
            '                         Server Information                      ',
            '********************************************************************',
            "* HTTP | host: <note>$httpHost</note>, port: <note>$httpPort</note>, type: <note>$httpType</note>, worker: <note>$workerNum</note>, mode: <note>$httpMode</note>",
            "* TCP  | host: <note>$tcpHost</note>, port: <note>$tcpPort</note>, type: <note>$tcpType</note>, worker: <note>$workerNum</note> ($tcpEnable)",
            '********************************************************************',
        ];

        // 启动服务器
        \output()->writeln(implode("\n", $lines));
        $httpServer->start();
    }
939009
public function execute()
    {
        $this->phpci->quiet = true;
        $success = true;

        $php = $this->phpci->findBinary('php');

        foreach ($this->directories as $dir) {
            if (!$this->lintDirectory($php, $dir)) {
                $success = false;
            }
        }

        $this->phpci->quiet = false;

        return $success;
    }
1311193
public function run()
    {
        if (!$this->validate()) {
            return false;
        }

        return DB::transaction(function() {
            $events = $this->getDeferedEvents();

            foreach ($events as $event) {
                if (!empty($event->value)) {
                    continue;
                }

                $event->value = Event::fire($event->name);
                $event->save();
            }
        });
    }
1005479
public function run()
    {
        // TODO: Implement run() method.
        switch ($_SERVER['REQUEST_METHOD']) {
            case 'GET':
                return $this->get($this->params);
            case 'POST':
                return $this->post($this->params);
            case 'PUT':
                return $this->put($this->params);
            case 'DELETE':
                return $this->delete($this->params);
        }
    }
1235979
public function run()
    {
        // If the truthTest failed, don't run
        if ($this->truthTest !== true) {
            return false;
        }

        // If overlapping, don't run
        if ($this->isOverlapping()) {
            return false;
        }

        $compiled = $this->compile();

        // Write lock file if necessary
        $this->createLockFile();

        if (is_callable($this->before)) {
            call_user_func($this->before);
        }

        if (is_callable($compiled)) {
            $this->output = $this->exec($compiled);
        } else {
            exec($compiled, $this->output, $this->returnCode);
        }

        $this->finalise();

        return true;
    }
500535
public function run()
    {
        if (! $this->runPreSearch()) {
            return $this->value;
        }

        if (! preg_match('/%([0-9a-fA-F]{2})/U', $this->value)) {
            return $this->value;
        }
        //keep nullbyte to be detected later
        $this->value = str_replace('%00', '[sh_null]', $this->value);
        $this->value = rawurldecode($this->value);
        $this->value = str_replace('[sh_null]', '%00', $this->value);

        return $this->value;
    }