Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit37cdbd6

Browse files
author
Dominik Liebler
committed
Merge pull requestDesignPatternsPHP#108 from dan-lyn/master
fixed typos and trailing slashes
2 parentsbc2f33e +b4d7824 commit37cdbd6

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

‎Behavioral/ChainOfResponsibilities/Handler.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
/**
66
* Handler is a generic handler in the chain of responsibilities
7-
*
8-
* Yes you could have a lighter CoR with simpler handler but if you want your CoR to
9-
* be extendable and decoupled, it's a better idea to do things like that in real
7+
*
8+
* Yes you could have a lighter CoR withasimpler handler but if you want your CoR
9+
*tobe extendable and decoupled, it's a better idea to do things like that in real
1010
* situations. Usually, a CoR is meant to be changed everytime and evolves, that's
1111
* why we slice the workflow in little bits of code.
1212
*/
@@ -19,13 +19,13 @@ abstract class Handler
1919

2020
/**
2121
* Append a responsibility to the end of chain
22-
*
22+
*
2323
* A prepend method could be done with the same spirit
24-
*
25-
* You could also send the successor in the constructor but in PHPit is a
24+
*
25+
* You could also send the successor in the constructor but in PHPthat is a
2626
* bad idea because you have to remove the type-hint of the parameter because
2727
* the last handler has a null successor.
28-
*
28+
*
2929
* And if you override the constructor, that Handler can no longer have a
3030
* successor. One solution is to provide a NullObject (see pattern).
3131
* It is more preferable to keep the constructor "free" to inject services
@@ -43,10 +43,10 @@ final public function append(Handler $handler)
4343
}
4444

4545
/**
46-
* Handle the request.
47-
*
48-
* This approach by using a template method pattern ensures you that
49-
* each subclass will not forget to call the successor.Beside, the returned
46+
* Handle the request.
47+
*
48+
* This approach by using a template method pattern ensures you that
49+
* each subclass will not forget to call the successor.Besides, the returned
5050
* boolean value indicates you if the request have been processed or not.
5151
*
5252
* @param Request $req

‎Behavioral/ChainOfResponsibilities/Request.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
/**
66
* Request is a request which goes through the chain of responsibilities.
7-
*
8-
* About the request: Sometimes, you don't need an object, just an integer or
9-
* an array. But in this case of a full example, I've made a class to illustrate
10-
* this important idea in the CoR (Chain of Responsibilities). In real world,
7+
*
8+
* About the request: Sometimes, you don't need an object, just an integer or
9+
* an array. But in this case of a full example, I've made a class to illustrate
10+
* this important idea in the CoR (Chain of Responsibilities). Inthereal world,
1111
* I recommend to always use a class, even a \stdClass if you want, it proves
1212
* to be more adaptive because a single handler doesn't know much about the
1313
* outside world and it is more difficult if, one day, you want to add some
14-
* criterion in a decision process.
14+
* criterion in a decision process.
1515
*/
1616
class Request
1717
{

‎Behavioral/ChainOfResponsibilities/Responsible/SlowStorage.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88
/**
99
* This is mostly the same code as FastStorage but in fact, it may greatly differs
10-
*
11-
* One important fact about CoR: each item in the chain MUST NOT assume its position
10+
*
11+
* 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 execption if the request goes there.
14-
*
15-
* To be really extendable, each handler doesn't know if there is something afterhim.
16-
*
14+
*
15+
* To be really extendable, each handler doesn't know if there is something afterit.
16+
*
1717
*/
1818
class SlowStorageextends Handler
1919
{

‎Behavioral/ChainOfResponsibilities/Tests/ChainTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function makeRequest()
2828
{
2929
$request =newRequest();
3030
$request->verb ='get';
31+
3132
returnarray(
3233
array($request)
3334
);

‎Behavioral/TemplateMethod/Journey.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function buyGift()
3737
}
3838

3939
/**
40-
*this method will be unknown by subclasses (better)
40+
*This method will be unknown by subclasses (better)
4141
*/
4242
privatefunctionbuyAFlight()
4343
{

‎Creational/Pool/Tests/PoolTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class TestWorker
88
{
9-
109
public$id =1;
1110
}
1211

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp