Skip to content

Commit

Permalink
Apply php-cs-fixer fixers
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
glensc committed Apr 3, 2020
1 parent 031e804 commit b31855f
Show file tree
Hide file tree
Showing 50 changed files with 217 additions and 188 deletions.
2 changes: 1 addition & 1 deletion builder/index.php
@@ -1,4 +1,4 @@
<?php
<?php

$app = (require __DIR__ . '/../bootstrap.php');
/* @var \Minify\App $app */
Expand Down
3 changes: 1 addition & 2 deletions builder/ocCheck.php
@@ -1,7 +1,7 @@
<?php
/**
* AJAX checks for zlib.output_compression
*
*
* @package Minify
*/

Expand Down Expand Up @@ -29,7 +29,6 @@
));
$he->encode();
$he->sendAll();

} else {
// echo status "0" or "1"
header('Content-Type: text/plain');
Expand Down
4 changes: 2 additions & 2 deletions builder/test.php
Expand Up @@ -37,7 +37,7 @@
echo "<p class=topNote><strong>\$_SERVER['SUBDOMAIN_DOCUMENT_ROOT'] is set.</strong> "
. "You may need to set \$min_documentRoot to this in config.php</p>";
}
}
//*/
//*/
3 changes: 1 addition & 2 deletions config-test.php
Expand Up @@ -4,7 +4,6 @@
*
* To test config options, place them in this file and add "&test" to your Minify URL.
* Note that if this is on a public server, anyone can execute your test.
*
*
* @package Minify
*/

39 changes: 19 additions & 20 deletions config.php
Expand Up @@ -2,7 +2,7 @@
/**
* Configuration for "min", the default application built with the Minify
* library
*
*
* @package Minify
*/

Expand Down Expand Up @@ -47,7 +47,7 @@
* /min/f=file1.js send the cookie minDebug=file1.js
* You can manually enable debugging by appending "&debug" to a URI.
* E.g. /min/?f=script1.js,script2.js&debug
*
*
* In 'debug' mode, Minify combines files with no minification and adds comments
* to indicate line #s of the original files.
*/
Expand All @@ -73,11 +73,11 @@
/**
* Leave an empty string to use PHP's $_SERVER['DOCUMENT_ROOT'].
*
* On some servers, this value may be misconfigured or missing. If so, set this
* On some servers, this value may be misconfigured or missing. If so, set this
* to your full document root path with no trailing slash.
* E.g. '/home/accountname/public_html' or 'c:\\xampp\\htdocs'
*
* If /min/ is directly inside your document root, just uncomment the
* If /min/ is directly inside your document root, just uncomment the
* second line. The third line might work on some Apache servers.
*/
$min_documentRoot = '';
Expand All @@ -87,7 +87,7 @@


/**
* Cache file locking. Set to false if filesystem is NFS. On at least one
* Cache file locking. Set to false if filesystem is NFS. On at least one
* NFS system flock-ing attempts stalled PHP for 30 seconds!
*/
$min_cacheFileLocking = true;
Expand All @@ -96,9 +96,9 @@
/**
* Combining multiple CSS files can place @import declarations after rules, which
* is invalid. Minify will attempt to detect when this happens and place a
* warning comment at the top of the CSS output. To resolve this you can either
* move the @imports within your CSS files, or enable this option, which will
* move all @imports to the top of the output. Note that moving @imports could
* warning comment at the top of the CSS output. To resolve this you can either
* move the @imports within your CSS files, or enable this option, which will
* move all @imports to the top of the output. Note that moving @imports could
* affect CSS values (which is why this option is disabled by default).
*/
$min_serveOptions['bubbleCssImports'] = false;
Expand Down Expand Up @@ -134,8 +134,8 @@
* particular directories below DOCUMENT_ROOT, set this here.
* You will still need to include the directory in the
* f or b GET parameters.
*
* // = shortcut for DOCUMENT_ROOT
*
* // = shortcut for DOCUMENT_ROOT
*/
//$min_serveOptions['minApp']['allowDirs'] = array('//js', '//css');

