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

Apply php-cs-fixer new rules

This commit is contained in:
Elan Ruusamäe
2019-12-11 17:00:16 +02:00
parent f9d3d54e62
commit eff278193b
88 changed files with 1225 additions and 1213 deletions

View File

@@ -1,7 +1,6 @@
<?php
/**
* Class Minify_YUICompressor
* @package Minify
*/
/**
@@ -25,13 +24,9 @@
* array('stack-size' => '2048k')
*
* @todo unit tests, $options docs
*
* @package Minify
* @author Stephen Clay <steve@mrclay.org>
*/
class Minify_YUICompressor
{
/**
* Filepath of the YUI Compressor jar file. This must be set before
* calling minifyJs() or minifyCss().
@@ -59,7 +54,6 @@ class Minify_YUICompressor
* Minify a Javascript string
*
* @param string $js
*
* @param array $options (verbose is ignored)
*
* @see http://www.julienlecomte.net/yuicompressor/README
@@ -75,7 +69,6 @@ class Minify_YUICompressor
* Minify a CSS string
*
* @param string $css
*
* @param array $options (verbose is ignored)
*
* @see http://www.julienlecomte.net/yuicompressor/README
@@ -90,8 +83,8 @@ class Minify_YUICompressor
private static function _minify($type, $content, $options)
{
self::_prepare();
if (! ($tmpFile = tempnam(self::$tempDir, 'yuic_'))) {
throw new Exception('Minify_YUICompressor : could not create temp file in "'.self::$tempDir.'".');
if (!($tmpFile = tempnam(self::$tempDir, 'yuic_'))) {
throw new Exception('Minify_YUICompressor : could not create temp file in "' . self::$tempDir . '".');
}
file_put_contents($tmpFile, $content);
@@ -107,13 +100,13 @@ class Minify_YUICompressor
private static function _getCmd($userOptions, $type, $tmpFile)
{
$defaults = array(
'charset' => '',
'line-break' => 5000,
'type' => $type,
'nomunge' => false,
'preserve-semi' => false,
'charset' => '',
'line-break' => 5000,
'type' => $type,
'nomunge' => false,
'preserve-semi' => false,
'disable-optimizations' => false,
'stack-size' => '',
'stack-size' => '',
);
$o = array_merge($defaults, $userOptions);
@@ -125,7 +118,7 @@ class Minify_YUICompressor
? " --charset {$o['charset']}"
: '')
. (is_numeric($o['line-break']) && $o['line-break'] >= 0
? ' --line-break ' . (int)$o['line-break']
? ' --line-break ' . (int) $o['line-break']
: '');
if ($type === 'js') {
foreach (array('nomunge', 'preserve-semi', 'disable-optimizations') as $opt) {
@@ -140,18 +133,17 @@ class Minify_YUICompressor
private static function _prepare()
{
if (! is_file(self::$jarFile)) {
throw new Exception('Minify_YUICompressor : $jarFile('.self::$jarFile.') is not a valid file.');
if (!is_file(self::$jarFile)) {
throw new Exception('Minify_YUICompressor : $jarFile(' . self::$jarFile . ') is not a valid file.');
}
if (! is_readable(self::$jarFile)) {
throw new Exception('Minify_YUICompressor : $jarFile('.self::$jarFile.') is not readable.');
if (!is_readable(self::$jarFile)) {
throw new Exception('Minify_YUICompressor : $jarFile(' . self::$jarFile . ') is not readable.');
}
if (! is_dir(self::$tempDir)) {
throw new Exception('Minify_YUICompressor : $tempDir('.self::$tempDir.') is not a valid direcotry.');
if (!is_dir(self::$tempDir)) {
throw new Exception('Minify_YUICompressor : $tempDir(' . self::$tempDir . ') is not a valid direcotry.');
}
if (! is_writable(self::$tempDir)) {
throw new Exception('Minify_YUICompressor : $tempDir('.self::$tempDir.') is not writable.');
if (!is_writable(self::$tempDir)) {
throw new Exception('Minify_YUICompressor : $tempDir(' . self::$tempDir . ') is not writable.');
}
}
}