Skip to content

Commit fc3b6a1

Browse files
cs fix
1 parent da35c96 commit fc3b6a1

25 files changed

+65
-64
lines changed

Behavioral/ChainOfResponsibilities/ChainTest.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public function testFastStorage($request)
4545
$this->assertObjectHasAttribute('response', $request);
4646
$this->assertEquals('baz', $request->response);
4747
// despite both handle owns the 'bar' key, the FastStorage is responding first
48-
$this->assertEquals('DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\FastStorage', $request->forDebugOnly);
48+
$className = 'DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\FastStorage';
49+
$this->assertEquals($className, $request->forDebugOnly);
4950
}
5051

5152
/**
@@ -60,7 +61,8 @@ public function testSlowStorage($request)
6061
$this->assertObjectHasAttribute('response', $request);
6162
$this->assertEquals('bar', $request->response);
6263
// FastStorage has no 'foo' key, the SlowStorage is responding
63-
$this->assertEquals('DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage', $request->forDebugOnly);
64+
$className = 'DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage';
65+
$this->assertEquals($className, $request->forDebugOnly);
6466
}
6567

6668
/**
@@ -73,6 +75,7 @@ public function testFailure($request)
7375

7476
$this->assertFalse($ret);
7577
// the last responsible :
76-
$this->assertEquals('DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage', $request->forDebugOnly);
78+
$className = 'DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage';
79+
$this->assertEquals($className, $request->forDebugOnly);
7780
}
7881
}

Behavioral/Iterator/BookList.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public function getBook($bookNumberToGet)
1313
return $this->books[$bookNumberToGet];
1414
}
1515

16-
return NULL;
16+
return null;
1717
}
1818

1919
public function addBook(Book $book)

Behavioral/Iterator/BookListIterator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ public function rewind()
7474
{
7575
$this->currentBook = 0;
7676
}
77-
}
77+
}

Behavioral/Iterator/BookListReverseIterator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ public function valid()
2020
{
2121
return 0 <= $this->currentBook;
2222
}
23-
}
23+
}

Behavioral/Iterator/IteratorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ public function testUseAReverseIteratorAndValidateAuthors($expected)
6363
$iterator->next();
6464
}
6565
}
66-
}
66+
}

Behavioral/Observer/ObserverTest.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ public function testUpdateCalling()
5353
$subject->attach($observer);
5454

5555
$observer->expects($this->once())
56-
->method('update')
57-
->with($subject);
56+
->method('update')
57+
->with($subject);
5858

5959
$subject->notify();
6060
}
61-
62-
}
61+
}

Behavioral/Specification/AbstractSpecification.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ abstract class AbstractSpecification implements SpecificationInterface
88
{
99
/**
1010
* Checks if given item meets all criteria
11-
*
11+
*
1212
* @param Item $item
13-
*
13+
*
1414
* @return bool
1515
*/
1616
abstract public function isSatisfiedBy(Item $item);
1717

1818
/**
1919
* Creates a new logical AND specification
20-
*
20+
*
2121
* @param SpecificationInterface $spec
22-
*
22+
*
2323
* @return SpecificationInterface
2424
*/
2525
public function plus(SpecificationInterface $spec)
@@ -29,9 +29,9 @@ public function plus(SpecificationInterface $spec)
2929

3030
/**
3131
* Creates a new logical OR composite specification
32-
*
32+
*
3333
* @param SpecificationInterface $spec
34-
*
34+
*
3535
* @return SpecificationInterface
3636
*/
3737
public function either(SpecificationInterface $spec)
@@ -41,11 +41,11 @@ public function either(SpecificationInterface $spec)
4141

4242
/**
4343
* Creates a new logical NOT specification
44-
*
44+
*
4545
* @return SpecificationInterface
4646
*/
4747
public function not()
4848
{
4949
return new Not($this);
5050
}
51-
}
51+
}

Behavioral/Specification/Not.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ public function isSatisfiedBy(Item $item)
3131
{
3232
return !$this->spec->isSatisfiedBy($item);
3333
}
34-
}
34+
}

Behavioral/Specification/Plus.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ class Plus extends AbstractSpecification
1212

