Skip to content

Commit a843594

Browse files
committed
Custom Callbacks
1 parent a43b52a commit a843594

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Route.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
class Route extends ConditionSet implements ConditionHandler, RouteCompleter
88
{
99
private $_result;
10+
/**
11+
* @var array
12+
*/
13+
protected $_onComplete = [];
1014

1115
public function getHandler()
1216
{
@@ -33,6 +37,16 @@ public function complete(Context $context)
3337
$condition->complete($context);
3438
}
3539
}
40+
foreach($this->_onComplete as $callback)
41+
{
42+
$callback($context);
43+
}
44+
}
45+
46+
public function addCompleteCallback(callable $callback)
47+
{
48+
$this->_onComplete[] = $callback;
49+
return $this;
3650
}
3751

3852
}

0 commit comments

Comments
 (0)