Sets/Gets the content type

Parameters

  • string $type a full content type i.e. `'application/json'` or simple name `'json'`

Returns

string A simple content type name, i.e. `'html'`, `'xml'`, `'json'`, etc., depending on the content type of the request.

Source

						public function type($type = null) {
		if ($type == null && $type !== false) {
			return $this->_type;
		}
		if (strpos($type, '/')) {
			$media = $this->_classes['media'];

			if (!$data = $media::type($type)) {
				return $this->_type;
			}
			$type = is_array($data) ? reset($data) : $data;
		}
		return $this->_type = $type;
	}