执行验证

@return bool
492276
public function validate()
    {
        foreach ($this->_validations as $v) {
            foreach ($v['attributes'] as $field) {
                list($values, $multiple) = $this->getPart($this->attributes, explode('.', $field));
                // 如果字段没有指定required规则, 或者为空, 不验证
                if ($v['rule'] !== 'required' && !$this->hasRule('required', $field) && (!isset($values) || $values === '' || ($multiple && count($values) == 0))) {
                    continue;
                }
                $callback = static::getRuleCallback($v['rule']);
                if (!$multiple) {
                    $values = [$values];
                }
                $result = true;
                foreach ($values as $value) {
                    $result = $result && call_user_func($callback, $field, $value, $v['params'], $this);
                }
                if (!$result) {
                    $this->addError($field, $v['message'], $v['params']);
                }
            }
        }
        return count($this->errors()) === 0;
    }
529136
public function run()
    {
        /* @var $model Model */
        $model = Yii::createObject($this->modelClass);
        $event = Yii::createObject(['class' => FormEvent::class, 'form' => $model]);

        if ($model->load(Yii::$app->request->post()) && $model->validate()) {
            $this->trigger(self::EVENT_BEFORE_SAVE, $event);

            $this->saveSettings($model);

            $this->trigger(self::EVENT_AFTER_SAVE, $event);

            if ($this->successMessage !== null) {
                Yii::$app->session->setFlash('success', $this->successMessage);
            }

            return $this->controller->refresh();
        }

        $this->prepareModel($model);

        return $this->controller->render($this->view, ArrayHelper::merge($this->viewParams, [
            'model' => $model,
        ]));
    }
1117489
public function run() {
        // Use the global $argv variable to retrieve command-line arguments
        global $argv;
        
        // index[0] is the script name and index[1] is the command name
        if (isset($argv[1])) {
            // Get the command through map
            $commandName = strtolower($argv[1]);

            if (isset($this->_commands[$commandName])) {
                $cmd = $this->_commands[$commandName];

                // Execute the command
                return call_user_func($cmd, $this->_input, $this->_output);
            } else {
                // Command not found
                exit('Command not found: "' . $commandName . '"' . PHP_EOL);
            }
        }

        // Call the default command if set
        if (!is_null($this->_default) && is_callable($this->_default)) {
            return call_user_func($this->_default, $this->_input, $this->_output);
        }
    }
328176
public function run()
    {
        try {
            return $this
                ->preRun()
                ->check();
        } catch (Exception $e) {
            return $this
                ->setMessage($e->getMessage())
                ->setCode($e->getCode());
        }
    }
363712
public function execute()
    {
        $path_plain      = $this->getPlainPath();
        $path_obfuscated = $this->getObfuscatedPath();
        $path_backup     = $this->getBackupPath();

        if ($this->isStopped() == true) {
            return false;
        }

        $ob = $this->getObfuscator();
        $ob->setUnpackFile('App.php');

        if ($ob->obfuscateDirectory($path_plain) == false) {
            return false;
        }

        if ($ob->makeDir($path_obfuscated) == false) {
            return false;
        }

        if($ob->saveDirectory($path_obfuscated) == false) {
            return false;
        }

        if ($this->makeBackup() == false) {
            return false;
        }

        if ($this->setupComposer() == false) {
            return false;
        }

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

        $matches = [];
        if (preg_match_all('/(?:(?:\A|[^\d])0x[a-f\d]{3,}[a-f\d]*)+/im', $this->value, $matches)) {
            foreach ($matches[0] as $match) {
                $converted = '';
                foreach (str_split($match, 2) as $hexIndex) {
                    if (preg_match('/[a-f\d]{2,3}/i', $hexIndex)) {
                        $converted .= chr(hexdec($hexIndex));
                    }
                }
                $this->value = str_replace($match, $converted, $this->value);
            }
        }
        // take care of hex encoded ctrl chars
        $this->value = preg_replace('/0x\d+/m', ' 1 ', $this->value);

        return $this->value;
    }
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;
    }
831259
public function run()
    {
        if (! $this->runPreSearch()) {
            return $this->value;
        }

        if (! preg_match('/[%\\\]u([0-9a-fA-F]{4})/U', $this->value)) {
            return $this->value;
        }

        preg_match_all('/[%\\\]u[0-9a-f]{4}/ims', $this->value, $matches);
        if (! empty($matches[0])) {
            foreach ($matches[0] as $match) {
                $unicode = str_replace('%u', '\\u', $match);
                //echo $unicode;exit;
                $unicode     = json_decode('["'.$unicode.'"]');
                $this->value = str_replace($match, $unicode[0], $this->value);
            }
            $this->value .= "\n\u0001";
        }

        return $this->value;
    }
