Skip to content

Commit 2f28ceb

Browse files
author
Dominik Liebler
authored
Merge pull request DesignPatternsPHP#360 from guilhermesiani/patch-1
Keep one level of conditions
2 parents 5f5649b + 68065ae commit 2f28ceb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Behavioral/ChainOfResponsibilities/Handler.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@ final public function handle(RequestInterface $request)
2929
{
3030
$processed = $this->processing($request);
3131

32-
if ($processed === null) {
32+
if ($processed === null && $this->successor !== null) {
3333
// the request has not been processed by this handler => see the next
34-
if ($this->successor !== null) {
35-
$processed = $this->successor->handle($request);
36-
}
34+
$processed = $this->successor->handle($request);
3735
}
3836

3937
return $processed;

0 commit comments

Comments
 (0)