Permalink
Browse files

CS fixes

  • Loading branch information...
1 parent b1f9ff6 commit 09b5907ad00647d420d12e70874377a34735db3d @shevron shevron committed Aug 21, 2012
Showing with 42 additions and 12 deletions.
  1. +26 −10 library/Zend/Filter/UriNormalize.php
  2. +16 −2 tests/ZendTest/Filter/UriNormalizeTest.php
@@ -1,13 +1,25 @@
<?php
+/**
+ * Zend Framework (http://framework.zend.com/)
+ *
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @package Zend_Filter
+ */
namespace Zend\Filter;
-use Zend\Filter\AbstractFilter,
- Zend\Filter\Exception\InvalidArgumentException,
- Zend\Uri\UriFactory,
- Zend\Uri\Uri,
- Zend\Uri\Exception\ExceptionInterface as UriException;
+use Zend\Filter\AbstractFilter;
+use Zend\Filter\Exception\InvalidArgumentException;
+use Zend\Uri\UriFactory;
+use Zend\Uri\Uri;
+use Zend\Uri\Exception\ExceptionInterface as UriException;
+/**
+ * @category Zend
+ * @package Zend_Filter
+ */
class UriNormalize extends AbstractFilter
{
/**
@@ -32,7 +44,9 @@ class UriNormalize extends AbstractFilter
*/
public function __construct($options = null)
{
- if ($options) $this->setOptions($options);
+ if ($options) {
+ $this->setOptions($options);
+ }
}
/**
@@ -81,13 +95,13 @@ public function filter($value)
$defaultScheme = $this->defaultScheme ?: $this->enforcedScheme;
// Reset default scheme if it is not a known scheme
- if (! UriFactory::getRegisteredSchemeClass($defaultScheme)) {
+ if (!UriFactory::getRegisteredSchemeClass($defaultScheme)) {
$defaultScheme = null;
}
try {
$uri = UriFactory::factory($value, $defaultScheme);
- if ($this->enforcedScheme && (! $uri->getScheme())) {
+ if ($this->enforcedScheme && (!$uri->getScheme())) {
$this->enforceScheme($uri);
}
@@ -98,7 +112,7 @@ public function filter($value)
$uri->normalize();
- if (! $uri->isValid()) {
+ if (!$uri->isValid()) {
return $value;
}
@@ -125,7 +139,9 @@ protected function enforceScheme(Uri $uri)
}
// We have nothing to do if we have no host
- if (! $host) return;
+ if (!$host) {
+ return;
+ }
$uri->setScheme($this->enforcedScheme)
->setHost($host)
@@ -1,9 +1,23 @@
<?php
+/**
+ * Zend Framework (http://framework.zend.com/)
+ *
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @package Zend_Filter
+ */
namespace ZendTest\Filter;
use Zend\Filter\UriNormalize;
+/**
+ * @category Zend
+ * @package Zend_Filter
+ * @subpackage UnitTests
+ * @group Zend_Filter
+ */
class UriNormalizeTest extends \PHPUnit_Framework_TestCase
{
/**
@@ -31,7 +45,7 @@ public function testEnforcedScheme($scheme, $input, $expected)
$this->assertEquals($expected, $result);
}
- static public function abnormalUriProvider()
+ public static function abnormalUriProvider()
{
return array(
array('http://www.example.com', 'http://www.example.com/'),
@@ -43,7 +57,7 @@ static public function abnormalUriProvider()
);
}
- static public function enforcedSchemeTestcaseProvider()
+ public static function enforcedSchemeTestcaseProvider()
{
return array(
array('ftp', 'http://www.example.com', 'http://www.example.com/'), // no effect - this one has a scheme

0 comments on commit 09b5907

Please sign in to comment.