Skip to content
Permalink
Browse files

phpcs: enable psr2

  • Loading branch information...
glensc committed Oct 16, 2016
1 parent 0cc631c commit 5fb7ea1ed1ec678a9ef4b373d8fa9379d14e2478
Showing with 175 additions and 109 deletions.
  1. +2 −1 .php_cs
  2. +4 −2 lib/HTTP/ConditionalGet.php
  3. +5 −7 lib/HTTP/Encoder.php
  4. +8 −8 lib/Minify.php
  5. +6 −3 lib/Minify/App.php
  6. +5 −3 lib/Minify/Build.php
  7. +2 −1 lib/Minify/CSS.php
  8. +4 −2 lib/Minify/CSS/Compressor.php
  9. +6 −3 lib/Minify/CSS/UriRewriter.php
  10. +2 −1 lib/Minify/CSSmin.php
  11. +2 −1 lib/Minify/Cache/APC.php
  12. +3 −2 lib/Minify/Cache/File.php
  13. +4 −3 lib/Minify/Cache/Memcache.php
  14. +2 −1 lib/Minify/Cache/Null.php
  15. +5 −5 lib/Minify/Cache/WinCache.php
  16. +2 −1 lib/Minify/Cache/XCache.php
  17. +2 −1 lib/Minify/Cache/ZendPlatform.php
  18. +2 −1 lib/Minify/CacheInterface.php
  19. +2 −1 lib/Minify/CommentPreserver.php
  20. +2 −1 lib/Minify/Controller/Base.php
  21. +4 −2 lib/Minify/Controller/Files.php
  22. +4 −2 lib/Minify/Controller/Groups.php
  23. +4 −2 lib/Minify/Controller/MinApp.php
  24. +4 −2 lib/Minify/Controller/Page.php
  25. +2 −1 lib/Minify/ControllerInterface.php
  26. +2 −1 lib/Minify/DebugDetector.php
  27. +2 −1 lib/Minify/Env.php
  28. +4 −2 lib/Minify/HTML.php
  29. +6 −3 lib/Minify/HTML/Helper.php
  30. +11 −8 lib/Minify/ImportProcessor.php
  31. +5 −2 lib/Minify/JS/ClosureCompiler.php
  32. +14 −7 lib/Minify/LessCssSource.php
  33. +4 −2 lib/Minify/Lines.php
  34. +2 −1 lib/Minify/Packer.php
  35. +6 −5 lib/Minify/ScssCssSource.php
  36. +2 −1 lib/Minify/ServeConfiguration.php
  37. +9 −7 lib/Minify/Source.php
  38. +2 −1 lib/Minify/Source/Factory.php
  39. +3 −1 lib/Minify/Source/FactoryException.php
  40. +2 −1 lib/Minify/SourceInterface.php
  41. +2 −1 lib/Minify/SourceSet.php
  42. +7 −6 lib/Minify/YUICompressor.php
  43. +2 −1 lib/MrClay/Cli.php
  44. +2 −1 lib/MrClay/Cli/Arg.php
