Skip to content

Commit

Permalink
Applied fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Liebler authored and StyleCIBot committed Dec 21, 2015
1 parent 3663603 commit fe1f144
Show file tree
Hide file tree
Showing 167 changed files with 510 additions and 517 deletions.
6 changes: 3 additions & 3 deletions Behavioral/ChainOfResponsibilities/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\ChainOfResponsibilities;

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

/**
* Append a responsibility to the end of chain
* Append a responsibility to the end of chain.
*
* A prepend method could be done with the same spirit
*
Expand Down Expand Up @@ -68,7 +68,7 @@ final public function handle(Request $req)
}

/**
* Each concrete handler has to implement the processing of the request
* Each concrete handler has to implement the processing of the request.
*
* @param Request $req
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use DesignPatterns\Behavioral\ChainOfResponsibilities\Request;

/**
* Class FastStorage
* Class FastStorage.
*/
class FastStorage extends Handler
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
use DesignPatterns\Behavioral\ChainOfResponsibilities\Request;

/**
* This is mostly the same code as FastStorage but in fact, it may greatly differs
* This is mostly the same code as FastStorage but in fact, it may greatly differs.
*
* One important fact about CoR: each item in the chain MUST NOT assume its position
* in the chain. A CoR is not responsible if the request is not handled UNLESS
* you make an "ExceptionHandler" which throws exception if the request goes there.
*
* To be really extendable, each handler doesn't know if there is something after it.
*
*/
class SlowStorage extends Handler
{
Expand Down
7 changes: 3 additions & 4 deletions Behavioral/ChainOfResponsibilities/Tests/ChainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
namespace DesignPatterns\Behavioral\ChainOfResponsibilities\Tests;

use DesignPatterns\Behavioral\ChainOfResponsibilities\Request;
use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible;
use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\FastStorage;
use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible\SlowStorage;
use DesignPatterns\Behavioral\ChainOfResponsibilities\Responsible;

/**
* ChainTest tests the CoR
* ChainTest tests the CoR.
*/
class ChainTest extends \PHPUnit_Framework_TestCase
{

/**
* @var FastStorage
*/
Expand All @@ -30,7 +29,7 @@ public function makeRequest()
$request->verb = 'get';

return array(
array($request)
array($request),
);
}

Expand Down
2 changes: 1 addition & 1 deletion Behavioral/Command/CommandInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Command;

/**
* class CommandInterface
* class CommandInterface.
*/
interface CommandInterface
{
Expand Down
4 changes: 2 additions & 2 deletions Behavioral/Command/HelloCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

/**
* execute and output "Hello World"
* execute and output "Hello World".
*/
public function execute()
{
Expand Down
4 changes: 2 additions & 2 deletions Behavioral/Command/Invoker.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

/**
* Invoker is using the command given to it.
* Example : an Application in SF2
* Example : an Application in SF2.
*/
class Invoker
{
Expand All @@ -25,7 +25,7 @@ public function setCommand(CommandInterface $cmd)
}

/**
* executes the command
* executes the command.
*/
public function run()
{
Expand Down
2 changes: 1 addition & 1 deletion Behavioral/Command/Receiver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace DesignPatterns\Behavioral\Command;

/**
* Receiver is specific service with its own contract and can be only concrete
* Receiver is specific service with its own contract and can be only concrete.
*/
class Receiver
{
Expand Down
5 changes: 2 additions & 3 deletions Behavioral/Command/Tests/CommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@

namespace DesignPatterns\Behavioral\Command\Tests;

use DesignPatterns\Behavioral\Command\HelloCommand;
use DesignPatterns\Behavioral\Command\Invoker;
use DesignPatterns\Behavioral\Command\Receiver;
use DesignPatterns\Behavioral\Command\HelloCommand;

/**
* CommandTest has the role of the Client in the Command Pattern
* CommandTest has the role of the Client in the Command Pattern.
*/
class CommandTest extends \PHPUnit_Framework_TestCase
{

/**
* @var Invoker
*/
Expand Down
3 changes: 1 addition & 2 deletions Behavioral/Iterator/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class Book
{

private $author;

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

public function getAuthorAndTitle()
{
return $this->getTitle() . ' by ' . $this->getAuthor();
return $this->getTitle().' by '.$this->getAuthor();
}
}
3 changes: 1 addition & 2 deletions Behavioral/Iterator/BookList.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class BookList implements \Countable
{

private $books;

public function getBook($bookNumberToGet)
Expand All @@ -13,7 +12,7 @@ public function getBook($bookNumberToGet)
return $this->books[$bookNumberToGet];
}

return null;
return;
}

public function addBook(Book $book)
Expand Down
25 changes: 17 additions & 8 deletions Behavioral/Iterator/BookListIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class BookListIterator implements \Iterator
{

/**
* @var BookList
*/
Expand All @@ -21,8 +20,10 @@ public function __construct(BookList $bookList)
}

/**
* Return the current book
* Return the current book.
*
* @link http://php.net/manual/en/iterator.current.php
*
* @return Book Can return any type.
*/
public function current()
Expand All @@ -32,8 +33,10 @@ public function current()

/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Move forward to next element
* Move forward to next element.
*
* @link http://php.net/manual/en/iterator.next.php
*
* @return void Any returned value is ignored.
*/
public function next()
Expand All @@ -43,8 +46,10 @@ public function next()

/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Return the key of the current element
* Return the key of the current element.
*
* @link http://php.net/manual/en/iterator.key.php
*
* @return mixed scalar on success, or null on failure.
*/
public function key()
Expand All @@ -54,10 +59,12 @@ public function key()

/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Checks if current position is valid
* Checks if current position is valid.
*
* @link http://php.net/manual/en/iterator.valid.php
* @return boolean The return value will be casted to boolean and then evaluated.
* Returns true on success or false on failure.
*
* @return bool The return value will be casted to boolean and then evaluated.
* Returns true on success or false on failure.
*/
public function valid()
{
Expand All @@ -66,8 +73,10 @@ public function valid()

/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Rewind the Iterator to the first element
* Rewind the Iterator to the first element.
*
* @link http://php.net/manual/en/iterator.rewind.php
*
* @return void Any returned value is ignored.
*/
public function rewind()
Expand Down
25 changes: 17 additions & 8 deletions Behavioral/Iterator/BookListReverseIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

class BookListReverseIterator implements \Iterator
{

/**
* @var BookList
*/
Expand All @@ -22,8 +21,10 @@ public function __construct(BookList $bookList)
}

/**
* Return the current book
* Return the current book.
*
* @link http://php.net/manual/en/iterator.current.php
*
* @return Book Can return any type.
*/
public function current()
Expand All @@ -33,8 +34,10 @@ public function current()

/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Move forward to next element
* Move forward to next element.
*
* @link http://php.net/manual/en/iterator.next.php
*
* @return void Any returned value is ignored.
*/
public function next()
Expand All @@ -44,8 +47,10 @@ public function next()

/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Return the key of the current element
* Return the key of the current element.
*
* @link http://php.net/manual/en/iterator.key.php
*
* @return mixed scalar on success, or null on failure.
*/
public function key()
Expand All @@ -55,10 +60,12 @@ public function key()

/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Checks if current position is valid
* Checks if current position is valid.
*
* @link http://php.net/manual/en/iterator.valid.php
* @return boolean The return value will be casted to boolean and then evaluated.
* Returns true on success or false on failure.
*
* @return bool The return value will be casted to boolean and then evaluated.
* Returns true on success or false on failure.
*/
public function valid()
{
Expand All @@ -67,8 +74,10 @@ public function valid()

/**
* (PHP 5 &gt;= 5.0.0)<br/>
* Rewind the Iterator to the first element
* Rewind the Iterator to the first element.
*
* @link http://php.net/manual/en/iterator.rewind.php
*
* @return void Any returned value is ignored.
*/
public function rewind()
Expand Down
7 changes: 3 additions & 4 deletions Behavioral/Iterator/Tests/IteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

class IteratorTest extends \PHPUnit_Framework_TestCase
{

/**
* @var BookList
*/
Expand All @@ -30,8 +29,8 @@ public function expectedAuthors()
array(
'Learning PHP Design Patterns by William Sanders',
'Professional Php Design Patterns by Aaron Saray',
'Clean Code by Robert C. Martin'
)
'Clean Code by Robert C. Martin',
),
),
);
}
Expand Down Expand Up @@ -65,7 +64,7 @@ public function testUseAReverseIteratorAndValidateAuthors($expected)
}

/**
* Test BookList Remove
* Test BookList Remove.
*/
public function testBookRemove()
{
Expand Down
5 changes: 3 additions & 2 deletions Behavioral/Mediator/Colleague.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
abstract class Colleague
{
/**
* this ensures no change in subclasses
* this ensures no change in subclasses.
*
* @var MediatorInterface
*/
private $mediator;

/**
* @param MediatorInterface $medium
*/
Expand All @@ -25,6 +25,7 @@ public function __construct(MediatorInterface $medium)
}

// for subclasses

protected function getMediator()
{
return $this->mediator;
Expand Down
Loading

0 comments on commit fe1f144

Please sign in to comment.