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 $this->connection->invokeMethod($method, $params);
			}
			$this->_methods[$method] = array('path' => "/{$method}");
		}
		$params += array(array(), array());

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

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

		return $this->_filter(__CLASS__ . "::" . $method, $params, function($self, $params) {
			list($query, $options) = $params;
			return $self->send($query, $options);
		});
	}