Skip to content

Commit

Permalink
experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
rmahoney-bl committed Nov 8, 2016
1 parent c841ec6 commit 8648efd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 26 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion docker/pull.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
docker pull composer/composer
docker pull phpunit:5.5.0
docker pull phpunit/phpunit:5.5.0
35 changes: 14 additions & 21 deletions src/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [])
Expand Down Expand Up @@ -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'];
}
}

Expand Down

0 comments on commit 8648efd

Please sign in to comment.