diff --git a/src/AbstractFilter.php b/src/AbstractFilter.php index a52bcfa7..1cb7a795 100644 --- a/src/AbstractFilter.php +++ b/src/AbstractFilter.php @@ -52,10 +52,14 @@ public function setOptions($options) } elseif (array_key_exists($key, $this->options)) { $this->options[$key] = $value; } else { - throw new Exception\InvalidArgumentException(sprintf( - 'The option "%s" does not have a matching %s setter method or options[%s] array key', - $key, $setter, $key - )); + throw new Exception\InvalidArgumentException( + sprintf( + 'The option "%s" does not have a matching %s setter method or options[%s] array key', + $key, + $setter, + $key + ) + ); } } return $this; diff --git a/src/Boolean.php b/src/Boolean.php index 4e4ea1fe..ea8ca946 100644 --- a/src/Boolean.php +++ b/src/Boolean.php @@ -67,10 +67,7 @@ public function __construct($typeOrOptions = null, $casting = true, $translation } if (is_array($typeOrOptions)) { - if (isset($typeOrOptions['type']) - || isset($typeOrOptions['casting']) - || isset($typeOrOptions['translations'])) - { + if (isset($typeOrOptions['type']) || isset($typeOrOptions['casting']) || isset($typeOrOptions['translations'])) { $this->setOptions($typeOrOptions); } else { $this->setType($typeOrOptions); diff --git a/src/Compress/Tar.php b/src/Compress/Tar.php index f8a3d312..68fc1b3b 100644 --- a/src/Compress/Tar.php +++ b/src/Compress/Tar.php @@ -45,7 +45,8 @@ public function __construct($options = null) if (!class_exists('Archive_Tar')) { throw new Exception\ExtensionNotLoadedException( 'This filter needs PEAR\'s Archive_Tar component. ' - . 'Ensure loading Archive_Tar (registering autoload or require_once)'); + . 'Ensure loading Archive_Tar (registering autoload or require_once)' + ); } parent::__construct($options); @@ -171,10 +172,9 @@ public function compress($content) if (is_dir($content)) { // collect all file infos foreach (new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($content, RecursiveDirectoryIterator::KEY_AS_PATHNAME), - RecursiveIteratorIterator::SELF_FIRST - ) as $directory => $info - ) { + new RecursiveDirectoryIterator($content, RecursiveDirectoryIterator::KEY_AS_PATHNAME), + RecursiveIteratorIterator::SELF_FIRST + ) as $directory => $info) { if ($info->isFile()) { $file[] = $directory; } diff --git a/src/Compress/Zip.php b/src/Compress/Zip.php index 5a6f01a0..86846bc6 100644 --- a/src/Compress/Zip.php +++ b/src/Compress/Zip.php @@ -228,76 +228,76 @@ public function decompress($content) public function errorString($error) { switch ($error) { - case ZipArchive::ER_MULTIDISK : + case ZipArchive::ER_MULTIDISK: return 'Multidisk ZIP Archives not supported'; - case ZipArchive::ER_RENAME : + case ZipArchive::ER_RENAME: return 'Failed to rename the temporary file for ZIP'; - case ZipArchive::ER_CLOSE : + case ZipArchive::ER_CLOSE: return 'Failed to close the ZIP Archive'; - case ZipArchive::ER_SEEK : + case ZipArchive::ER_SEEK: return 'Failure while seeking the ZIP Archive'; - case ZipArchive::ER_READ : + case ZipArchive::ER_READ: return 'Failure while reading the ZIP Archive'; - case ZipArchive::ER_WRITE : + case ZipArchive::ER_WRITE: return 'Failure while writing the ZIP Archive'; - case ZipArchive::ER_CRC : + case ZipArchive::ER_CRC: return 'CRC failure within the ZIP Archive'; - case ZipArchive::ER_ZIPCLOSED : + case ZipArchive::ER_ZIPCLOSED: return 'ZIP Archive already closed'; - case ZipArchive::ER_NOENT : + case ZipArchive::ER_NOENT: return 'No such file within the ZIP Archive'; - case ZipArchive::ER_EXISTS : + case ZipArchive::ER_EXISTS: return 'ZIP Archive already exists'; - case ZipArchive::ER_OPEN : + case ZipArchive::ER_OPEN: return 'Can not open ZIP Archive'; - case ZipArchive::ER_TMPOPEN : + case ZipArchive::ER_TMPOPEN: return 'Failure creating temporary ZIP Archive'; - case ZipArchive::ER_ZLIB : + case ZipArchive::ER_ZLIB: return 'ZLib Problem'; - case ZipArchive::ER_MEMORY : + case ZipArchive::ER_MEMORY: return 'Memory allocation problem while working on a ZIP Archive'; - case ZipArchive::ER_CHANGED : + case ZipArchive::ER_CHANGED: return 'ZIP Entry has been changed'; - case ZipArchive::ER_COMPNOTSUPP : + case ZipArchive::ER_COMPNOTSUPP: return 'Compression method not supported within ZLib'; - case ZipArchive::ER_EOF : + case ZipArchive::ER_EOF: return 'Premature EOF within ZIP Archive'; - case ZipArchive::ER_INVAL : + case ZipArchive::ER_INVAL: return 'Invalid argument for ZLIB'; - case ZipArchive::ER_NOZIP : + case ZipArchive::ER_NOZIP: return 'Given file is no zip archive'; - case ZipArchive::ER_INTERNAL : + case ZipArchive::ER_INTERNAL: return 'Internal error while working on a ZIP Archive'; - case ZipArchive::ER_INCONS : + case ZipArchive::ER_INCONS: return 'Inconsistent ZIP archive'; - case ZipArchive::ER_REMOVE : + case ZipArchive::ER_REMOVE: return 'Can not remove ZIP Archive'; - case ZipArchive::ER_DELETED : + case ZipArchive::ER_DELETED: return 'ZIP Entry has been deleted'; - default : + default: return 'Unknown error within ZIP Archive'; } } diff --git a/src/Encrypt.php b/src/Encrypt.php index adb13843..64771a5b 100644 --- a/src/Encrypt.php +++ b/src/Encrypt.php @@ -76,17 +76,20 @@ public function setAdapter($options = null) $adapter = 'Zend\Filter\Encrypt\\' . ucfirst($adapter); } elseif (!class_exists($adapter)) { throw new Exception\DomainException( - sprintf('%s expects a valid registry class name; received "%s", which did not resolve', + sprintf( + '%s expects a valid registry class name; received "%s", which did not resolve', __METHOD__, $adapter - )); + ) + ); } $this->adapter = new $adapter($options); if (!$this->adapter instanceof Encrypt\EncryptionAlgorithmInterface) { throw new Exception\InvalidArgumentException( "Encoding adapter '" . $adapter - . "' does not implement Zend\\Filter\\Encrypt\\EncryptionAlgorithmInterface"); + . "' does not implement Zend\\Filter\\Encrypt\\EncryptionAlgorithmInterface" + ); } return $this; diff --git a/src/File/Decrypt.php b/src/File/Decrypt.php index 4d84fc3b..f3f5550f 100644 --- a/src/File/Decrypt.php +++ b/src/File/Decrypt.php @@ -74,7 +74,6 @@ public function filter($value) $value = $value['tmp_name']; } - if (!file_exists($value)) { throw new Exception\InvalidArgumentException("File '$value' not found"); } diff --git a/src/File/Rename.php b/src/File/Rename.php index 4ea75c6b..6894db92 100644 --- a/src/File/Rename.php +++ b/src/File/Rename.php @@ -225,15 +225,15 @@ protected function _convertOptions($options) $files['source'] = (string) $value; break; - case 'target' : + case 'target': $files['target'] = (string) $value; break; - case 'overwrite' : + case 'overwrite': $files['overwrite'] = (bool) $value; break; - case 'randomize' : + case 'randomize': $files['randomize'] = (bool) $value; break; diff --git a/src/File/RenameUpload.php b/src/File/RenameUpload.php index 89f50bf0..1f708b85 100644 --- a/src/File/RenameUpload.php +++ b/src/File/RenameUpload.php @@ -173,7 +173,7 @@ public function filter($value) $isFileUpload = true; $uploadData = $value; $sourceFile = $value['tmp_name']; - } else{ + } else { $uploadData = array( 'tmp_name' => $value, 'name' => $value, @@ -218,7 +218,8 @@ protected function moveUploadedFile($sourceFile, $targetFile) if (!$result || null !== $warningException) { throw new Exception\RuntimeException( sprintf("File '%s' could not be renamed. An error occurred while processing the file.", $sourceFile), - 0, $warningException + 0, + $warningException ); } diff --git a/src/HtmlEntities.php b/src/HtmlEntities.php index 4eddc4f3..db07ee01 100644 --- a/src/HtmlEntities.php +++ b/src/HtmlEntities.php @@ -97,7 +97,6 @@ public function setQuoteStyle($quoteStyle) return $this; } - /** * Get encoding * @@ -105,7 +104,7 @@ public function setQuoteStyle($quoteStyle) */ public function getEncoding() { - return $this->encoding; + return $this->encoding; } /** diff --git a/src/PregReplace.php b/src/PregReplace.php index 91a59823..5e895fa4 100644 --- a/src/PregReplace.php +++ b/src/PregReplace.php @@ -32,9 +32,7 @@ public function __construct($options = null) $options = iterator_to_array($options); } - if (!is_array($options) - || (!isset($options['pattern']) && !isset($options['replacement']))) - { + if (!is_array($options) || (!isset($options['pattern']) && !isset($options['replacement']))) { $args = func_get_args(); if (isset($args[0])) { $this->setPattern($args[0]); diff --git a/src/RealPath.php b/src/RealPath.php index 3af276e2..00633d5c 100644 --- a/src/RealPath.php +++ b/src/RealPath.php @@ -73,7 +73,7 @@ public function getExists() */ public function filter($value) { - if(!is_string($value)){ + if (!is_string($value)) { return $value; } $path = (string) $value; diff --git a/src/StringToLower.php b/src/StringToLower.php index 3d6f66a4..96927387 100644 --- a/src/StringToLower.php +++ b/src/StringToLower.php @@ -54,7 +54,7 @@ public function filter($value) $value = (string) $value; if ($this->options['encoding'] !== null) { - return mb_strtolower($value, $this->options['encoding']); + return mb_strtolower($value, $this->options['encoding']); } return strtolower($value); diff --git a/src/StringToUpper.php b/src/StringToUpper.php index 7f4c78e1..0ddcc020 100644 --- a/src/StringToUpper.php +++ b/src/StringToUpper.php @@ -54,7 +54,7 @@ public function filter($value) $value = (string) $value; if ($this->options['encoding'] !== null) { - return mb_strtoupper($value, $this->options['encoding']); + return mb_strtoupper($value, $this->options['encoding']); } return strtoupper($value); diff --git a/src/StringTrim.php b/src/StringTrim.php index 02692eb4..45f35f56 100644 --- a/src/StringTrim.php +++ b/src/StringTrim.php @@ -28,9 +28,7 @@ class StringTrim extends AbstractFilter public function __construct($charlistOrOptions = null) { if ($charlistOrOptions !== null) { - if (!is_array($charlistOrOptions) - && !$charlistOrOptions instanceof Traversable) - { + if (!is_array($charlistOrOptions) && !$charlistOrOptions instanceof Traversable) { $this->setCharList($charlistOrOptions); } else { $this->setOptions($charlistOrOptions); diff --git a/src/StripNewlines.php b/src/StripNewlines.php index 7ce57202..481facaa 100644 --- a/src/StripNewlines.php +++ b/src/StripNewlines.php @@ -11,7 +11,6 @@ class StripNewlines extends AbstractFilter { - /** * Defined by Zend\Filter\FilterInterface * diff --git a/src/StripTags.php b/src/StripTags.php index 7caf4605..4260e113 100644 --- a/src/StripTags.php +++ b/src/StripTags.php @@ -105,9 +105,8 @@ public function setTagsAllowed($tagsAllowed) $tagName = strtolower($element); // Store the tag as allowed with no attributes $this->tagsAllowed[$tagName] = array(); - } - // Otherwise, if a tag was provided with attributes - elseif (is_string($index) && (is_array($element) || is_string($element))) { + } elseif (is_string($index) && (is_array($element) || is_string($element))) { + // Otherwise, if a tag was provided with attributes // Canonicalize the tag name $tagName = strtolower($index); // Canonicalize the attributes @@ -189,7 +188,7 @@ public function filter($value) if (!preg_match('/--\s*>/s', $value)) { $value = ''; } else { - $value = preg_replace('/<(?:!(?:--[\s\S]*?--\s*)?(>))/s', '', $value); + $value = preg_replace('/<(?:!(?:--[\s\S]*?--\s*)?(>))/s', '', $value); } $value = $start . $value; diff --git a/src/UriNormalize.php b/src/UriNormalize.php index b7e9bba1..0ab20152 100644 --- a/src/UriNormalize.php +++ b/src/UriNormalize.php @@ -101,7 +101,6 @@ public function filter($value) if ($this->enforcedScheme && (!$uri->getScheme())) { $this->enforceScheme($uri); } - } catch (UriException $ex) { // We are unable to parse / enfore scheme with the given config and input return $value; diff --git a/src/Word/AbstractSeparator.php b/src/Word/AbstractSeparator.php index 2fe70d3d..598b0a0b 100644 --- a/src/Word/AbstractSeparator.php +++ b/src/Word/AbstractSeparator.php @@ -14,7 +14,6 @@ abstract class AbstractSeparator extends AbstractFilter { - protected $separator = ' '; /** diff --git a/test/BaseNameTest.php b/test/BaseNameTest.php index d00047ec..415f5a10 100644 --- a/test/BaseNameTest.php +++ b/test/BaseNameTest.php @@ -15,7 +15,6 @@ */ class BaseNameTest extends \PHPUnit_Framework_TestCase { - /** * Ensures that the filter follows expected behavior * diff --git a/test/Compress/RarTest.php b/test/Compress/RarTest.php index 651a1325..5480900e 100644 --- a/test/Compress/RarTest.php +++ b/test/Compress/RarTest.php @@ -197,7 +197,6 @@ public function testSettingCallback() $callback = array(__CLASS__, 'rarCompress'); $filter->setCallback($callback); $this->assertEquals($callback, $filter->getCallback()); - } public function testSettingCallbackThrowsExceptionOnMissingCallback() diff --git a/test/Compress/ZipTest.php b/test/Compress/ZipTest.php index 10a55978..0b921917 100644 --- a/test/Compress/ZipTest.php +++ b/test/Compress/ZipTest.php @@ -54,7 +54,6 @@ public function setUp() file_put_contents($this->tmp . '/Compress/First/zipextracted.txt', 'compress me'); file_put_contents($this->tmp . '/Compress/zipextracted.txt', 'compress me'); } - } public function tearDown() diff --git a/test/Encrypt/BlockCipherTest.php b/test/Encrypt/BlockCipherTest.php index c7b9e654..346b11a0 100644 --- a/test/Encrypt/BlockCipherTest.php +++ b/test/Encrypt/BlockCipherTest.php @@ -54,7 +54,6 @@ public function testBasicBlockCipher() */ public function testGetSetVector() { - $filter = new BlockCipherEncryption(array('key' => 'testkey')); $filter->setVector('1234567890123456'); $this->assertEquals('1234567890123456', $filter->getVector()); diff --git a/test/Encrypt/OpensslTest.php b/test/Encrypt/OpensslTest.php index 33461c45..023195c6 100644 --- a/test/Encrypt/OpensslTest.php +++ b/test/Encrypt/OpensslTest.php @@ -137,7 +137,6 @@ public function testSetPublicKey() $this->setExpectedException('\Zend\Filter\Exception\InvalidArgumentException', 'not valid'); $filter->setPublicKey(123); - } /** @@ -170,7 +169,6 @@ public function testSetPrivateKey() $this->setExpectedException('\Zend\Filter\Exception\InvalidArgumentException', 'not valid'); $filter->setPrivateKey(123); - } /** diff --git a/test/File/EncryptTest.php b/test/File/EncryptTest.php index 5105318f..16d9cbf5 100644 --- a/test/File/EncryptTest.php +++ b/test/File/EncryptTest.php @@ -16,7 +16,6 @@ */ class EncryptTest extends \PHPUnit_Framework_TestCase { - public function setUp() { if (! extension_loaded('mcrypt')) { diff --git a/test/PregReplaceTest.php b/test/PregReplaceTest.php index 58580ef1..5f1ce7b4 100644 --- a/test/PregReplaceTest.php +++ b/test/PregReplaceTest.php @@ -17,7 +17,6 @@ */ class PregReplaceTest extends \PHPUnit_Framework_TestCase { - /** * * @var PregReplaceFilter diff --git a/test/StripNewlinesTest.php b/test/StripNewlinesTest.php index e300c092..b1efcffd 100644 --- a/test/StripNewlinesTest.php +++ b/test/StripNewlinesTest.php @@ -15,7 +15,6 @@ */ class StripNewlinesTest extends \PHPUnit_Framework_TestCase { - /** * Ensures that the filter follows expected behavior * diff --git a/test/Word/DashToSeparatorTest.php b/test/Word/DashToSeparatorTest.php index 0a80ed33..e44d4322 100644 --- a/test/Word/DashToSeparatorTest.php +++ b/test/Word/DashToSeparatorTest.php @@ -75,5 +75,4 @@ public function testReturnUnfiltered($input) $this->assertEquals($input, $filter($input)); } - } diff --git a/test/Word/SeparatorToDashTest.php b/test/Word/SeparatorToDashTest.php index c91dbde0..8451d703 100644 --- a/test/Word/SeparatorToDashTest.php +++ b/test/Word/SeparatorToDashTest.php @@ -37,5 +37,4 @@ public function testFilterSeparatesDashedWordsWithSomeString() $this->assertNotEquals($string, $filtered); $this->assertEquals('dash-separated-words', $filtered); } - } diff --git a/test/Word/UnderscoreToSeparatorTest.php b/test/Word/UnderscoreToSeparatorTest.php index 34d04851..9f4e3449 100644 --- a/test/Word/UnderscoreToSeparatorTest.php +++ b/test/Word/UnderscoreToSeparatorTest.php @@ -37,5 +37,4 @@ public function testFilterSeparatesCamelCasedWordsProvidedSeparator() $this->assertNotEquals($string, $filtered); $this->assertEquals('underscore:=:separated:=:words', $filtered); } - }