1313
/**
1414
* Creation of a locical AND of two specifications
15-
*
15+
*
1616
* @param SpecificationInterface $left
1717
* @param SpecificationInterface $right
18-
1918
*/
2019
public function __construct(SpecificationInterface $left, SpecificationInterface $right)
2120
{
@@ -25,13 +24,13 @@ public function __construct(SpecificationInterface $left, SpecificationInterface
2524

2625
/**
2726
* Checks if the composite AND of specifications passes
28-
*
27+
*
2928
* @param Item $item
30-
*
29+
*
3130
* @return bool
3231
*/
3332
public function isSatisfiedBy(Item $item)
3433
{
3534
return $this->left->isSatisfiedBy($item) && $this->right->isSatisfiedBy($item);
3635
}
37-
}
36+
}

Behavioral/Specification/PriceSpecification.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ public function setMinPrice($minPrice)
3131

3232
/**
3333
* Checks if Item price falls between bounds
34-
*
34+
*
3535
* @param Item $item
36-
*
36+
*
3737
* @return bool
3838
*/
3939
public function isSatisfiedBy(Item $item)
4040
{
41-
if ( !empty($this->maxPrice) && $item->getPrice() > $this->maxPrice) {
41+
if (!empty($this->maxPrice) && $item->getPrice() > $this->maxPrice) {
4242
return false;
4343
}
44-
if ( !empty($this->minPrice) && $item->getPrice() < $this->minPrice) {
44+
if (!empty($this->minPrice) && $item->getPrice() < $this->minPrice) {
4545
return false;
4646
}
4747

Behavioral/Specification/SpecificationInterface.php

+5-7
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,29 @@ interface SpecificationInterface
88
{
99
/**
1010
* A boolean evaluation indicating if the object meets the specification
11-
*
11+
*
1212
* @param Item $item
13-
*
13+
*
1414
* @return bool
1515
*/
1616
public function isSatisfiedBy(Item $item);
1717

1818
/**
1919
* Creates a logical AND specification
20-
*
20+
*
2121
* @param SpecificationInterface $spec
22-
2322
*/
2423
public function plus(SpecificationInterface $spec);
2524

2625
/**
2726
* Creates a logical OR specification
28-
*
27+
*
2928
* @param SpecificationInterface $spec
30-
3129
*/
3230
public function either(SpecificationInterface $spec);
3331

3432
/**
3533
* Creates a logical not specification
3634
*/
3735
public function not();
38-
}
36+
}

Behavioral/Strategy/ObjectCollection.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ public function __construct(array $elements = array())
3030
*/
3131
public function sort()
3232
{
33-
if (!$this->comparator){
34-
throw new \LogicException("Comparator is not set");
33+
if (!$this->comparator) {
34+
throw new \LogicException("Comparator is not set");
3535
}
36-
36+
3737
$callback = array($this->comparator, 'compare');
3838
uasort($this->elements, $callback);
3939

Behavioral/TemplateMethod/JourneyTest.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public function testLasVegas()
3131
{
3232
$journey = $this->getMockForAbstractClass('DesignPatterns\Behavioral\TemplateMethod\Journey');
3333
$journey->expects($this->once())
34-
->method('enjoyVacation')
35-
->will($this->returnCallback(array($this, 'mockUpVacation')));
34+
->method('enjoyVacation')
35+
->will($this->returnCallback(array($this, 'mockUpVacation')));
3636
$this->expectOutputRegex('#Las Vegas#');
3737
$journey->takeATrip();
3838
}
@@ -41,5 +41,4 @@ public function mockUpVacation()
4141
{
4242
echo "Fear and loathing in Las Vegas\n";
4343
}
44-
45-
}
44+
}

Behavioral/Visitor/VisitorTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,4 @@ public function testUnknownObject()
4343
$mock = $this->getMockForAbstractClass('DesignPatterns\Behavioral\Visitor\Role');
4444
$mock->accept($this->visitor);
4545
}
46-
47-
}
46+
}

Creational/Pool/Pool.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Pool
77

88
private $instances = array();
99
private $class;
10-
10+
1111
public function __construct($class)
1212
{
1313
$this->class = $class;
@@ -26,5 +26,4 @@ public function dispose($instance)
2626
{
2727
$this->instances[] = $instance;
2828
}
29-
3029
}

Creational/Pool/PoolTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace DesignPatterns\Creational\Pool;
44

