执行监听行为

@param mixed $behavior 标签行为
@param mixed $params   行为参数
@param mixed $extra    额外行为参数
@return mixed
767726
public static function exec($behavior, $params = null, $extra = null)
    {
        if ($behavior instanceof \Closure) {
            $result = call_user_func_array($behavior, [$params, $extra]);
        } else if (is_callable($behavior)) {
            $result = call_user_func_array($behavior, [$params, $extra]);
        } else {
            $obj = new $behavior;
            $obj->run($params, $extra);
        }

        return $result;
    }
995149
public function getMultiCount($collection, $column, array $values, array $extra = array())
	{
		$queryParts = ['SELECT COUNT(*) FROM', $collection, 'WHERE', "$column IN (?)"];

		foreach ($extra as $key => $extraValue) {
			$queryParts[] = "AND $key = ?";
		}

		$query = $this->createQueryFrom($queryParts);
		$query->setParameter(1, implode(',', $values));

		foreach ($extra as $key => $extraValue) {
			$query->setParameter($key + 2, $extraValue);
		}

		return $query->count();
	}
1220504
public function cmd(Query $query, $command, $extra = null, $db = null)
    {
        if (is_array($command) || is_object($command)) {
            if ($this->getConfig('debug')) {
                $this->log('cmd', 'cmd', $command);
            }

            // 直接创建Command对象
            $command = new Command($command);
        } else {
            // 调用Builder封装的Command对象
            $command = $this->builder->$command($query, $extra);
        }

        return $this->command($command, $db);
    }
1019328
public function delete( Page $page, array $extraParams = [] ) {
		$this->api->postRequest( new SimpleRequest(
			'delete',
			$this->getDeleteParams( $page->getPageIdentifier(), $extraParams )
		) );
		return true;
	}
825948
public function proceed($params = [])
    {
        // before
        if (isset($this->advice['before']) && !empty($this->advice['before'])) {
            list($aspectClass, $aspectMethod) = $this->advice['before'];
            $aspect = App::getBean($aspectClass);
            $aspect->$aspectMethod();
        }

        if (empty($this->advices)) {
            // execute
            $methodParams = !empty($params) ? $params : $this->args;
            $result       = $this->target->{$this->method}(...$methodParams);
        } else {
            /* @var \Swoft\Aop\Aop $aop */
            $aop    = App::getBean(Aop::class);
            $result = $aop->doAdvice($this->target, $this->method, $this->args, $this->advices);
        }

        return $result;
    }
534479
public function execute($params = null) {
		if ($params === null) {
			$params = [];
		}

		try {
			$this->stmt->execute($params);

			return new QueryResult($this->stmt, $this->pdo);
		} catch (PDOException $e) {
			throw $this->exAdapter->adapt($e, $this->stmt, $params);
		}
	}
650436
public function getService(string $key, ServiceLocatorInterface $serviceLocator, array $extra = null): object
    {
        return $this->getClosures()[$key]($key, $serviceLocator, $extra);
    }
1355394
protected static function runCommands($event, $extraKey)
    {
        $params = $event->getComposer()->getPackage()->getExtra();
        if (isset($params[$extraKey]) && is_array($params[$extraKey])) {
            foreach ($params[$extraKey] as $method => $args) {
                call_user_func_array([__CLASS__, $method], (array) $args);
            }
        }
    }
1215211
public static function listen($tag, $params = null, $extra = null)
    {
        $result = true;

        if (isset(self::$tags[$tag])) {
            foreach (self::$tags[$tag] as $behaviors) {
                $result = self::exec($behaviors, $params, $extra);

                if ($result === false) {
                    return $result;
                }
            }
        }

        return $result;
    }
1318102
public function cmd($command, $extra = null, $db = null)
    {
        if (is_array($command) || is_object($command)) {
            if ($this->connection->getConfig('debug')) {
                $this->connection->log('cmd', 'cmd', $command);
            }
            // 直接创建Command对象
            $command = new Command($command);
        } else {
            // 调用Builder封装的Command对象
            $options = $this->parseExpress();
            $command = $this->builder->$command($options, $extra);
        }
        return $this->command($command, $db);
    }
