src/Routing/ControllerDispatcher.php
/**
	 * Creates a service-bound callable for the given action.
	 *
	 * @param string|callable $action
	 * @return BoundCallable
	 * @throws Exception
	 */
Creates a service-bound callable for the given action.
@param string|callable $action
@return BoundCallable
@throws Exception
Creates a service - bound callable for the given action . @param string|callable $action @return BoundCallable @throws Exception
protected function createBoundCallable($action) {
		$action = $this->createInstance($action);
		$callable = new BoundCallable($action, Application::container());
		$callable->with($this->route);
		$callable->with($this->request);
		$callable->with($this->response);
		if (!is_null($this->request)) {
			foreach ($this->request->attributes->all() as $name => $value) {
				if (is_object($value)) {
					$callable->with($value);
				}
				$callable->where($name, $value);
			}
		}
		if (!is_null($this->route)) {
			foreach ($this->route->parameterNames() as $name) {
				$value = $this->route->parameter($name);
				if (!is_null($value)) {
					$callable->where($name, $value);
				}
			}
		}
		if (!is_null($this->request)) {
			foreach ($this->request->query->all() as $name => $value) {
				if (!$callable->has($name)) {
					$callable->where($name, $value);
				}
			}
		}
		return $callable;
	}
protected function createBoundCallable ( $ action ) { $ action = $ this -> createInstance ( $ action ) ; $ callable = new BoundCallable ( $ action , Application :: container ( ) ) ; $ callable -> with ( $ this -> route ) ; $ callable -> with ( $ this -> request ) ; $ callable -> with ( $ this -> response ) ; if ( ! is_null ( $ this -> request ) ) { foreach ( $ this -> request -> attributes -> all ( ) as $ name => $ value ) { if ( is_object ( $ value ) ) { $ callable -> with ( $ value ) ; } $ callable -> where ( $ name , $ value ) ; } } if ( ! is_null ( $ this -> route ) ) { foreach ( $ this -> route -> parameterNames ( ) as $ name ) { $ value = $ this -> route -> parameter ( $ name ) ; if ( ! is_null ( $ value ) ) { $ callable -> where ( $ name , $ value ) ; } } } if ( ! is_null ( $ this -> request ) ) { foreach ( $ this -> request -> query -> all ( ) as $ name => $ value ) { if ( ! $ callable -> has ( $ name ) ) { $ callable -> where ( $ name , $ value ) ; } } } return $ callable ; }
Creates a service-bound callable for the given action.
Creates a service - bound callable for the given action .
// Convert the action to a callable if necessary // Create a new service-bound callable // Add our basic objects for dependency resolution // Add attribute objects // Add variables from the route // Add GET variables