@@ -5,7 +5,7 @@ $finder = Symfony\CS\Finder\DefaultFinder::create()
;
return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::NONE_LEVEL)
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->setUsingCache(true)
->fixers(array(
'linefeed',
@@ -21,6 +21,7 @@ return Symfony\CS\Config\Config::create()
'controls_spaces',
'elseif',
'-eof_ending',
'-method_argument_space',
))
->finder($finder)
;
@@ -60,7 +60,8 @@
* @subpackage HTTP
* @author Stephen Clay <steve@mrclay.org>
*/
class HTTP_ConditionalGet {
class HTTP_ConditionalGet
{
/**
* Does the client have a valid copy of the requested resource?
@@ -340,7 +341,8 @@ protected function resourceMatchedEtag()
*
* @return string
*/
protected function normalizeEtag($etag) {
protected function normalizeEtag($etag)
{
$etag = trim($etag);
return $this->_stripEtag
@@ -43,7 +43,8 @@
* @subpackage HTTP
* @author Stephen Clay <steve@mrclay.org>
*/
class HTTP_Encoder {
class HTTP_Encoder
{
/**
* Should the encoder allow HTTP encoding to IE6?
@@ -97,8 +98,7 @@ public function __construct($spec)
$this->_headers['Content-Type'] = $spec['type'];
}
if (isset($spec['method'])
&& in_array($spec['method'], array('gzip', 'deflate', 'compress', '')))
{
&& in_array($spec['method'], array('gzip', 'deflate', 'compress', ''))) {
$this->_encodeMethod = array($spec['method'], $spec['method']);
} else {
$this->_encodeMethod = self::getAcceptedEncoding();
@@ -192,8 +192,7 @@ public static function getAcceptedEncoding($allowCompress = true, $allowDeflate
// @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
if (! isset($_SERVER['HTTP_ACCEPT_ENCODING'])
|| self::isBuggyIe())
{
|| self::isBuggyIe()) {
return array('', '');
}
$ae = $_SERVER['HTTP_ACCEPT_ENCODING'];
@@ -259,8 +258,7 @@ public function encode($compressionLevel = null)
}
if ('' === $this->_encodeMethod[0]
|| ($compressionLevel == 0)
|| !extension_loaded('zlib'))
{
|| !extension_loaded('zlib')) {
return false;
}
if ($this->_encodeMethod[0] === 'deflate') {
@@ -24,7 +24,8 @@
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @link https://github.com/mrclay/minify
*/
class Minify {
class Minify
{
/**
* API version
@@ -87,7 +88,8 @@ class Minify {
* @param Minify_CacheInterface $cache
* @param LoggerInterface $logger
*/
public function __construct(Minify_CacheInterface $cache, LoggerInterface $logger = null) {
public function __construct(Minify_CacheInterface $cache, LoggerInterface $logger = null)
{
$this->cache = $cache;
$this->logger = $logger;
}
@@ -492,7 +494,8 @@ public function errorExit($header, $url = '', $msgHtml = '')
* @param string $content
* @return string
*/
public static function nullMinifier($content) {
public static function nullMinifier($content)
{
if (isset($content[0]) && $content[0] === "\xef") {
$content = substr($content, 3);
}
@@ -506,7 +509,7 @@ public static function nullMinifier($content) {
*/
protected function setupUriRewrites()
{
foreach($this->sources as $key => $source) {
foreach ($this->sources as $key => $source) {
$file = $this->env->normalizePath($source->getFilePath());
$minifyOptions = $source->getMinifierOptions();
@@ -594,8 +597,7 @@ protected function combineMinify()
|| $type === self::TYPE_CSS // yes, to process CSS individually (avoiding PCRE bugs/limits)
|| $minifier !== $lastMinifier // yes, minifier changed
|| $options !== $lastOptions) // yes, options changed
)
{
) {
// minify previous sources with last settings
$imploded = implode($implodeSeparator, $groupToProcessTogether);
$groupToProcessTogether = array();
@@ -718,7 +720,6 @@ protected function analyzeSources($options = array())
if (!empty($options['contentType'])) {
// just verify sources have null content type or match the options
if ($sourceType !== null && $sourceType !== $options['contentType']) {
$this->logger && $this->logger->warning('ContentType mismatch');
$this->sources = array();
@@ -732,7 +733,6 @@ protected function analyzeSources($options = array())
if ($type === null) {
$type = $sourceType;
} elseif ($sourceType !== $type) {
$this->logger && $this->logger->warning('ContentType mismatch');
$this->sources = array();
@@ -21,7 +21,8 @@
* @property \Minify_Source_Factory $sourceFactory
* @property array $sourceFactoryOptions
*/
class App extends Container {
class App extends Container
{
/**
* Constructor
@@ -249,7 +250,8 @@ public function __construct($dir)
};
}
public function runServer() {
public function runServer()
{
if (!$this->env->get('f') && $this->env->get('g') === null) {
// no spec given
$msg = '<p>No "f" or "g" parameters were detected.</p>';
@@ -265,7 +267,8 @@ public function runServer() {
* @param mixed $var
* @return string
*/
private function typeOf($var) {
private function typeOf($var)
{
$type = gettype($var);
return $type === 'object' ? get_class($var) : $type;
@@ -34,7 +34,8 @@
* @package Minify
* @author Stephen Clay <steve@mrclay.org>
*/
class Minify_Build {
class Minify_Build
{
/**
* Last modification time of all files in the build
@@ -67,15 +68,16 @@ class Minify_Build {
* append the timestamp to the URI.
* @return string
*/
public function uri($uri, $forceAmpersand = false) {
public function uri($uri, $forceAmpersand = false)
{
$sep = ($forceAmpersand || strpos($uri, '?') !== false)
? self::$ampersand
: '?';
return "{$uri}{$sep}{$this->lastModified}";
}
/**
/**
* Create a build object
*
* @param array $sources array of Minify_Source objects and/or file paths
@@ -16,7 +16,8 @@
*
* @deprecated Use Minify_CSSmin
*/
class Minify_CSS {
class Minify_CSS
{
/**
* Minify a CSS string
@@ -26,7 +26,8 @@
*
* @deprecated Use CSSmin (tubalmartin/cssmin)
*/
class Minify_CSS_Compressor {
class Minify_CSS_Compressor
{
/**
* Minify a CSS string
@@ -61,7 +62,8 @@ public static function process($css, $options = array())
*
* @param array $options (currently ignored)
*/
private function __construct($options) {
private function __construct($options)
{
$this->_options = $options;
}
@@ -10,7 +10,8 @@
* @package Minify
* @author Stephen Clay <steve@mrclay.org>
*/
class Minify_CSS_UriRewriter {
class Minify_CSS_UriRewriter
{
/**
* rewrite() and rewriteRelative() append debugging information here
@@ -326,7 +327,8 @@ private static function _processUriCB($m)
* @param string $css
* @return string
*/
private static function _owlifySvgPaths($css) {
private static function _owlifySvgPaths($css)
{
return preg_replace('~\b((?:clip-path|mask|-webkit-mask)\s*\:\s*)url(\(\s*#\w+\s*\))~', '$1owl$2', $css);
}
@@ -338,7 +340,8 @@ private static function _owlifySvgPaths($css) {
* @param string $css
* @return string
*/
private static function _unOwlify($css) {
private static function _unOwlify($css)
{
return preg_replace('~\b((?:clip-path|mask|-webkit-mask)\s*\:\s*)owl~', '$1url', $css);
}
}
@@ -12,7 +12,8 @@
* @package Minify
* @author Stephen Clay <steve@mrclay.org>
*/
class Minify_CSSmin {
class Minify_CSSmin
{
/**
* Minify a CSS string
@@ -14,7 +14,8 @@
* @package Minify
* @author Chris Edwards
**/
class Minify_Cache_APC implements Minify_CacheInterface {
class Minify_Cache_APC implements Minify_CacheInterface
{
/**
* Create a Minify_Cache_APC object, to be passed to
@@ -6,7 +6,8 @@
use Psr\Log\LoggerInterface;
class Minify_Cache_File implements Minify_CacheInterface {
class Minify_Cache_File implements Minify_CacheInterface
{
/**
* @var string
@@ -117,7 +118,7 @@ public function display($id)
}
}
/**
/**
* Fetch the cached content
*
* @param string $id cache id (e.g. a filename)
@@ -17,7 +17,8 @@
* }
* </code>
**/
class Minify_Cache_Memcache implements Minify_CacheInterface {
class Minify_Cache_Memcache implements Minify_CacheInterface
{
/**
* Create a Minify_Cache_Memcache object, to be passed to
@@ -92,7 +93,7 @@ public function display($id)
: '';
}
/**
/**
* Fetch the cached content
*
* @param string $id cache id
@@ -114,7 +115,7 @@ public function fetch($id)
private $_data = null;
private $_id = null;
/**
/**
* Fetch data and timestamp from memcache, store in instance
*
* @param string $id
@@ -8,7 +8,8 @@
*
* @package Minify
*/
class Minify_Cache_Null implements Minify_CacheInterface {
class Minify_Cache_Null implements Minify_CacheInterface
{
/**
* Write data to cache.
*
@@ -99,12 +99,12 @@ public function fetch($id)
return $this->_fetch($id) ? $this->_data : '';
}
private $_exp = NULL;
private $_exp = null;
// cache of most recently fetched id
private $_lm = NULL;
private $_data = NULL;
private $_id = NULL;
private $_lm = null;
private $_data = null;
private $_id = null;
/**
* Fetch data and timestamp from WinCache, store in instance
@@ -121,7 +121,7 @@ private function _fetch($id)
$suc = false;
$ret = wincache_ucache_get($id, $suc);
if (!$suc) {
$this->_id = NULL;
$this->_id = null;
return false;
}
@@ -17,7 +17,8 @@
* @package Minify
* @author Elan Ruusamäe <glen@delfi.ee>
**/
class Minify_Cache_XCache implements Minify_CacheInterface {
class Minify_Cache_XCache implements Minify_CacheInterface
{
/**
* Create a Minify_Cache_XCache object, to be passed to
@@ -16,7 +16,8 @@
* @package Minify
* @author Patrick van Dissel
*/
class Minify_Cache_ZendPlatform implements Minify_CacheInterface {
class Minify_Cache_ZendPlatform implements Minify_CacheInterface
{
/**
* Create a Minify_Cache_ZendPlatform object, to be passed to
@@ -9,7 +9,8 @@
*
* @package Minify
*/
interface Minify_CacheInterface {
interface Minify_CacheInterface
{
/**
* Write data to cache.
*

0 comments on commit 5fb7ea1

Please sign in to comment.
You can’t perform that action at this time.