716604
public function run()
    {
        foreach ($this->routes as $path => $action) {
            if ($this->uri == $path) {
                return $this->executeAction($action);
            }
        }

        return $this->executeError404();
    }
286859
public function run()
    {
        Url::remember();
        $dataProvider = $this->searchModel->singleSearch(Yii::$app->request->queryParams, $this->query);

        return $this->controller->render($this->view, array_merge([
            'searchModel' => $this->searchModel,
            'dataProvider' => $dataProvider,
        ], $this->params));
    }
816952
public function execute()
    {
        $stmt = $this->pdo->prepare($this->build());

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

            return $stmt;
        } else {
            return false;
        }
    }
497254
public function execute()
    {
        $command = $this->getExecCommand();

        if (!$command) {
            return false;
        }

        if ($this->useExec) {
            $execCommand = $this->captureStdErr ? "$command 2>&1" : $command;
            exec($execCommand, $output, $this->_exitCode);
            $this->_stdOut = implode("\n", $output);
            if ($this->_exitCode!==0) {
                $this->_stdErr = $this->_stdOut;
                $this->_error = empty($this->_stdErr) ? 'Command failed' : $this->_stdErr;
                return false;
            }
        } else {
            $descriptors = array(
                1   => array('pipe','w'),
                2   => array('pipe', $this->getIsWindows() ? 'a' : 'w'),
            );
            if ($this->_stdIn!==null) {
                $descriptors[0] = array('pipe', 'r');
            }

            $process = proc_open($command, $descriptors, $pipes, $this->procCwd, $this->procEnv, $this->procOptions);

            if (is_resource($process)) {

                if ($this->_stdIn!==null) {
                    if (is_resource($this->_stdIn) &&
                        in_array(get_resource_type($this->_stdIn), array('file', 'stream'), true)) {
                        stream_copy_to_stream($this->_stdIn, $pipes[0]);
                    } else {
                        fwrite($pipes[0], $this->_stdIn);
                    }
                    fclose($pipes[0]);
                }
                $this->_stdOut = stream_get_contents($pipes[1]);
                $this->_stdErr = stream_get_contents($pipes[2]);
                fclose($pipes[1]);
                fclose($pipes[2]);

                $this->_exitCode = proc_close($process);

                if ($this->_exitCode!==0) {
                    $this->_error = $this->_stdErr ? $this->_stdErr : "Failed without error message: $command";
                    return false;
                }
            } else {
                $this->_error = "Could not run command $command";
                return false;
            }
        }

        $this->_executed = true;

        return true;
    }
533361
public function run() {
        $results = [
            $this->simulateDelete(),
            $this->simulateUpdate(),
            $this->simulateCreate()
        ];
        
        return array_search(false, $results, true) === false;
    }
1307471
public function run()
    {
        if (! $this->runPreSearch()) {
            return $this->value;
        }

        if (preg_match_all('/(?:\%23.*?\%0a)/im', $this->value, $matches)) {
            $converted = $this->value;
            foreach ($matches[0] as $match) {
                $converted = str_replace($match, ' ', $converted);
            }
            $this->value .= "\n".$converted;
        }

        return $this->value;
    }
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;
    }
393069
public function run()
    {
        /* @var $model \yii\db\ActiveRecord */
        $model = new $this->modelClass();
        if ($this->scenario) {
            $model->setScenario($this->scenario);
        }
        if ($model->load(Yii::$app->request->post()) && $model->validate()) {
            foreach ($model->toArray() as $key => $value) {
                //Yii::$app->settings->set($key, $value, $this->controller->module->id, $model->types[$key]);
                Yii::$app->settings->set($key, $value, $model->formName(), $model->types[$key]);
            }
            Yii::$app->getSession()->addFlash('success', Yii::t('system', 'Successfully saved settings.'));
            return $this->controller->redirect([$this->controller->action->id]);
        }
        foreach ($model->attributes() as $key) {
            $model->{$key} = Yii::$app->settings->get($key, $model->formName());
            //$model->{$key} = Yii::$app->settings->get($key, $this->controller->module->id);//直接使用模块ID
        }
        return $this->controller->render($this->viewName, ['model' => $model]);
    }
803819
public function run()
    {
        $route = $this->getRoute();
        $method = $this->getActionMethod(isset($route->action) ? $route->action : 'default');

        if (!method_exists($this, $method)) {
            return $this->notFound();
        }

        $this->before();
        
        if (!$this->isCancelled()) {
            $args = isset($route->args) ? $route->args
                : $this->getFunctionArgs($route, new \ReflectionMethod($this, $method)); 

            call_user_func_array([$this, $method], $args);
        }
        
        $this->after();
    }