public function prefers( $contentTypes )
	{
		$accepts = $this->getAcceptableContentTypes();

		$contentTypes = (array) $contentTypes;

		foreach ( $accepts as $accept )
		{
			if ( in_array( $accept, ['*/*', '*'] ) )
				return $contentTypes[0];

			foreach ( $contentTypes as $contentType )
			{
				$type = $contentType;

				if ( !is_null( $mimeType = $this->getMimeType( $contentType ) ) )
					$type = $mimeType;

				if ( $this->matchesType( $type, $accept ) || $accept === strtok( $type, '/' ) . '/*' )
					return $contentType;
			}
		}
	}
public function prefers( $contentTypes )
	{
		$accepts = $this->getAcceptableContentTypes();

		$contentTypes = (array) $contentTypes;

		foreach ( $accepts as $accept )
		{
			if ( in_array( $accept, ['*/*', '*'] ) )
				return $contentTypes[0];

			foreach ( $contentTypes as $contentType )
			{
				$type = $contentType;

				if ( !is_null( $mimeType = $this->getMimeType( $contentType ) ) )
					$type = $mimeType;

				if ( $this->matchesType( $type, $accept ) || $accept === strtok( $type, '/' ) . '/*' )
					return $contentType;
			}
		}
	}
public function prefers ( $ contentTypes ) { $ accepts = $ this -> getAcceptableContentTypes ( ) ; $ contentTypes = ( array ) $ contentTypes ; foreach ( $ accepts as $ accept ) { if ( in_array ( $ accept , [ '*/*' , '*' ] ) ) return $ contentTypes [ 0 ] ; foreach ( $ contentTypes as $ contentType ) { $ type = $ contentType ; if ( ! is_null ( $ mimeType = $ this -> getMimeType ( $ contentType ) ) ) $ type = $ mimeType ; if ( $ this -> matchesType ( $ type , $ accept ) || $ accept === strtok ( $ type , '/' ) . '/*' ) return $ contentType ; } } }
Return the most suitable content type from the given array based on content negotiation.

@param  string|array $contentTypes
@return string|null
Return the most suitable content type from the given array based on content negotiation .