lithium\data\source\Http::__call()

public method

Pass methods to service connection. Path and method are determined from Http::$_method. If not set, a GET request with the $method as the path will be used.

Parameters

  • string $method
  • array $params

Returns

mixed

Filter

This method can be filtered.

Source

	public function __call($method, $params) {
		if (!isset($this->_methods[$method])) {
			if (method_exists($this->connection, $method)) {
				return call_user_func_array(array($this->connection, $method), $params);
			}
			$this->_methods[$method] = ['path' => "/{$method}"];
		}
		$params += [[], []];

		if (!is_object($params[0])) {
			$config = (array) $params[0];

			if (count($config) === count($config, COUNT_RECURSIVE)) {
				$config = ['data' => $config];
			}
			$params[0] = new Query($this->_methods[$method] + $config);
		}
		$params[0] = new Query($params[0]->export($this) + $this->_methods[$method]);

		return Filters::run($this, $method, $params, function($params) {
			list($query, $options) = $params;
			return $this->send($query, $options);
		});
	}