1273693
public function invoke( $args, $assoc_args, $extra_args ) {

		if ( 'help' !== $this->name ) {
			static $prompted_once = false;

			if ( \WP_CLI::get_config( 'prompt' ) && ! $prompted_once ) {
				list( $_args, $assoc_args ) = $this->prompt_args( $args, $assoc_args );
				$args                       = array_merge( $args, $_args );
				$prompted_once              = true;
			}
		}

		$extra_positionals = array();
		foreach ( $extra_args as $k => $v ) {
			if ( is_numeric( $k ) ) {
				if ( ! isset( $args[ $k ] ) ) {
					$extra_positionals[ $k ] = $v;
				}
				unset( $extra_args[ $k ] );
			}
		}
		$args += $extra_positionals;

		list( $to_unset, $args, $assoc_args, $extra_args ) = $this->validate_args( $args, $assoc_args, $extra_args );

		foreach ( $to_unset as $key ) {
			unset( $assoc_args[ $key ] );
		}

		$path   = get_path( $this->get_parent() );
		$parent = implode( ' ', array_slice( $path, 1 ) );
		$cmd    = $this->name;
		if ( $parent ) {
			WP_CLI::do_hook( "before_invoke:{$parent}" );
			$cmd = $parent . ' ' . $cmd;
		}
		WP_CLI::do_hook( "before_invoke:{$cmd}" );

		call_user_func( $this->when_invoked, $args, array_merge( $extra_args, $assoc_args ) );

		if ( $parent ) {
			WP_CLI::do_hook( "after_invoke:{$parent}" );
		}
		WP_CLI::do_hook( "after_invoke:{$cmd}" );
	}
450776
private function show($process, $extra)
    {
        $path = $this->name($extra);

        $this->title('New View command :');
        //
        if ($process == 1) {
            $this->info("\nThe view was created");
            $this->comment(" -> Path : resources/views/$path\n");
        } elseif ($process == 2) {
            $this->error('The view is already existe');
        } elseif ($process == 3) {
            $this->error('Failed to create directories ...');
        }
    }
1011238
public function get_sql_filter($extra='', array $params=null) {
        global $SESSION;

        $sqls = array();
        if ($extra != '') {
            $sqls[] = $extra;
        }
        $params = (array)$params;

        if (!empty($SESSION->user_filtering)) {
            foreach ($SESSION->user_filtering as $fname => $datas) {
                if (!array_key_exists($fname, $this->_fields)) {
                    continue; // Filter not used.
                }
                $field = $this->_fields[$fname];
                foreach ($datas as $i => $data) {
                    list($s, $p) = $field->get_sql_filter($data);
                    $sqls[] = $s;
                    $params = $params + $p;
                }
            }
        }

        if (empty($sqls)) {
            return array('', array());
        } else {
            $sqls = implode(' AND ', $sqls);
            return array($sqls, $params);
        }
    }
988833
private function _action($params)
    {
        // Shift and get the method
        $method = array_shift($params);

        // Behavior
        if ($this->behaviors[$method]) {
            $this->behaviors[$method]();
        }

        if (!isset($this->routes[$method])) {
            $this->_defaultAction();
        }

        // Get corresponding method name
        $method = $this->routes[$method];

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

        return call_user_func_array([$this, $method], $params);
    }
299980
public function extractMeaning($query, $extraParams = [])
    {
        $query = array_merge($extraParams, [
            'lang' => $this->client->getApiLanguage(),
            'query' => $query,
        ]);

        $response = $this->client->post('query', $query);

        return $this->decodeResponse($response);
    }
237045
public function cmd($command, $extra = null, $db = null)
    {
        return $this->connection->cmd($this, $command, $extra, $db);
    }
736629
public function returnSuccess($message = '操作成功', $url = '', $extra = [])
    {
        if (! empty($this->redirectRoute)) {
            $url = Url::toRoute([
                $this->redirectRoute,
                'msg' => $message,
                'url' => $url,
                $extra
            ]);
        }
        $this->redirect($url);
    }