diff --git a/composer.json b/composer.json index 8734994..e57f42f 100644 --- a/composer.json +++ b/composer.json @@ -19,10 +19,10 @@ "require": { "php" : ">=7.0.0", "nikic/fast-route": "1.0.1", - "opine/interfaces": "~1.0", - "opine/config" : "~3.0", - "opine/container" : "~2.0", - "opine/bundle" : "~2.0" + "opine/interfaces": "^1.0", + "opine/config" : "^3.0", + "opine/container" : "^2.0", + "opine/bundle" : "^2.0.17" }, "require-dev": { "phpunit/phpunit": "5.5.0" diff --git a/docker/pull.sh b/docker/pull.sh index 5ad9cd4..9bae8b9 100755 --- a/docker/pull.sh +++ b/docker/pull.sh @@ -1,2 +1,2 @@ docker pull composer/composer -docker pull phpunit:5.5.0 +docker pull phpunit/phpunit:5.5.0 diff --git a/src/Service.php b/src/Service.php index 019d2eb..f849e24 100644 --- a/src/Service.php +++ b/src/Service.php @@ -142,17 +142,8 @@ public function purgeBefore() private function filtersGraft(&$callback, Array &$options = []) { - if (empty($options['before']) && empty($options['after'])) { - return; - } - $prefix = $suffix = ''; - if (!empty($options['before'])) { - $prefix = str_replace('@', 'BBBB', $options['before']).'bbbb'; - } - if (!empty($options['after'])) { - $suffix = 'AAAA'.str_replace('@', 'aaaa', $options['after']); - } - $callback = $prefix.$callback.$suffix; + $suffix = '|' . json_encode($options); + $callback = $callback.$suffix; } public function get($pattern, $callback, Array $options = []) @@ -255,18 +246,20 @@ private function dispatcher() return new RouteDispatcher($this->collector->getData()); } - private function filterParse(Array &$callable, &$beforeActions = [], &$afterActions = []) + private function filterParse(Array &$callable, &$beforeActions = [], &$afterActions = [], &$activity) { - //[ClassBBBBmethodbbbbClass, methodAAAAClassaaaamethod] - if (substr_count($callable[0], 'BBBB') == 1 && substr_count($callable[0], 'bbbb') == 1) { - $parts = preg_split('/(BBBB|bbbb)/', $callable[0]); - $callable[0] = $parts[2]; - $beforeActions[] = $this->actionPrepare([$parts[0], $parts[1]]); + $parts = explode('|', $callable); + $options = json_decode($parts[1]); + $callable = $parts[0]; + + if (isset($options['before'])) { + $beforeActions[] = $options['before']; + } + if (isset($options['after'])) { + $afterActions[] = $options['after']; } - if (substr_count($callable[1], 'AAAA') == 1 && substr_count($callable[1], 'aaaa') == 1) { - $parts = preg_split('/(AAAA|aaaa)/', $callable[1]); - $callable[1] = $parts[0]; - $afterActions[] = $this->actionPrepare([$parts[1], $parts[2]]); + if (isset($options['activity'])) { + $activity = $options['activity']; } }