src/mako/error/handlers/web/traits/HandlerHelperTrait.php
protected function returnAs(string $function, array $mimes, string $partial)
	{
		if(function_exists($function))
		{
			$responseType = $this->response->getType();

			if(in_array($responseType, $mimes) || strpos($responseType, $partial) !== false)
			{
				return true;
			}

			$accepts = $this->request->getHeaders()->getAcceptableContentTypes();

			if(isset($accepts[0]) && (in_array($accepts[0], $mimes) || strpos($accepts[0], $partial) !== false))
			{
				return true;
			}
		}

		return false;
	}
protected function returnAs(string $function, array $mimes, string $partial)
	{
		if(function_exists($function))
		{
			$responseType = $this->response->getType();

			if(in_array($responseType, $mimes) || strpos($responseType, $partial) !== false)
			{
				return true;
			}

			$accepts = $this->request->getHeaders()->getAcceptableContentTypes();

			if(isset($accepts[0]) && (in_array($accepts[0], $mimes) || strpos($accepts[0], $partial) !== false))
			{
				return true;
			}
		}

		return false;
	}
protected function returnAs ( string $ function , array $ mimes , string $ partial ) { if ( function_exists ( $ function ) ) { $ responseType = $ this -> response -> getType ( ) ; if ( in_array ( $ responseType , $ mimes ) || strpos ( $ responseType , $ partial ) !== false ) { return true ; } $ accepts = $ this -> request -> getHeaders ( ) -> getAcceptableContentTypes ( ) ; if ( isset ( $ accepts [ 0 ] ) && ( in_array ( $ accepts [ 0 ] , $ mimes ) || strpos ( $ accepts [ 0 ] , $ partial ) !== false ) ) { return true ; } } return false ; }
Checks if we meet the requirements to return as a specific type.

@param  string $function Required function
@param  array  $mimes    Mimetypes
@param  string $partial  Partial mimetype
@return bool
Checks if we meet the requirements to return as a specific type .