1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-13 01:24:51 +02:00

phpcs: enable psr2

This commit is contained in:
Elan Ruusamäe
2016-10-16 16:46:43 +03:00
parent 0cc631c5a9
commit 5fb7ea1ed1
44 changed files with 175 additions and 109 deletions

View File

@@ -18,8 +18,8 @@
* @author Stephen Clay <steve@mrclay.org>
* @author Simon Schick <simonsimcity@gmail.com>
*/
class Minify_ImportProcessor {
class Minify_ImportProcessor
{
public static $filesIncluded = array();
public static function process($file)
@@ -173,8 +173,7 @@ class Minify_ImportProcessor {
$arFrom = explode($ps, rtrim($realFrom, $ps));
$arTo = explode($ps, rtrim($realTo, $ps));
while (count($arFrom) && count($arTo) && ($arFrom[0] == $arTo[0]))
{
while (count($arFrom) && count($arTo) && ($arFrom[0] == $arTo[0])) {
array_shift($arFrom);
array_shift($arTo);
}
@@ -191,18 +190,21 @@ class Minify_ImportProcessor {
private function truepath($path)
{
// whether $path is unix or not
$unipath = strlen($path) == 0 || $path{0} != '/';
$unipath = strlen($path) == 0 || $path{0}
!= '/';
// attempts to detect if path is relative in which case, add cwd
if (strpos($path, ':') === false && $unipath)
if (strpos($path, ':') === false && $unipath) {
$path = $this->_currentDir . DIRECTORY_SEPARATOR . $path;
}
// resolve path parts (single dot, double dot and double delimiters)
$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $path);
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
$absolutes = array();
foreach ($parts as $part) {
if ('.' == $part)
if ('.' == $part) {
continue;
}
if ('..' == $part) {
array_pop($absolutes);
} else {
@@ -211,8 +213,9 @@ class Minify_ImportProcessor {
}
$path = implode(DIRECTORY_SEPARATOR, $absolutes);
// resolve any symlinks
if (file_exists($path) && linkinfo($path) > 0)
if (file_exists($path) && linkinfo($path) > 0) {
$path = readlink($path);
}
// put initial separator that could have been lost
$path = !$unipath ? '/' . $path : $path;