From 8b82ed198da13d46541c52ef365b65e401e563ac Mon Sep 17 00:00:00 2001 From: Dominik Liebler Date: Fri, 13 Sep 2013 14:19:55 +0200 Subject: [PATCH] cs --- Adapter/EBookAdapter.php | 4 --- Builder/BikeBuilder.php | 4 --- Builder/Builder.php | 32 ++++++++++++------- Builder/CarBuilder.php | 7 +--- Builder/Director.php | 4 --- Builder/Parts/Bike.php | 8 ++--- Builder/Parts/Car.php | 8 ++--- Builder/Parts/Door.php | 7 ++-- Builder/Parts/Engine.php | 7 ++-- Builder/Parts/Vehicle.php | 15 +++++---- .../ChainOfResponsibilities.php | 2 +- ChainOfResponsibilities/Handler.php | 10 +++--- ChainOfResponsibilities/Request.php | 6 +--- .../Responsible/FastStorage.php | 5 --- .../Responsible/SlowStorage.php | 13 ++++---- Command/Invoker.php | 4 --- Command/Receiver.php | 4 --- FactoryMethod/Bicycle.php | 2 +- FactoryMethod/FactoryMethod.php | 4 +-- FactoryMethod/Ferrari.php | 2 +- FactoryMethod/Porsche.php | 2 +- .../{Vehicle.php => VehicleInterface.php} | 6 ++-- Mediator/Colleague.php | 17 +++++----- Mediator/Mediator.php | 4 --- Mediator/Subsystem/Client.php | 6 +--- Mediator/Subsystem/Database.php | 6 +--- Mediator/Subsystem/Server.php | 7 +--- State/OrderFactory.php | 2 +- Tests/AbstractFactory/AbstractFactoryTest.php | 2 +- Tests/Adapter/AdapterTest.php | 7 +--- Tests/Builder/DirectorTest.php | 7 +--- Tests/ChainOfResponsibilities/ChainTest.php | 7 +--- Tests/Command/CommandTest.php | 7 +--- Tests/Composite/FormTest.php | 7 +--- Tests/DataMapper/UserMapperTest.php | 5 --- Tests/Decorator/DecoratorTest.php | 7 +--- Tests/Facade/FacadeTest.php | 7 +--- Tests/FactoryMethod/FactoryMethodTest.php | 9 ++---- Tests/FluentInterface/FluentInterfaceTest.php | 7 +--- Tests/Iterator/IteratorTest.php | 7 +--- Tests/Mediator/MediatorTest.php | 7 +--- Tests/NullObject/LoggerTest.php | 7 +--- Tests/SimpleFactory/SimpleFactoryTest.php | 4 --- Tests/Singleton/SingletonTest.php | 7 +--- Tests/StaticFactory/StaticFactoryTest.php | 1 - Tests/TemplateMethod/JourneyTest.php | 4 --- Tests/Visitor/VisitorTest.php | 4 --- 47 files changed, 93 insertions(+), 218 deletions(-) rename FactoryMethod/{Vehicle.php => VehicleInterface.php} (56%) diff --git a/Adapter/EBookAdapter.php b/Adapter/EBookAdapter.php index c572f67..9677553 100644 --- a/Adapter/EBookAdapter.php +++ b/Adapter/EBookAdapter.php @@ -1,9 +1,5 @@ car; } - -} \ No newline at end of file +} diff --git a/Builder/Director.php b/Builder/Director.php index 7a55a0d..32ffaa7 100644 --- a/Builder/Director.php +++ b/Builder/Director.php @@ -1,9 +1,5 @@ data[$key] = $value; } - -} \ No newline at end of file +} diff --git a/ChainOfResponsibilities/ChainOfResponsibilities.php b/ChainOfResponsibilities/ChainOfResponsibilities.php index 5b2686d..257f7c9 100644 --- a/ChainOfResponsibilities/ChainOfResponsibilities.php +++ b/ChainOfResponsibilities/ChainOfResponsibilities.php @@ -93,4 +93,4 @@ $fastStorage->get('bar'); // will be handled by FastStorage /** * In this example we could also add a abstract class and extend it to build Fast- and SlowStorage. That class would * then manage the chain and when the cache hits a "miss", it would check if there is a next handler - */ \ No newline at end of file + */ diff --git a/ChainOfResponsibilities/Handler.php b/ChainOfResponsibilities/Handler.php index 907e6a9..1883ec3 100644 --- a/ChainOfResponsibilities/Handler.php +++ b/ChainOfResponsibilities/Handler.php @@ -1,9 +1,5 @@ _data = $data; @@ -34,11 +35,11 @@ class SlowStorage extends Handler if ('get' === $req->verb) { if (array_key_exists($req->key, $this->_data)) { $req->response = $this->_data[$req->key]; + return true; } } return false; } - } diff --git a/Command/Invoker.php b/Command/Invoker.php index f3013e6..6f857ec 100644 --- a/Command/Invoker.php +++ b/Command/Invoker.php @@ -1,9 +1,5 @@ mediator; } + /** + * @param MediatorInterface $medium + */ public function __construct(MediatorInterface $medium) { // in this way, we are sure the concrete colleague knows the mediator $this->mediator = $medium; } - -} \ No newline at end of file +} diff --git a/Mediator/Mediator.php b/Mediator/Mediator.php index 98b34a1..7de6669 100644 --- a/Mediator/Mediator.php +++ b/Mediator/Mediator.php @@ -1,9 +1,5 @@ getMediator()->queryDb(); $this->getMediator()->sendResponse("Hello $data"); } - -} \ No newline at end of file +} diff --git a/State/OrderFactory.php b/State/OrderFactory.php index 55c7d80..0e61758 100644 --- a/State/OrderFactory.php +++ b/State/OrderFactory.php @@ -32,4 +32,4 @@ class OrderFactory break; } } -} \ No newline at end of file +} diff --git a/Tests/AbstractFactory/AbstractFactoryTest.php b/Tests/AbstractFactory/AbstractFactoryTest.php index 0ee562a..581c068 100644 --- a/Tests/AbstractFactory/AbstractFactoryTest.php +++ b/Tests/AbstractFactory/AbstractFactoryTest.php @@ -41,4 +41,4 @@ class AbstractFactoryTest extends \PHPUnit_Framework_TestCase * a given Abstract Factory */ } -} \ No newline at end of file +} diff --git a/Tests/Adapter/AdapterTest.php b/Tests/Adapter/AdapterTest.php index 7473de6..370a6c3 100644 --- a/Tests/Adapter/AdapterTest.php +++ b/Tests/Adapter/AdapterTest.php @@ -1,9 +1,5 @@ open(); $book->turnPage(); } - -} \ No newline at end of file +} diff --git a/Tests/Builder/DirectorTest.php b/Tests/Builder/DirectorTest.php index 83e2234..3d3e2cf 100644 --- a/Tests/Builder/DirectorTest.php +++ b/Tests/Builder/DirectorTest.php @@ -1,9 +1,5 @@ director->build($builder); $this->assertInstanceOf('DesignPatterns\Builder\Parts\Vehicle', $newVehicle); } - -} \ No newline at end of file +} diff --git a/Tests/ChainOfResponsibilities/ChainTest.php b/Tests/ChainOfResponsibilities/ChainTest.php index 337559b..e4ab54c 100644 --- a/Tests/ChainOfResponsibilities/ChainTest.php +++ b/Tests/ChainOfResponsibilities/ChainTest.php @@ -1,9 +1,5 @@ assertEquals('DesignPatterns\ChainOfResponsibilities\Responsible\SlowStorage', $request->forDebugOnly); } - -} \ No newline at end of file +} diff --git a/Tests/Command/CommandTest.php b/Tests/Command/CommandTest.php index 0df7f9e..7400139 100644 --- a/Tests/Command/CommandTest.php +++ b/Tests/Command/CommandTest.php @@ -1,9 +1,5 @@ expectOutputString('Hello World'); $this->invoker->run(); } - -} \ No newline at end of file +} diff --git a/Tests/Composite/FormTest.php b/Tests/Composite/FormTest.php index 41cf904..8a2aae3 100644 --- a/Tests/Composite/FormTest.php +++ b/Tests/Composite/FormTest.php @@ -1,9 +1,5 @@ assertTrue(is_subclass_of('DesignPatterns\Composite\Form', 'DesignPatterns\Composite\FormElement')); } - -} \ No newline at end of file +} diff --git a/Tests/DataMapper/UserMapperTest.php b/Tests/DataMapper/UserMapperTest.php index 2bce7b6..bd2d1c1 100644 --- a/Tests/DataMapper/UserMapperTest.php +++ b/Tests/DataMapper/UserMapperTest.php @@ -1,9 +1,5 @@ mapper->findById(404); } - } diff --git a/Tests/Decorator/DecoratorTest.php b/Tests/Decorator/DecoratorTest.php index 7f20bb6..c6202dd 100644 --- a/Tests/Decorator/DecoratorTest.php +++ b/Tests/Decorator/DecoratorTest.php @@ -1,9 +1,5 @@ getMockForAbstractClass('DesignPatterns\Decorator\Decorator', array($mock)); $this->assertNotNull($dec); } - -} \ No newline at end of file +} diff --git a/Tests/Facade/FacadeTest.php b/Tests/Facade/FacadeTest.php index 868ed32..0d91521 100644 --- a/Tests/Facade/FacadeTest.php +++ b/Tests/Facade/FacadeTest.php @@ -1,9 +1,5 @@ assertEquals('Linux', $os->getName()); } - -} \ No newline at end of file +} diff --git a/Tests/FactoryMethod/FactoryMethodTest.php b/Tests/FactoryMethod/FactoryMethodTest.php index 463c1c8..0796a98 100644 --- a/Tests/FactoryMethod/FactoryMethodTest.php +++ b/Tests/FactoryMethod/FactoryMethodTest.php @@ -1,9 +1,5 @@ type as $oneType) { $vehicle = $shop->create($oneType); - $this->assertInstanceOf('DesignPatterns\FactoryMethod\Vehicle', $vehicle); + $this->assertInstanceOf('DesignPatterns\FactoryMethod\VehicleInterface', $vehicle); } } @@ -51,5 +47,4 @@ class FactoryMethodTest extends \PHPUnit_Framework_TestCase { $shop->create('spaceship'); } - -} \ No newline at end of file +} diff --git a/Tests/FluentInterface/FluentInterfaceTest.php b/Tests/FluentInterface/FluentInterfaceTest.php index 7dec8d8..63be030 100644 --- a/Tests/FluentInterface/FluentInterfaceTest.php +++ b/Tests/FluentInterface/FluentInterfaceTest.php @@ -1,9 +1,5 @@ assertEquals('SELECT foo,bar FROM foobar AS f WHERE f.bar = ?', $query); } - -} \ No newline at end of file +} diff --git a/Tests/Iterator/IteratorTest.php b/Tests/Iterator/IteratorTest.php index de2e2b2..eab5a30 100644 --- a/Tests/Iterator/IteratorTest.php +++ b/Tests/Iterator/IteratorTest.php @@ -1,9 +1,5 @@ append(new \ArrayIterator($joker)); $this->assertCount(33, $newDeck); } - -} \ No newline at end of file +} diff --git a/Tests/Mediator/MediatorTest.php b/Tests/Mediator/MediatorTest.php index f4f689d..77db09f 100644 --- a/Tests/Mediator/MediatorTest.php +++ b/Tests/Mediator/MediatorTest.php @@ -1,9 +1,5 @@ expectOutputString('We are in DesignPatterns\NullObject\Service::doSomething'); $service->doSomething(); } - -} \ No newline at end of file +} diff --git a/Tests/SimpleFactory/SimpleFactoryTest.php b/Tests/SimpleFactory/SimpleFactoryTest.php index 42de427..48c949c 100644 --- a/Tests/SimpleFactory/SimpleFactoryTest.php +++ b/Tests/SimpleFactory/SimpleFactoryTest.php @@ -1,9 +1,5 @@ getMethod('__construct'); $this->assertTrue($meth->isPrivate()); } - -} \ No newline at end of file +} diff --git a/Tests/StaticFactory/StaticFactoryTest.php b/Tests/StaticFactory/StaticFactoryTest.php index 65087f5..d85f266 100644 --- a/Tests/StaticFactory/StaticFactoryTest.php +++ b/Tests/StaticFactory/StaticFactoryTest.php @@ -27,5 +27,4 @@ class StaticFactoryTest extends \PHPUnit_Framework_TestCase $obj = StaticFactory::factory($type); $this->assertInstanceOf('DesignPatterns\StaticFactory\FormatterInterface', $obj); } - } diff --git a/Tests/TemplateMethod/JourneyTest.php b/Tests/TemplateMethod/JourneyTest.php index bc87062..f592363 100644 --- a/Tests/TemplateMethod/JourneyTest.php +++ b/Tests/TemplateMethod/JourneyTest.php @@ -1,9 +1,5 @@