mirror of
https://github.com/mrclay/minify.git
synced 2025-08-22 05:33:14 +02:00
Apply php-cs-fixer new rules
This commit is contained in:
@@ -1,19 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Class Minify_Lines
|
||||
* @package Minify
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add line numbers in C-style comments for easier debugging of combined content
|
||||
*
|
||||
* @package Minify
|
||||
* @author Stephen Clay <steve@mrclay.org>
|
||||
* @author Adam Pedersen (Issue 55 fix)
|
||||
*/
|
||||
class Minify_Lines
|
||||
{
|
||||
|
||||
/**
|
||||
* Add line numbers in C-style comments
|
||||
*
|
||||
@@ -22,7 +16,6 @@ class Minify_Lines
|
||||
* mangled. URI rewriting can also be performed.
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @param array $options available options:
|
||||
*
|
||||
* 'id': (optional) string to identify file. E.g. file name/path
|
||||
@@ -48,8 +41,8 @@ class Minify_Lines
|
||||
$i = 0;
|
||||
$newLines = array();
|
||||
|
||||
while (null !== ($line = array_shift($lines))) {
|
||||
if (('' !== $id) && (0 === $i % 50)) {
|
||||
while (($line = array_shift($lines)) !== null) {
|
||||
if (($id !== '') && ($i % 50 === 0)) {
|
||||
if ($inComment) {
|
||||
array_push($newLines, '', "/* {$id} *|", '');
|
||||
} else {
|
||||
@@ -84,7 +77,6 @@ class Minify_Lines
|
||||
* Is the parser within a C-style comment at the end of this line?
|
||||
*
|
||||
* @param string $line current line of code
|
||||
*
|
||||
* @param bool $inComment was the parser in a C-style comment at the
|
||||
* beginning of the previous line?
|
||||
*
|
||||
@@ -102,7 +94,8 @@ class Minify_Lines
|
||||
|
||||
// stop comment and keep walking line
|
||||
$inComment = false;
|
||||
@$line = (string)substr($line, $index + 2);
|
||||
@$line = (string) substr($line, $index + 2);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -116,7 +109,8 @@ class Minify_Lines
|
||||
if ($single === false || $multi < $single) {
|
||||
// start comment and keep walking line
|
||||
$inComment = true;
|
||||
@$line = (string)substr($line, $multi + 2);
|
||||
@$line = (string) substr($line, $multi + 2);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -131,12 +125,9 @@ class Minify_Lines
|
||||
* Prepend a comment (or note) to the given line
|
||||
*
|
||||
* @param string $line current line of code
|
||||
*
|
||||
* @param string $note content of note/comment
|
||||
*
|
||||
* @param bool $inComment was the parser in a comment at the
|
||||
* beginning of the line?
|
||||
*
|
||||
* @param int $padTo minimum width of comment
|
||||
*
|
||||
* @return string
|
||||
@@ -157,6 +148,7 @@ class Minify_Lines
|
||||
*
|
||||
* @param string $str String containing the token
|
||||
* @param string $token Token being checked
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private static function _find($str, $token)
|
||||
@@ -164,24 +156,26 @@ class Minify_Lines
|
||||
switch ($token) {
|
||||
case '//':
|
||||
$fakes = array(
|
||||
'://' => 1,
|
||||
'"//' => 1,
|
||||
'\'//' => 1,
|
||||
'".//' => 2,
|
||||
'://' => 1,
|
||||
'"//' => 1,
|
||||
'\'//' => 1,
|
||||
'".//' => 2,
|
||||
'\'.//' => 2,
|
||||
);
|
||||
|
||||
break;
|
||||
case '/*':
|
||||
$fakes = array(
|
||||
'"/*' => 1,
|
||||
'\'/*' => 1,
|
||||
'"//*' => 2,
|
||||
'\'//*' => 2,
|
||||
'".//*' => 3,
|
||||
'"/*' => 1,
|
||||
'\'/*' => 1,
|
||||
'"//*' => 2,
|
||||
'\'//*' => 2,
|
||||
'".//*' => 3,
|
||||
'\'.//*' => 3,
|
||||
'*/*' => 1,
|
||||
'\\/*' => 1,
|
||||
'*/*' => 1,
|
||||
'\\/*' => 1,
|
||||
);
|
||||
|
||||
break;
|
||||
default:
|
||||
$fakes = array();
|
||||
@@ -197,6 +191,7 @@ class Minify_Lines
|
||||
// move offset and scan again
|
||||
$offset += $index + strlen($token);
|
||||
$index = strpos($str, $token, $offset);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user