public function serveAssetAction(Request $request, $asset_name) { try { $asset = new Asset($this->getAssetPath($asset_name)); //grab the regexps to test against from the config file for this asset $response = new Response(); $response->setContent($asset->getContent()); $response->headers->set('Content-Type', $asset->getMimeType()); $response->headers->set('X-Generated-By', get_class($this)); $response->headers->set('Content-Length', $asset->getContentLength()); return $response; } catch (\Exception $e) { return new Response($e->getMessage(), 404); } }
public function filterAsset(Asset &$a) { $a->setContent(strtoupper($a->getContent())); }
public function testAssetFromFileConstruct() { $a = new Asset($this->file); $this->assertEquals('content', $a->getContent()); }