diff --git a/Behavioral/ChainOfResponsibilities/ChainTest.php b/Behavioral/ChainOfResponsibilities/ChainTest.php
index 23e5625..9fe7f30 100644
--- a/Behavioral/ChainOfResponsibilities/ChainTest.php
+++ b/Behavioral/ChainOfResponsibilities/ChainTest.php
@@ -45,7 +45,8 @@ class ChainTest extends \PHPUnit_Framework_TestCase
$this->assertObjectHasAttribute('response', $request);
$this->assertEquals('baz', $request->response);
// despite both handle owns the 'bar' key, the FastStorage is responding first
- $this->assertEquals('DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\FastStorage', $request->forDebugOnly);
+ $className = 'DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\FastStorage';
+ $this->assertEquals($className, $request->forDebugOnly);
}
/**
@@ -60,7 +61,8 @@ class ChainTest extends \PHPUnit_Framework_TestCase
$this->assertObjectHasAttribute('response', $request);
$this->assertEquals('bar', $request->response);
// FastStorage has no 'foo' key, the SlowStorage is responding
- $this->assertEquals('DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage', $request->forDebugOnly);
+ $className = 'DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage';
+ $this->assertEquals($className, $request->forDebugOnly);
}
/**
@@ -73,6 +75,7 @@ class ChainTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($ret);
// the last responsible :
- $this->assertEquals('DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage', $request->forDebugOnly);
+ $className = 'DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage';
+ $this->assertEquals($className, $request->forDebugOnly);
}
}
diff --git a/Behavioral/Iterator/BookList.php b/Behavioral/Iterator/BookList.php
index eb9a8be..0dda925 100644
--- a/Behavioral/Iterator/BookList.php
+++ b/Behavioral/Iterator/BookList.php
@@ -13,7 +13,7 @@ class BookList implements \Countable
return $this->books[$bookNumberToGet];
}
- return NULL;
+ return null;
}
public function addBook(Book $book)
diff --git a/Behavioral/Iterator/BookListIterator.php b/Behavioral/Iterator/BookListIterator.php
index d0992c6..bc15ffb 100644
--- a/Behavioral/Iterator/BookListIterator.php
+++ b/Behavioral/Iterator/BookListIterator.php
@@ -74,4 +74,4 @@ class BookListIterator implements \Iterator
{
$this->currentBook = 0;
}
-}
\ No newline at end of file
+}
diff --git a/Behavioral/Iterator/BookListReverseIterator.php b/Behavioral/Iterator/BookListReverseIterator.php
index 2e38f63..973bd0b 100644
--- a/Behavioral/Iterator/BookListReverseIterator.php
+++ b/Behavioral/Iterator/BookListReverseIterator.php
@@ -20,4 +20,4 @@ class BookListReverseIterator extends BookListIterator
{
return 0 <= $this->currentBook;
}
-}
\ No newline at end of file
+}
diff --git a/Behavioral/Iterator/IteratorTest.php b/Behavioral/Iterator/IteratorTest.php
index e9e553d..83cdb0f 100644
--- a/Behavioral/Iterator/IteratorTest.php
+++ b/Behavioral/Iterator/IteratorTest.php
@@ -63,4 +63,4 @@ class IteratorTest extends \PHPUnit_Framework_TestCase
$iterator->next();
}
}
-}
\ No newline at end of file
+}
diff --git a/Behavioral/Observer/ObserverTest.php b/Behavioral/Observer/ObserverTest.php
index 86a3e9b..0ecd9c9 100644
--- a/Behavioral/Observer/ObserverTest.php
+++ b/Behavioral/Observer/ObserverTest.php
@@ -53,10 +53,9 @@ class ObserverTest extends \PHPUnit_Framework_TestCase
$subject->attach($observer);
$observer->expects($this->once())
- ->method('update')
- ->with($subject);
+ ->method('update')
+ ->with($subject);
$subject->notify();
}
-
-}
\ No newline at end of file
+}
diff --git a/Behavioral/Specification/AbstractSpecification.php b/Behavioral/Specification/AbstractSpecification.php
index 8ece67b..f297539 100644
--- a/Behavioral/Specification/AbstractSpecification.php
+++ b/Behavioral/Specification/AbstractSpecification.php
@@ -8,18 +8,18 @@ abstract class AbstractSpecification implements SpecificationInterface
{
/**
* Checks if given item meets all criteria
- *
+ *
* @param Item $item
- *
+ *
* @return bool
*/
abstract public function isSatisfiedBy(Item $item);
/**
* Creates a new logical AND specification
- *
+ *
* @param SpecificationInterface $spec
- *
+ *
* @return SpecificationInterface
*/
public function plus(SpecificationInterface $spec)
@@ -29,9 +29,9 @@ abstract class AbstractSpecification implements SpecificationInterface
/**
* Creates a new logical OR composite specification
- *
+ *
* @param SpecificationInterface $spec
- *
+ *
* @return SpecificationInterface
*/
public function either(SpecificationInterface $spec)
@@ -41,11 +41,11 @@ abstract class AbstractSpecification implements SpecificationInterface
/**
* Creates a new logical NOT specification
- *
+ *
* @return SpecificationInterface
*/
public function not()
{
return new Not($this);
}
-}
\ No newline at end of file
+}
diff --git a/Behavioral/Specification/Not.php b/Behavioral/Specification/Not.php
index ea06f53..f46999d 100644
--- a/Behavioral/Specification/Not.php
+++ b/Behavioral/Specification/Not.php
@@ -31,4 +31,4 @@ class Not extends AbstractSpecification
{
return !$this->spec->isSatisfiedBy($item);
}
-}
\ No newline at end of file
+}
diff --git a/Behavioral/Specification/Plus.php b/Behavioral/Specification/Plus.php
index 9762c15..c4ad546 100644
--- a/Behavioral/Specification/Plus.php
+++ b/Behavioral/Specification/Plus.php
@@ -12,10 +12,9 @@ class Plus extends AbstractSpecification
/**
* Creation of a locical AND of two specifications
- *
+ *
* @param SpecificationInterface $left
* @param SpecificationInterface $right
-
*/
public function __construct(SpecificationInterface $left, SpecificationInterface $right)
{
@@ -25,13 +24,13 @@ class Plus extends AbstractSpecification
/**
* Checks if the composite AND of specifications passes
- *
+ *
* @param Item $item
- *
+ *
* @return bool
*/
public function isSatisfiedBy(Item $item)
{
return $this->left->isSatisfiedBy($item) && $this->right->isSatisfiedBy($item);
}
-}
\ No newline at end of file
+}
diff --git a/Behavioral/Specification/PriceSpecification.php b/Behavioral/Specification/PriceSpecification.php
index fa74d2a..747efdf 100644
--- a/Behavioral/Specification/PriceSpecification.php
+++ b/Behavioral/Specification/PriceSpecification.php
@@ -31,17 +31,17 @@ class PriceSpecification extends AbstractSpecification
/**
* Checks if Item price falls between bounds
- *
+ *
* @param Item $item
- *
+ *
* @return bool
*/
public function isSatisfiedBy(Item $item)
{
- if ( !empty($this->maxPrice) && $item->getPrice() > $this->maxPrice) {
+ if (!empty($this->maxPrice) && $item->getPrice() > $this->maxPrice) {
return false;
}
- if ( !empty($this->minPrice) && $item->getPrice() < $this->minPrice) {
+ if (!empty($this->minPrice) && $item->getPrice() < $this->minPrice) {
return false;
}
diff --git a/Behavioral/Specification/SpecificationInterface.php b/Behavioral/Specification/SpecificationInterface.php
index a00712f..e4e15a2 100644
--- a/Behavioral/Specification/SpecificationInterface.php
+++ b/Behavioral/Specification/SpecificationInterface.php
@@ -8,26 +8,24 @@ interface SpecificationInterface
{
/**
* A boolean evaluation indicating if the object meets the specification
- *
+ *
* @param Item $item
- *
+ *
* @return bool
*/
public function isSatisfiedBy(Item $item);
/**
* Creates a logical AND specification
- *
+ *
* @param SpecificationInterface $spec
-
*/
public function plus(SpecificationInterface $spec);
/**
* Creates a logical OR specification
- *
+ *
* @param SpecificationInterface $spec
-
*/
public function either(SpecificationInterface $spec);
@@ -35,4 +33,4 @@ interface SpecificationInterface
* Creates a logical not specification
*/
public function not();
-}
\ No newline at end of file
+}
diff --git a/Behavioral/Strategy/ObjectCollection.php b/Behavioral/Strategy/ObjectCollection.php
index 1006f8f..1b4fa88 100644
--- a/Behavioral/Strategy/ObjectCollection.php
+++ b/Behavioral/Strategy/ObjectCollection.php
@@ -30,10 +30,10 @@ class ObjectCollection
*/
public function sort()
{
- if (!$this->comparator){
- throw new \LogicException("Comparator is not set");
+ if (!$this->comparator) {
+ throw new \LogicException("Comparator is not set");
}
-
+
$callback = array($this->comparator, 'compare');
uasort($this->elements, $callback);
diff --git a/Behavioral/TemplateMethod/JourneyTest.php b/Behavioral/TemplateMethod/JourneyTest.php
index 34b576b..b99f2aa 100644
--- a/Behavioral/TemplateMethod/JourneyTest.php
+++ b/Behavioral/TemplateMethod/JourneyTest.php
@@ -31,8 +31,8 @@ class JourneyTest extends \PHPUnit_Framework_TestCase
{
$journey = $this->getMockForAbstractClass('DesignPatterns\Behavioral\TemplateMethod\Journey');
$journey->expects($this->once())
- ->method('enjoyVacation')
- ->will($this->returnCallback(array($this, 'mockUpVacation')));
+ ->method('enjoyVacation')
+ ->will($this->returnCallback(array($this, 'mockUpVacation')));
$this->expectOutputRegex('#Las Vegas#');
$journey->takeATrip();
}
@@ -41,5 +41,4 @@ class JourneyTest extends \PHPUnit_Framework_TestCase
{
echo "Fear and loathing in Las Vegas\n";
}
-
-}
\ No newline at end of file
+}
diff --git a/Behavioral/Visitor/VisitorTest.php b/Behavioral/Visitor/VisitorTest.php
index fd21dea..104c770 100644
--- a/Behavioral/Visitor/VisitorTest.php
+++ b/Behavioral/Visitor/VisitorTest.php
@@ -43,5 +43,4 @@ class VisitorTest extends \PHPUnit_Framework_TestCase
$mock = $this->getMockForAbstractClass('DesignPatterns\Behavioral\Visitor\Role');
$mock->accept($this->visitor);
}
-
-}
\ No newline at end of file
+}
diff --git a/Creational/Pool/Pool.php b/Creational/Pool/Pool.php
index dcd1611..e3a809b 100644
--- a/Creational/Pool/Pool.php
+++ b/Creational/Pool/Pool.php
@@ -7,7 +7,7 @@ class Pool
private $instances = array();
private $class;
-
+
public function __construct($class)
{
$this->class = $class;
@@ -26,5 +26,4 @@ class Pool
{
$this->instances[] = $instance;
}
-
}
diff --git a/Creational/Pool/PoolTest.php b/Creational/Pool/PoolTest.php
index f52d2f9..e0b062d 100644
--- a/Creational/Pool/PoolTest.php
+++ b/Creational/Pool/PoolTest.php
@@ -2,8 +2,6 @@
namespace DesignPatterns\Creational\Pool;
-use DesignPatterns\Creational\Pool\Pool;
-
class TestWorker
{
@@ -27,4 +25,3 @@ class PoolTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(1, $pool->get()->id);
}
}
-
diff --git a/Creational/Pool/Processor.php b/Creational/Pool/Processor.php
index 47523b0..0bb5e67 100644
--- a/Creational/Pool/Processor.php
+++ b/Creational/Pool/Processor.php
@@ -49,5 +49,4 @@ class Processor
{
return array_pop($this->waitingQueue);
}
-
}
diff --git a/Creational/Pool/Worker.php b/Creational/Pool/Worker.php
index a176372..acdc1ba 100644
--- a/Creational/Pool/Worker.php
+++ b/Creational/Pool/Worker.php
@@ -17,5 +17,4 @@ class Worker
// and when it's done, execute callback
call_user_func($callback, $this);
}
-
}
diff --git a/Creational/SimpleFactory/SimpleFactoryTest.php b/Creational/SimpleFactory/SimpleFactoryTest.php
index 0c2c470..1233609 100644
--- a/Creational/SimpleFactory/SimpleFactoryTest.php
+++ b/Creational/SimpleFactory/SimpleFactoryTest.php
@@ -41,5 +41,4 @@ class SimpleFactoryTest extends \PHPUnit_Framework_TestCase
{
$this->factory->createVehicle('car');
}
-
-}
\ No newline at end of file
+}
diff --git a/Structural/Adapter/AdapterTest.php b/Structural/Adapter/AdapterTest.php
index 55cc5e2..0d86739 100644
--- a/Structural/Adapter/AdapterTest.php
+++ b/Structural/Adapter/AdapterTest.php
@@ -33,7 +33,7 @@ class AdapterTest extends \PHPUnit_Framework_TestCase
*
* @dataProvider getBook
*/
- public function test_I_am_an_old_Client(PaperBookInterface $book)
+ public function testIAmAnOldClient(PaperBookInterface $book)
{
$book->open();
$book->turnPage();
diff --git a/Structural/Composite/CompositeTest.php b/Structural/Composite/CompositeTest.php
index d6472a3..50b3131 100644
--- a/Structural/Composite/CompositeTest.php
+++ b/Structural/Composite/CompositeTest.php
@@ -29,6 +29,8 @@ class CompositeTest extends \PHPUnit_Framework_TestCase
*/
public function testFormImplementsFormEelement()
{
- $this->assertTrue(is_subclass_of('DesignPatterns\Structural\Composite\Form', 'DesignPatterns\Structural\Composite\FormElement'));
+ $className = 'DesignPatterns\Structural\Composite\Form';
+ $abstractName = 'DesignPatterns\Structural\Composite\FormElement';
+ $this->assertTrue(is_subclass_of($className, $abstractName));
}
}
diff --git a/Structural/DataMapper/DataMapperTest.php b/Structural/DataMapper/DataMapperTest.php
index e6b110e..b5f7c4c 100644
--- a/Structural/DataMapper/DataMapperTest.php
+++ b/Structural/DataMapper/DataMapperTest.php
@@ -65,7 +65,12 @@ class DataMapperTest extends \PHPUnit_Framework_TestCase
*/
public function testRestoreOne(User $existing)
{
- $rows = new \ArrayIterator(array(array('userid' => 1, 'username' => 'Odysseus', 'email' => 'Odysseus@ithaca.gr')));
+ $row = array(
+ 'userid' => 1,
+ 'username' => 'Odysseus',
+ 'email' => 'Odysseus@ithaca.gr'
+ );
+ $rows = new \ArrayIterator(array($row));
$this->dbal->expects($this->once())
->method('find')
->with(1)
diff --git a/Structural/Decorator/DecoratorTest.php b/Structural/Decorator/DecoratorTest.php
index 9414524..31adc2f 100644
--- a/Structural/Decorator/DecoratorTest.php
+++ b/Structural/Decorator/DecoratorTest.php
@@ -30,7 +30,8 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase
// Wrap service with a JSON decorator for renderers
$service = new Decorator\RenderInXml($this->service);
// Our Renderer will now output XML instead of an array
- $this->assertXmlStringEqualsXmlString('bar', $service->renderData());
+ $xml = 'bar';
+ $this->assertXmlStringEqualsXmlString($xml, $service->renderData());
}
/**
@@ -38,7 +39,9 @@ class DecoratorTest extends \PHPUnit_Framework_TestCase
*/
public function testDecoratorMustImplementsRenderer()
{
- $this->assertTrue(is_subclass_of('DesignPatterns\Structural\Decorator\Decorator', 'DesignPatterns\Structural\Decorator\RendererInterface'));
+ $className = 'DesignPatterns\Structural\Decorator\Decorator';
+ $interfaceName = 'DesignPatterns\Structural\Decorator\RendererInterface';
+ $this->assertTrue(is_subclass_of($className, $interfaceName));
}
/**
diff --git a/Structural/DependencyInjection/ArrayConfig.php b/Structural/DependencyInjection/ArrayConfig.php
index 15a9462..91bca33 100644
--- a/Structural/DependencyInjection/ArrayConfig.php
+++ b/Structural/DependencyInjection/ArrayConfig.php
@@ -13,10 +13,11 @@ class ArrayConfig extends AbstractConfig implements Parameters
* Get parameter
*
* @param string|int $key
- *
+ * @param null $default
* @return mixed
*/
- public function get($key, $default = null) {
+ public function get($key, $default = null)
+ {
if (isset($this->storage[$key])) {
return $this->storage[$key];
}
@@ -27,7 +28,7 @@ class ArrayConfig extends AbstractConfig implements Parameters
* Set parameter
*
* @param string|int $key
- * @param mixed $value
+ * @param mixed $value
*/
public function set($key, $value)
{
diff --git a/Structural/DependencyInjection/Parameters.php b/Structural/DependencyInjection/Parameters.php
index 679df3a..dabe895 100644
--- a/Structural/DependencyInjection/Parameters.php
+++ b/Structural/DependencyInjection/Parameters.php
@@ -5,13 +5,13 @@ namespace DesignPatterns\Structural\DependencyInjection;
/**
* Parameters interface
*/
-interface Parameters
+interface Parameters
{
/**
* Get parameter
*
* @param string|int $key
- *
+ *
* @return mixed
*/
public function get($key);