Expand All @@ -149,7 +149,7 @@
/**
* By default, Minify will not minify files with names containing .min or -min
* before the extension. E.g. myFile.min.js will not be processed by JSMin
*
*
* To minify all files, set this option to null. You could also specify your
* own pattern that is matched against the filename.
*/
Expand All @@ -160,8 +160,8 @@
* If you minify CSS files stored in symlink-ed directories, the URI rewriting
* algorithm can fail. To prevent this, provide an array of link paths to
* target paths, where the link paths are within the document root.
*
* Because paths need to be normalized for this to work, use "//" to substitute
*
* Because paths need to be normalized for this to work, use "//" to substitute
* the doc root in the link paths (the array keys). E.g.:
* <code>
* array('//symlink' => '/real/target/path') // unix
Expand All @@ -173,17 +173,17 @@

/**
* If you upload files from Windows to a non-Windows server, Windows may report
* incorrect mtimes for the files. This may cause Minify to keep serving stale
* incorrect mtimes for the files. This may cause Minify to keep serving stale
* cache files when source file changes are made too frequently (e.g. more than
* once an hour).
*
* Immediately after modifying and uploading a file, use the touch command to
*
* Immediately after modifying and uploading a file, use the touch command to
* update the mtime on the server. If the mtime jumps ahead by a number of hours,
* set this variable to that number. If the mtime moves back, this should not be
* set this variable to that number. If the mtime moves back, this should not be
* needed.
*
* In the Windows SFTP client WinSCP, there's an option that may fix this
* issue without changing the variable below. Under login > environment,
* In the Windows SFTP client WinSCP, there's an option that may fix this
* issue without changing the variable below. Under login > environment,
* select the option "Adjust remote timestamp with DST".
* @link http://winscp.net/eng/docs/ui_login_environment#daylight_saving_time
*/
Expand All @@ -198,4 +198,3 @@
*/
//$min_factories['minify'] = ... a callable accepting a Minify\App object
//$min_factories['controller'] = ... a callable accepting a Minify\App object

4 changes: 2 additions & 2 deletions index.php
@@ -1,9 +1,9 @@
<?php
/**
* Sets up MinApp controller and serves files
*
*
* DO NOT EDIT! Configure this utility via config.php and groupsConfig.php
*
*
* @package Minify
*/

Expand Down
18 changes: 11 additions & 7 deletions lib/HTTP/Encoder.php
Expand Up @@ -204,9 +204,10 @@ public static function getAcceptedEncoding($allowCompress = true, $allowDeflate
}
// gzip checks (slow)
if (preg_match(
'@(?:^|,)\\s*((?:x-)?gzip)\\s*(?:$|,|;\\s*q=(?:0\\.|1))@'
,$ae
,$m)) {
'@(?:^|,)\\s*((?:x-)?gzip)\\s*(?:$|,|;\\s*q=(?:0\\.|1))@',
$ae,
$m
)) {
return array('gzip', $m[1]);
}
if ($allowDeflate) {
Expand All @@ -217,14 +218,17 @@ public static function getAcceptedEncoding($allowCompress = true, $allowDeflate
|| 0 === strpos($ae, 'deflate,') // opera
// slow parsing
|| preg_match(
'@(?:^|,)\\s*deflate\\s*(?:$|,|;\\s*q=(?:0\\.|1))@', $ae)) {
'@(?:^|,)\\s*deflate\\s*(?:$|,|;\\s*q=(?:0\\.|1))@',
$ae
)) {
return array('deflate', 'deflate');
}
}
if ($allowCompress && preg_match(
'@(?:^|,)\\s*((?:x-)?compress)\\s*(?:$|,|;\\s*q=(?:0\\.|1))@'
,$ae
,$m)) {
'@(?:^|,)\\s*((?:x-)?compress)\\s*(?:$|,|;\\s*q=(?:0\\.|1))@',
$ae,
$m
)) {
return array('compress', $m[1]);
}

