lithium\core\Libraries::_params()

protected static method

Get params from type.

Parameters

  • string $type
  • string $name

    default: '*'

Returns

array

type, namespace, class, name

Source

	protected static function _params($type, $name = "*") {
		if (!$name) {
			$name = '*';
		}
		$library = $namespace = $class = '*';

		if (strpos($type, '.') !== false) {
			$parts = explode('.', $type);
			$type = array_shift($parts);

			switch (count($parts)) {
				case 1:
					list($class) = $parts;
				break;
				case 2:
					list($namespace, $class) = $parts;
				break;
				default:
					$class = array_pop($parts);
					$namespace = join('\\', $parts);
				break;
			}
		}
		if (strpos($name, '.') !== false) {
			$parts = explode('.', $name);
			$library = array_shift($parts);
			$name = array_pop($parts);
			$namespace = $parts ? join('\\', $parts) : "*";
		}
		return compact('library', 'namespace', 'type', 'class', 'name');
	}