Skip to content

Commit fe1f144

Browse files
Dominik LieblerStyleCIBot
Dominik Liebler
authored andcommitted
Applied fixes from StyleCI
1 parent 3663603 commit fe1f144

File tree

167 files changed

+510
-517
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+510
-517
lines changed

Behavioral/ChainOfResponsibilities/Handler.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace DesignPatterns\Behavioral\ChainOfResponsibilities;
44

55
/**
6-
* Handler is a generic handler in the chain of responsibilities
6+
* Handler is a generic handler in the chain of responsibilities.
77
*
88
* Yes you could have a lighter CoR with a simpler handler but if you want your CoR
99
* to be extendable and decoupled, it's a better idea to do things like that in real
@@ -18,7 +18,7 @@ abstract class Handler
1818
private $successor = null;
1919

2020
/**
21-
* Append a responsibility to the end of chain
21+
* Append a responsibility to the end of chain.
2222
*
2323
* A prepend method could be done with the same spirit
2424
*
@@ -68,7 +68,7 @@ final public function handle(Request $req)
6868
}
6969

7070
/**
71-
* Each concrete handler has to implement the processing of the request
71+
* Each concrete handler has to implement the processing of the request.
7272
*
7373
* @param Request $req
7474
*

Behavioral/ChainOfResponsibilities/Responsible/FastStorage.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use DesignPatterns\Behavioral\ChainOfResponsibilities\Request;
77

88
/**
9-
* Class FastStorage
9+
* Class FastStorage.
1010
*/
1111
class FastStorage extends Handler
1212
{

Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
use DesignPatterns\Behavioral\ChainOfResponsibilities\Request;
77

88
/**
9-
* This is mostly the same code as FastStorage but in fact, it may greatly differs
9+
* This is mostly the same code as FastStorage but in fact, it may greatly differs.
1010
*
1111
* One important fact about CoR: each item in the chain MUST NOT assume its position
1212
* in the chain. A CoR is not responsible if the request is not handled UNLESS
1313
* you make an "ExceptionHandler" which throws exception if the request goes there.
1414
*
1515
* To be really extendable, each handler doesn't know if there is something after it.
16-
*
1716
*/
1817
class SlowStorage extends Handler
1918
{

Behavioral/ChainOfResponsibilities/Tests/ChainTest.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33
namespace DesignPatterns\Behavioral\ChainOfResponsibilities\Tests;
44

55
use DesignPatterns\Behavioral\ChainOfResponsibilities\Request;
6+
use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible;
67
use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\FastStorage;
78
use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage;
8-
use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible;
99

1010
/**
11-
* ChainTest tests the CoR
11+
* ChainTest tests the CoR.
1212
*/
1313
class ChainTest extends \PHPUnit_Framework_TestCase
1414
{
15-
1615
/**
1716
* @var FastStorage
1817
*/
@@ -30,7 +29,7 @@ public function makeRequest()
3029
$request->verb = 'get';
3130

3231
return array(
33-
array($request)
32+
array($request),
3433
);
3534
}
3635

Behavioral/Command/CommandInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace DesignPatterns\Behavioral\Command;
44

55
/**
6-
* class CommandInterface
6+
* class CommandInterface.
77
*/
88
interface CommandInterface
99
{

Behavioral/Command/HelloCommand.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/**
66
* This concrete command calls "print" on the Receiver, but an external
7-
* invoker just knows that it can call "execute"
7+
* invoker just knows that it can call "execute".
88
*/
99
class HelloCommand implements CommandInterface
1010
{
@@ -25,7 +25,7 @@ public function __construct(Receiver $console)
2525
}
2626

2727
/**
28-
* execute and output "Hello World"
28+
* execute and output "Hello World".
2929
*/
3030
public function execute()
3131
{

Behavioral/Command/Invoker.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/**
66
* Invoker is using the command given to it.
7-
* Example : an Application in SF2
7+
* Example : an Application in SF2.
88
*/
99
class Invoker
1010
{
@@ -25,7 +25,7 @@ public function setCommand(CommandInterface $cmd)
2525
}
2626

2727
/**
28-
* executes the command
28+
* executes the command.
2929
*/
3030
public function run()
3131
{

Behavioral/Command/Receiver.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace DesignPatterns\Behavioral\Command;
44

55
/**
6-
* Receiver is specific service with its own contract and can be only concrete
6+
* Receiver is specific service with its own contract and can be only concrete.
77
*/
88
class Receiver
99
{

Behavioral/Command/Tests/CommandTest.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22

33
namespace DesignPatterns\Behavioral\Command\Tests;
44

5+
use DesignPatterns\Behavioral\Command\HelloCommand;
56
use DesignPatterns\Behavioral\Command\Invoker;
67
use DesignPatterns\Behavioral\Command\Receiver;
7-
use DesignPatterns\Behavioral\Command\HelloCommand;
88

99
/**
10-
* CommandTest has the role of the Client in the Command Pattern
10+
* CommandTest has the role of the Client in the Command Pattern.
1111
*/
1212
class CommandTest extends \PHPUnit_Framework_TestCase
1313
{
14-
1514
/**
1615
* @var Invoker
1716
*/

Behavioral/Iterator/Book.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
class Book
66
{
7-
87
private $author;
98

109
private $title;
@@ -27,6 +26,6 @@ public function getTitle()
2726

2827
public function getAuthorAndTitle()
2928
{
30-
return $this->getTitle() . ' by ' . $this->getAuthor();
29+
return $this->getTitle().' by '.$this->getAuthor();
3130
}
3231
}

Behavioral/Iterator/BookList.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
class BookList implements \Countable
66
{
7-
87
private $books;
98

109
public function getBook($bookNumberToGet)
@@ -13,7 +12,7 @@ public function getBook($bookNumberToGet)
1312
return $this->books[$bookNumberToGet];
1413
}
1514

16-
return null;
15+
return;
1716
}
1817

1918
public function addBook(Book $book)

Behavioral/Iterator/BookListIterator.php

+17-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
class BookListIterator implements \Iterator
66
{
7-
87
/**
98
* @var BookList
109
*/
@@ -21,8 +20,10 @@ public function __construct(BookList $bookList)
2120
}
2221

2322
/**
24-
* Return the current book
23+
* Return the current book.
24+
*
2525
* @link http://php.net/manual/en/iterator.current.php
26+
*
2627
* @return Book Can return any type.
2728
*/
2829
public function current()
@@ -32,8 +33,10 @@ public function current()
3233

3334
/**
3435
* (PHP 5 &gt;= 5.0.0)<br/>
35-
* Move forward to next element
36+
* Move forward to next element.
37+
*
3638
* @link http://php.net/manual/en/iterator.next.php
39+
*
3740
* @return void Any returned value is ignored.
3841
*/
3942
public function next()
@@ -43,8 +46,10 @@ public function next()
4346

4447
/**
4548
* (PHP 5 &gt;= 5.0.0)<br/>
46-
* Return the key of the current element
49+
* Return the key of the current element.
50+
*
4751
* @link http://php.net/manual/en/iterator.key.php
52+
*
4853
* @return mixed scalar on success, or null on failure.
4954
*/
5055
public function key()
@@ -54,10 +59,12 @@ public function key()
5459

5560
/**
5661
* (PHP 5 &gt;= 5.0.0)<br/>
57-
* Checks if current position is valid
62+
* Checks if current position is valid.
63+
*
5864
* @link http://php.net/manual/en/iterator.valid.php
59-
* @return boolean The return value will be casted to boolean and then evaluated.
60-
* Returns true on success or false on failure.
65+
*
66+
* @return bool The return value will be casted to boolean and then evaluated.
67+
* Returns true on success or false on failure.
6168
*/
6269
public function valid()
6370
{
@@ -66,8 +73,10 @@ public function valid()
6673

6774
/**
6875
* (PHP 5 &gt;= 5.0.0)<br/>
69-
* Rewind the Iterator to the first element
76+
* Rewind the Iterator to the first element.
77+
*
7078
* @link http://php.net/manual/en/iterator.rewind.php
79+
*
7180
* @return void Any returned value is ignored.
7281
*/
7382
public function rewind()

Behavioral/Iterator/BookListReverseIterator.php

+17-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
class BookListReverseIterator implements \Iterator
66
{
7-
87
/**
98
* @var BookList
109
*/
@@ -22,8 +21,10 @@ public function __construct(BookList $bookList)
2221
}
2322

2423
/**
25-
* Return the current book
24+
* Return the current book.
25+
*
2626
* @link http://php.net/manual/en/iterator.current.php
27+
*
2728
* @return Book Can return any type.
2829
*/
2930
public function current()
@@ -33,8 +34,10 @@ public function current()
3334

3435
/**
3536
* (PHP 5 &gt;= 5.0.0)<br/>
36-
* Move forward to next element
37+
* Move forward to next element.
38+
*
3739
* @link http://php.net/manual/en/iterator.next.php
40+
*
3841
* @return void Any returned value is ignored.
3942
*/
4043
public function next()
@@ -44,8 +47,10 @@ public function next()
4447

4548
/**
4649
* (PHP 5 &gt;= 5.0.0)<br/>
47-
* Return the key of the current element
50+
* Return the key of the current element.
51+
*
4852
* @link http://php.net/manual/en/iterator.key.php
53+
*
4954
* @return mixed scalar on success, or null on failure.
5055
*/
5156
public function key()
@@ -55,10 +60,12 @@ public function key()
5560

5661
/**
5762
* (PHP 5 &gt;= 5.0.0)<br/>
58-
* Checks if current position is valid
63+
* Checks if current position is valid.
64+
*
5965
* @link http://php.net/manual/en/iterator.valid.php
60-
* @return boolean The return value will be casted to boolean and then evaluated.
61-
* Returns true on success or false on failure.
66+
*
67+
* @return bool The return value will be casted to boolean and then evaluated.
68+
* Returns true on success or false on failure.
6269
*/
6370
public function valid()
6471
{
@@ -67,8 +74,10 @@ public function valid()
6774

6875
/**
6976
* (PHP 5 &gt;= 5.0.0)<br/>
70-
* Rewind the Iterator to the first element
77+
* Rewind the Iterator to the first element.
78+
*
7179
* @link http://php.net/manual/en/iterator.rewind.php
80+
*
7281
* @return void Any returned value is ignored.
7382
*/
7483
public function rewind()

Behavioral/Iterator/Tests/IteratorTest.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
class IteratorTest extends \PHPUnit_Framework_TestCase
1111
{
12-
1312
/**
1413
* @var BookList
1514
*/
@@ -30,8 +29,8 @@ public function expectedAuthors()
3029
array(
3130
'Learning PHP Design Patterns by William Sanders',
3231
'Professional Php Design Patterns by Aaron Saray',
33-
'Clean Code by Robert C. Martin'
34-
)
32+
'Clean Code by Robert C. Martin',
33+
),
3534
),
3635
);
3736
}
@@ -65,7 +64,7 @@ public function testUseAReverseIteratorAndValidateAuthors($expected)
6564
}
6665

6766
/**
68-
* Test BookList Remove
67+
* Test BookList Remove.
6968
*/
7069
public function testBookRemove()
7170
{

Behavioral/Mediator/Colleague.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
abstract class Colleague
1010
{
1111
/**
12-
* this ensures no change in subclasses
12+
* this ensures no change in subclasses.
1313
*
1414
* @var MediatorInterface
1515
*/
1616
private $mediator;
17-
17+
1818
/**
1919
* @param MediatorInterface $medium
2020
*/
@@ -25,6 +25,7 @@ public function __construct(MediatorInterface $medium)
2525
}
2626

2727
// for subclasses
28+
2829
protected function getMediator()
2930
{
3031
return $this->mediator;

0 commit comments

Comments
 (0)