mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-11 01:14:01 +02:00
Applied fixes from StyleCI
This commit is contained in:
committed by
StyleCI Bot
parent
3663603b80
commit
fe1f144ec3
@@ -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
|
||||
@@ -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
|
||||
*
|
||||
@@ -68,7 +68,7 @@ abstract class Handler
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
@@ -6,7 +6,7 @@ use DesignPatterns\Behavioral\ChainOfResponsibilities\Handler;
|
||||
use DesignPatterns\Behavioral\ChainOfResponsibilities\Request;
|
||||
|
||||
/**
|
||||
* Class FastStorage
|
||||
* Class FastStorage.
|
||||
*/
|
||||
class FastStorage extends Handler
|
||||
{
|
||||
|
@@ -6,14 +6,13 @@ use DesignPatterns\Behavioral\ChainOfResponsibilities\Handler;
|
||||
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
|
||||
{
|
||||
|
@@ -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
|
||||
*/
|
||||
@@ -30,7 +29,7 @@ class ChainTest extends \PHPUnit_Framework_TestCase
|
||||
$request->verb = 'get';
|
||||
|
||||
return array(
|
||||
array($request)
|
||||
array($request),
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user