Permalink
Browse files

Merge branch 'release-0.6.0'

Conflicts:
	lib/Proem/Api/IO/Response/Http/Standard.php
	lib/Proem/Api/Proem.php
  • Loading branch information...
2 parents 930eac9 + e64f740 commit c0dd9e28ce6680f162ffd01f277cf6fbb35d7301 @trq trq committed Aug 4, 2012
@@ -56,18 +56,14 @@ class Dispatch extends Event
public function preIn(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.pre.in.dispatch',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) use ($assets) {
- if ($responseAsset->provides('Proem\Dispatch\Template')) {
- $assets->set('dispatch', $responseAsset);
+ $assets->get('events')->trigger(
+ (new Bootstrap('proem.pre.in.dispatch'))->setServiceManager($assets),
+ function($response) use ($assets) {
+ if ($response->provides('Proem\Dispatch\Template')) {
+ $assets->set('dispatch', $response);
}
- },
- ]);
+ }
+ );
}
}
@@ -106,14 +102,7 @@ public function inBound(Manager $assets)
public function postIn(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.post.in.dispatch',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) {},
- ]);
+ $assets->get('events')->trigger((new Bootstrap('proem.post.in.dispatch'))->setServiceManager($assets));
}
(new DispatchStage($assets));
@@ -128,14 +117,7 @@ public function postIn(Manager $assets)
public function preOut(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.pre.out.dispatch',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) {},
- ]);
+ $assets->get('events')->trigger((new Bootstrap('proem.pre.out.dispatch'))->setServiceManager($assets));
}
}
@@ -158,14 +140,7 @@ public function outBound(Manager $assets)
public function postOut(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.post.out.dispatch',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) {},
- ]);
+ $assets->get('events')->trigger((new Bootstrap('proem.post.out.dispatch'))->setServiceManager($assets));
}
}
}
@@ -54,18 +54,14 @@ class Request extends Event
public function preIn(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.pre.in.request',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) use ($assets) {
- if ($responseAsset->provides('Proem\IO\Request\Template')) {
- $assets->set('request', $responseAsset);
+ $assets->get('events')->trigger(
+ (new Bootstrap('proem.pre.in.request'))->setServiceManager($assets),
+ function($response) use ($assets) {
+ if ($response->provides('Proem\IO\Request\Template')) {
+ $assets->set('request', $response);
}
- },
- ]);
+ }
+ );
}
}
@@ -100,14 +96,7 @@ public function inBound(Manager $assets)
public function postIn(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.post.in.request',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) {},
- ]);
+ $assets->get('events')->trigger((new Bootstrap('proem.post.in.request'))->setServiceManager($assets));
}
}
@@ -120,14 +109,7 @@ public function postIn(Manager $assets)
public function preOut(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.pre.out.request',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) {},
- ]);
+ $assets->get('events')->trigger((new Bootstrap('proem.pre.out.request'))->setServiceManager($assets));
}
}
@@ -150,14 +132,7 @@ public function outBound(Manager $assets)
public function postOut(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.post.out.request',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) {},
- ]);
+ $assets->get('events')->trigger((new Bootstrap('proem.post.out.request'))->setServiceManager($assets));
}
}
}
@@ -55,18 +55,14 @@ class Response extends Event
public function preIn(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.pre.in.response',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) use ($assets) {
- if ($responseAsset->provides('Proem\IO\Response\Template')) {
- $assets->set('response', $responseAsset);
+ $assets->get('events')->trigger(
+ (new Bootstrap('proem.pre.in.response'))->setServiceManager($assets),
+ function($response) use ($assets) {
+ if ($response->provides('Proem\IO\Response\Template')) {
+ $assets->set('response', $response);
}
- },
- ]);
+ }
+ );
}
}
@@ -101,14 +97,7 @@ public function inBound(Manager $assets)
public function postIn(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.post.in.response',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) {},
- ]);
+ $assets->get('events')->trigger((new Bootstrap('proem.post.in.response'))->setServiceManager($assets));
}
}
@@ -121,14 +110,7 @@ public function postIn(Manager $assets)
public function preOut(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.pre.out.response',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) {},
- ]);
+ $assets->get('events')->trigger((new Bootstrap('proem.pre.out.response'))->setServiceManager($assets));
}
}
@@ -158,14 +140,7 @@ public function outBound(Manager $assets)
public function postOut(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.post.out.response',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) {},
- ]);
+ $assets->get('events')->trigger((new Bootstrap('proem.post.out.response'))->setServiceManager($assets));
}
}
}
@@ -56,18 +56,14 @@ class Route extends Event
public function preIn(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.pre.in.router',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) use ($assets) {
- if ($responseAsset->provides('Proem\Routing\Router\Template')) {
- $assets->set('router', $responseAsset);
+ $assets->get('events')->trigger(
+ (new Bootstrap('proem.pre.in.router'))->setServiceManager($assets),
+ function($response) use ($assets) {
+ if ($response->provides('Proem\Routing\Router\Template')) {
+ $assets->set('router', $response);
}
- },
- ]);
+ }
+ );
}
}
@@ -155,14 +151,7 @@ public function inBound(Manager $assets)
public function postIn(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.post.in.router',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) {},
- ]);
+ $assets->get('events')->trigger((new Bootstrap('proem.post.in.router'))->setServiceManager($assets));
}
}
@@ -175,14 +164,7 @@ public function postIn(Manager $assets)
public function preOut(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.pre.out.router',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) {},
- ]);
+ $assets->get('events')->trigger((new Bootstrap('proem.pre.out.router'))->setServiceManager($assets));
}
}
@@ -205,14 +187,7 @@ public function outBound(Manager $assets)
public function postOut(Manager $assets)
{
if ($assets->provides('events', 'Proem\Signal\Manager\Template')) {
- $assets->get('events')->trigger([
- 'name' => 'proem.post.out.router',
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($assets),
- 'callback' => function($responseAsset) {},
- ]);
+ $assets->get('events')->trigger((new Bootstrap('proem.post.out.router'))->setServiceManager($assets));
}
}
}
@@ -73,26 +73,14 @@ public function dispatch($action) {
$action = strtolower($action);
if ($this->assets->provides('events', '\Proem\Signal\Manager\Template')) {
- $this->assets->get('events')->trigger([
- 'name' => 'proem.pre.action.' . $action,
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($this->assets)
- ]);
+ $this->assets->get('events')->trigger((new Bootstrap('proem.pre.action.' . $action))->setServiceManager($this->assets));
}
$method = $action . 'Action';
$result = $this->{$method}();
if ($this->assets->provides('events', '\Proem\Signal\Manager\Template')) {
- $this->assets->get('events')->trigger([
- 'name' => 'proem.post.action.' . $action,
- 'params' => [],
- 'target' => $this,
- 'method' => __FUNCTION__,
- 'event' => (new Bootstrap())->setServiceManager($this->assets)
- ]);
+ $this->assets->get('events')->trigger((new Bootstrap('proem.post.action.' . $action))->setServiceManager($this->assets));
}
return $result;
@@ -83,10 +83,7 @@ public function __construct(Manager $assets)
protected function attachRouteMatchListener()
{
if ($this->assets->has('events')) {
- $this->assets->get('events')->attach([
- 'name' => 'proem.route.match',
- 'callback' => [$this, 'testRoute']
- ]);
+ $this->assets->get('events')->attach('proem.route.match', [$this, 'testRoute']);
}
}
@@ -96,10 +93,7 @@ protected function attachRouteMatchListener()
protected function attachRouteExhaustedListener()
{
if ($this->assets->has('events')) {
- $this->assets->get('events')->attach([
- 'name' => 'proem.route.exhausted',
- 'callback' => [$this, 'routesExhausted']
- ]);
+ $this->assets->get('events')->attach('proem.route.exhausted', [$this, 'routesExhausted']);
}
}
@@ -109,10 +103,7 @@ protected function attachRouteExhaustedListener()
protected function attachRouteDispatchListener()
{
if ($this->assets->has('events')) {
- $this->assets->get('events')->attach([
- 'name' => 'proem.route.dispatch',
- 'callback' => [$this, 'dispatch']
- ]);
+ $this->assets->get('events')->attach('proem.route.dispatch', [$this, 'dispatch']);
}
}
@@ -138,29 +129,22 @@ protected function processRoutes()
$router = $assets->get('router');
$dispatched = false;
while ($payload = $router->route()) {
- $assets->get('events')->trigger([
- 'name' => 'proem.route.match',
- 'event' => (new RouteMatch())->setPayload($payload),
- 'callback' => function($e) use (&$dispatched, &$assets) {
+ $assets->get('events')->trigger(
+ (new RouteMatch('proem.route.match'))->setPayload($payload),
+ function($e) use (&$dispatched, &$assets) {
if ($e) {
$dispatched = true;
- $assets->get('events')->trigger([
- 'name' => 'proem.route.dispatch',
- 'event' => (new RouteDispatch)
- ]);
+ $assets->get('events')->trigger(new RouteDispatch('proem.route.dispatch'));
}
}
- ]);
+ );
if ($dispatched) {
break;
}
}
if (!$dispatched) {
- $assets->get('events')->trigger([
- 'name' => 'proem.route.exhausted',
- 'event' => (new RouteExhausted)
- ]);
+ $assets->get('events')->trigger(new RouteExhausted('proem.route.exhausted'));
}
}
}
Oops, something went wrong.

0 comments on commit c0dd9e2

Please sign in to comment.