Expand Down
7 changes: 4 additions & 3 deletions lib/Minify.php
Expand Up @@ -242,7 +242,7 @@ public function serve(Minify_ControllerInterface $controller, $options = array()
if (! $this->options['quiet']) {
$this->errorExit($this->options['badRequestHeader'], self::URL_DEBUG);
} else {
list(,$statusCode) = explode(' ', $this->options['badRequestHeader']);
list(, $statusCode) = explode(' ', $this->options['badRequestHeader']);

return array(
'success' => false,
Expand Down Expand Up @@ -470,7 +470,7 @@ public function combine($sources, $options = array())
public function errorExit($header, $url = '', $msgHtml = '')
{
$url = htmlspecialchars($url, ENT_QUOTES);
list(,$h1) = explode(' ', $header, 2);
list(, $h1) = explode(' ', $header, 2);
$h1 = htmlspecialchars($h1);
// FastCGI environments require 3rd arg to header() to be set
list(, $code) = explode(' ', $header, 3);
Expand Down Expand Up @@ -593,7 +593,8 @@ protected function combineMinify()
! $source // yes, we ran out of sources
|| $type === self::TYPE_CSS // yes, to process CSS individually (avoiding PCRE bugs/limits)
|| $minifier !== $lastMinifier // yes, minifier changed
|| $options !== $lastOptions)) { // yes, options changed
|| $options !== $lastOptions // yes, options changed
)) {
// minify previous sources with last settings
$imploded = implode($implodeSeparator, $groupToProcessTogether);
$groupToProcessTogether = array();
Expand Down
3 changes: 1 addition & 2 deletions lib/Minify/App.php
Expand Up @@ -82,8 +82,7 @@ public function __construct($dir)

$varDefined = get_defined_vars();

$varNames = array_filter($varNames, function($name) use($varDefined)
{
$varNames = array_filter($varNames, function ($name) use ($varDefined) {
return array_key_exists($name, $varDefined);
});

Expand Down
12 changes: 6 additions & 6 deletions lib/Minify/CSSmin.php
Expand Up @@ -73,16 +73,16 @@ public static function minify($css, $options = array())
}
if ($options['currentDir']) {
return Minify_CSS_UriRewriter::rewrite(
$css
,$options['currentDir']
,$options['docRoot']
,$options['symlinks']
$css,
$options['currentDir'],
$options['docRoot'],
$options['symlinks']
);
}

return Minify_CSS_UriRewriter::prepend(
$css
,$options['prependRelativePath']
$css,
$options['prependRelativePath']
);
}
}
2 changes: 1 addition & 1 deletion lib/Minify/Cache/Null.php
Expand Up @@ -64,4 +64,4 @@ public function display($id)
public function fetch($id)
{
}
}
}
2 changes: 1 addition & 1 deletion lib/Minify/Cache/WinCache.php
Expand Up @@ -136,4 +136,4 @@ private function _fetch($id)

return true;
}
}
}
1 change: 0 additions & 1 deletion lib/Minify/Controller/Files.php
Expand Up @@ -68,4 +68,3 @@ public function createConfiguration(array $options)
return new Minify_ServeConfiguration($options, $sources);
}
}

1 change: 0 additions & 1 deletion lib/Minify/Controller/Groups.php
Expand Up @@ -73,4 +73,3 @@ public function createConfiguration(array $options)
return parent::createConfiguration($options);
}
}

1 change: 0 additions & 1 deletion lib/Minify/Controller/Page.php
Expand Up @@ -66,4 +66,3 @@ public function createConfiguration(array $options)
return new Minify_ServeConfiguration($options, $sources, $selectionId);
}
}

2 changes: 1 addition & 1 deletion lib/Minify/ControllerInterface.php
Expand Up @@ -19,4 +19,4 @@ public function createConfiguration(array $options);
* @return Minify_Env
*/
public function getEnv();
}
}

0 comments on commit b31855f

Please sign in to comment.