/** * Maps a content-type back to an alias * * @param string|array $cType Either a string content type to map, or an array of types. * @return string|array Aliases for the types provided. * @deprecated Use $this->response->mapType() in your controller instead. */ public function mapType($cType) { return $this->response->mapType($cType); }
/** * Tests the mapType method * */ public function testMapType() { $response = new CakeResponse(); $this->assertEquals('wav', $response->mapType('audio/x-wav')); $this->assertEquals('pdf', $response->mapType('application/pdf')); $this->assertEquals('xml', $response->mapType('text/xml')); $this->assertEquals('html', $response->mapType('*/*')); $this->assertEquals('csv', $response->mapType('application/vnd.ms-excel')); $expected = array('json', 'xhtml', 'css'); $result = $response->mapType(array('application/json', 'application/xhtml+xml', 'text/css')); $this->assertEquals($expected, $result); }
/** * Maps a content-type back to an alias * * e.g `mapType('application/pdf'); // returns 'pdf'` * * @param mixed $ctype Either a string content type to map, or an array of types. * @return mixed Aliases for the types provided. */ public function mapType($ctype) { return parent::mapType($ctype); }