1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-31 17:42:02 +02:00

Apply php-cs-fixer fixers

- braces
- function_declaration
- lowercase_keywords
- method_argument_space
- no_spaces_inside_parenthesis
- no_trailing_whitespace
- no_trailing_whitespace_in_comment
- single_blank_line_at_eof
This commit is contained in:
Elan Ruusamäe
2020-04-03 10:43:07 +03:00
parent 031e804d08
commit b31855f6b8
50 changed files with 217 additions and 188 deletions

View File

@@ -7,12 +7,12 @@ if (is_file(__DIR__ . '/bootstrap.php')) {
$bootstrap_file = __DIR__ . '/../bootstrap.php';
}
$send_400 = function($content = 'Bad URL') {
$send_400 = function ($content = 'Bad URL') {
http_response_code(400);
die($content);
};
$send_301 = function($url) {
$send_301 = function ($url) {
http_response_code(301);
header("Cache-Control: max-age=31536000");
header("Location: $url");

View File

@@ -10,7 +10,8 @@ namespace Minify\StaticService;
* @param string $type "css" or "js"
* @return string
*/
function build_uri($static_uri, $query, $type) {
function build_uri($static_uri, $query, $type)
{
$static_uri = rtrim($static_uri, '/');
$query = ltrim($query, '?');
@@ -30,7 +31,8 @@ function build_uri($static_uri, $query, $type) {
* @param bool $auto_create Automatically create the directory if missing?
* @return null|string null if missing or can't create
*/
function get_cache_time($auto_create = true) {
function get_cache_time($auto_create = true)
{
foreach (scandir(__DIR__) as $entry) {
if (ctype_digit($entry)) {
return $entry;
@@ -50,14 +52,16 @@ function get_cache_time($auto_create = true) {
return $time;
}
function flush_cache() {
function flush_cache()
{
$time = get_cache_time(false);
if ($time) {
remove_tree(__DIR__ . "/$time");
}
}
function remove_tree($dir) {
function remove_tree($dir)
{
$files = array_diff(scandir($dir), array('.', '..'));
foreach ($files as $file) {