lithium\net\http\Route::_matchKeys()

protected method

A helper method used by match() to verify that options required to match this route are present in a URL array.

Parameters

  • array $options

    An array of URL parameters.

Returns

mixed

On success, returns an updated array of options, merged with defaults. On failure, returns false.

Source

	protected function _matchKeys($options) {
		$args = array('args' => 'args');

		$scope = array();
		if (!empty($options['scope'])) {
			$scope = (array) $options['scope'] + array('params' => array());
			$scope = array_flip($scope['params']);
		}
		unset($options['scope']);

		if (array_intersect_key($options, $this->_match) != $this->_match) {
			return false;
		}
		if ($this->_config['continue']) {
			if (array_intersect_key($this->_keys, $options + $args) != $this->_keys) {
				return false;
			}
		} else {
			if (array_diff_key($options, $this->_match + $this->_keys + $scope)) {
				return false;
			}
		}
		$options += $this->_defaults;
		$base = $this->_keys + $args;
		$match = array_intersect_key($this->_keys, $options) + $args;
		sort($base);
		sort($match);

		if ($base !== $match) {
			return false;
		}
		return $options;
	}