5-
use DesignPatterns\Creational\Pool\Pool;
6-
75
class TestWorker
86
{
97

@@ -27,4 +25,3 @@ public function testPool()
2725
$this->assertEquals(1, $pool->get()->id);
2826
}
2927
}
30-

Creational/Pool/Processor.php

-1
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,4 @@ private function popFromWaitingQueue()
4949
{
5050
return array_pop($this->waitingQueue);
5151
}
52-
5352
}

Creational/Pool/Worker.php

-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ public function run($image, array $callback)
1717
// and when it's done, execute callback
1818
call_user_func($callback, $this);
1919
}
20-
2120
}

Creational/SimpleFactory/SimpleFactoryTest.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,4 @@ public function testBadType()
4141
{
4242
$this->factory->createVehicle('car');
4343
}
44-
45-
}
44+
}

Structural/Adapter/AdapterTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function getBook()
3333
*
3434
* @dataProvider getBook
3535
*/
36-
public function test_I_am_an_old_Client(PaperBookInterface $book)
36+
public function testIAmAnOldClient(PaperBookInterface $book)
3737
{
3838
$book->open();
3939
$book->turnPage();

Structural/Composite/CompositeTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public function testRender()
2929
*/
3030
public function testFormImplementsFormEelement()
3131
{
32-
$this->assertTrue(is_subclass_of('DesignPatterns\Structural\Composite\Form', 'DesignPatterns\Structural\Composite\FormElement'));
32+
$className = 'DesignPatterns\Structural\Composite\Form';
33+
$abstractName = 'DesignPatterns\Structural\Composite\FormElement';
34+
$this->assertTrue(is_subclass_of($className, $abstractName));
3335
}
3436
}

Structural/DataMapper/DataMapperTest.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ public function testPersistExisting(User $user)
6565
*/
6666
public function testRestoreOne(User $existing)
6767
{
68-
$rows = new \ArrayIterator(array(array('userid' => 1, 'username' => 'Odysseus', 'email' => '[email protected]')));
68+
$row = array(
69+
'userid' => 1,
70+
'username' => 'Odysseus',
71+
'email' => '[email protected]'
72+
);
73+
$rows = new \ArrayIterator(array($row));
6974
$this->dbal->expects($this->once())
7075
->method('find')
7176
->with(1)

Structural/Decorator/DecoratorTest.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,18 @@ public function testXmlDecorator()
3030
// Wrap service with a JSON decorator for renderers
3131
$service = new Decorator\RenderInXml($this->service);
3232
// Our Renderer will now output XML instead of an array
33-
$this->assertXmlStringEqualsXmlString('<?xml version="1.0"?><foo>bar</foo>', $service->renderData());
33+
$xml = '<?xml version="1.0"?><foo>bar</foo>';
34+
$this->assertXmlStringEqualsXmlString($xml, $service->renderData());
3435
}
3536

3637
/**
3738
* The first key-point of this pattern :
3839
*/
3940
public function testDecoratorMustImplementsRenderer()
4041
{
41-
$this->assertTrue(is_subclass_of('DesignPatterns\Structural\Decorator\Decorator', 'DesignPatterns\Structural\Decorator\RendererInterface'));
42+
$className = 'DesignPatterns\Structural\Decorator\Decorator';
43+
$interfaceName = 'DesignPatterns\Structural\Decorator\RendererInterface';
44+
$this->assertTrue(is_subclass_of($className, $interfaceName));
4245
}
4346

4447
/**

Structural/DependencyInjection/ArrayConfig.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ class ArrayConfig extends AbstractConfig implements Parameters
1313
* Get parameter
1414
*
1515
* @param string|int $key
16-
*
16+
* @param null $default
1717
* @return mixed
1818
*/
19-
public function get($key, $default = null) {
19+
public function get($key, $default = null)
20+
{
2021
if (isset($this->storage[$key])) {
2122
return $this->storage[$key];
2223
}
@@ -27,7 +28,7 @@ public function get($key, $default = null) {
2728
* Set parameter
2829
*
2930
* @param string|int $key
30-
* @param mixed $value
31+
* @param mixed $value
3132
*/
3233
public function set($key, $value)
3334
{

0 commit comments

Comments
 (0)