winter/modules/system/classes/SystemController.php
Samuel Georges c5bc804d73 Remove redundant header_remove() call
The response is returned directly to the route so this is not needed, it was likely added as an artefact of a previous implementation

Refs #3773
Refs #3746
2019-03-29 06:02:06 +11:00

44 lines
1.1 KiB
PHP

<?php namespace System\Classes;
use Lang;
use ApplicationException;
use Illuminate\Routing\Controller as ControllerBase;
use Exception;
use Response;
/**
* The is the master controller for system related routing.
* It is currently only responsible for serving up the asset combiner contents.
*
* @see System\Classes\CombineAssets Asset combiner class
* @package october\system
* @author Alexey Bobkov, Samuel Georges
*/
class SystemController extends ControllerBase
{
/**
* Combines JavaScript and StyleSheet assets.
* @param string $name Combined file code
* @return string Combined content.
*/
public function combine($name)
{
try {
if (!strpos($name, '-')) {
throw new ApplicationException(Lang::get('system::lang.combiner.not_found', ['name' => $name]));
}
$parts = explode('-', $name);
$cacheId = $parts[0];
$combiner = CombineAssets::instance();
return $combiner->getContents($cacheId);
}
catch (Exception $ex) {
return Response::make('/* '.e($ex->getMessage()).' */', 500);
}
}
}