From 2b2ec80a0e4175b19fced96b79a45b5bdcf7e279 Mon Sep 17 00:00:00 2001 From: Emre Sokullu Date: Mon, 19 Aug 2019 20:54:06 -0700 Subject: [PATCH] bugfix --- src/Pho/Kernel/Hooks/Edge.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Pho/Kernel/Hooks/Edge.php b/src/Pho/Kernel/Hooks/Edge.php index e3189b8..c90e56d 100644 --- a/src/Pho/Kernel/Hooks/Edge.php +++ b/src/Pho/Kernel/Hooks/Edge.php @@ -12,6 +12,8 @@ namespace Pho\Kernel\Hooks; use Pho\Lib\Graph; +use Pho\Lib\Graph\{HeadNode, TailNode}; +use Pho\Framework\Predicate; /** * {@inheritDoc} @@ -24,20 +26,25 @@ class Edge implements HookInterface public static function setup(/*Graph\EdgeInterface*/ $edge): void { $edge->hook("head", (function(): Graph\NodeInterface { - $this->head = new \Pho\Lib\Graph\HeadNode(); + $this->head = new HeadNode(); $this->head->set($this->injection("kernel")->gs()->node($this->head_id)); return $this->head; }) ); $edge->hook("tail", (function(): Graph\NodeInterface { - $this->tail = new \Pho\Lib\Graph\TailNode(); + $this->tail = new TailNode(); $this->tail->set($this->injection("kernel")->gs()->node($this->tail_id)); return $this->tail; }) ); $edge->hook("predicate", (function(): Graph\PredicateInterface { - $this->predicate = (new $this->predicate); + if(!isset($this->predicate)) { + $this->predicate = $this->resolvePredicate(null, Predicate::class); + } + else { + $this->predicate = (new $this->predicate); + } return $this->predicate; }) );