@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | header('X-Accel-Buffering: no'); |
| 29 | 29 | ob_end_flush(); |
| 30 | 30 | |
| 31 | - $value->setPrinter(function ($string) { |
|
| 31 | + $value->setPrinter(function($string) { |
|
| 32 | 32 | echo $string; |
| 33 | 33 | |
| 34 | 34 | $length = strlen($string); |
@@ -39,14 +39,14 @@ discard block |
||
| 39 | 39 | flush(); |
| 40 | 40 | ob_flush(); |
| 41 | 41 | }); |
| 42 | - $value->setExceptionHandler(function (\Exception $exception) { |
|
| 42 | + $value->setExceptionHandler(function(\Exception $exception) { |
|
| 43 | 43 | echo '</pre>'; |
| 44 | 44 | echo new Element('div', ['class' => 'alert alert-danger'], [ |
| 45 | 45 | htmlentities($exception->getMessage()) |
| 46 | 46 | ]); |
| 47 | 47 | }); |
| 48 | 48 | |
| 49 | - return new DelayedOutput(function () use ($value) { |
|
| 49 | + return new DelayedOutput(function() use ($value) { |
|
| 50 | 50 | $value->write('<pre>'); |
| 51 | 51 | $value->__toString(); |
| 52 | 52 | $value->write('</pre>'); |
@@ -31,19 +31,19 @@ discard block |
||
| 31 | 31 | public function __construct(WebField $field) { |
| 32 | 32 | $this->field = $field; |
| 33 | 33 | |
| 34 | - $this->handles = function (Parameter $parameter) { |
|
| 34 | + $this->handles = function(Parameter $parameter) { |
|
| 35 | 35 | return $this->field->handles($parameter); |
| 36 | 36 | }; |
| 37 | - $this->beforeRender = function ($value) { |
|
| 37 | + $this->beforeRender = function($value) { |
|
| 38 | 38 | return $value; |
| 39 | 39 | }; |
| 40 | - $this->afterInflate = function ($value) { |
|
| 40 | + $this->afterInflate = function($value) { |
|
| 41 | 41 | return $value; |
| 42 | 42 | }; |
| 43 | - $this->afterHeadElements = function ($elements) { |
|
| 43 | + $this->afterHeadElements = function($elements) { |
|
| 44 | 44 | return $elements; |
| 45 | 45 | }; |
| 46 | - $this->transformParameter = function ($parameter) { |
|
| 46 | + $this->transformParameter = function($parameter) { |
|
| 47 | 47 | return $parameter; |
| 48 | 48 | }; |
| 49 | 49 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @return static |
| 106 | 106 | */ |
| 107 | 107 | public function setHandlesParameterName($name) { |
| 108 | - $this->setHandles(function (Parameter $parameter) use ($name) { |
|
| 108 | + $this->setHandles(function(Parameter $parameter) use ($name) { |
|
| 109 | 109 | return $parameter->getName() == $name; |
| 110 | 110 | }); |
| 111 | 111 | return $this; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * @return array|BreadCrumb[] |
|
| 32 | + * @return BreadCrumb[] |
|
| 33 | 33 | */ |
| 34 | 34 | public function getCrumbs() { |
| 35 | 35 | return $this->crumbs; |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | /** |
| 50 | 50 | * @param Action $action |
| 51 | 51 | * @param string $actionId |
| 52 | - * @return array|BreadCrumb[] |
|
| 52 | + * @return BreadCrumb[] |
|
| 53 | 53 | */ |
| 54 | 54 | public function updateCrumbs(Action $action, $actionId) { |
| 55 | 55 | $current = new BreadCrumb($action->caption(), $this->makeTarget($actionId, $action)); |
@@ -71,6 +71,11 @@ discard block |
||
| 71 | 71 | $this->crumbs = []; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | + /** |
|
| 75 | + * @param string $actionId |
|
| 76 | + * |
|
| 77 | + * @return string |
|
| 78 | + */ |
|
| 74 | 79 | private function makeTarget($actionId, Action $action) { |
| 75 | 80 | $target = $actionId; |
| 76 | 81 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | private function readCrumbs(CookieStore $cookies) { |
| 32 | 32 | if ($cookies->hasKey(self::COOKIE_KEY)) { |
| 33 | - return array_map(function ($array) { |
|
| 33 | + return array_map(function($array) { |
|
| 34 | 34 | return new BreadCrumb($array['caption'], $array['target']); |
| 35 | 35 | }, $cookies->read(self::COOKIE_KEY)->payload); |
| 36 | 36 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @return BreadCrumb[] |
| 43 | 43 | */ |
| 44 | 44 | private function saveCrumbs($crumbs) { |
| 45 | - $this->cookies->create(new Cookie(array_map(function (BreadCrumb $crumb) { |
|
| 45 | + $this->cookies->create(new Cookie(array_map(function(BreadCrumb $crumb) { |
|
| 46 | 46 | return [ |
| 47 | 47 | 'caption' => $crumb->getCaption(), |
| 48 | 48 | 'target' => $crumb->getTarget() |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | |
| 43 | 43 | $serialized = array_values($serialized); |
| 44 | 44 | $serialized = array_values(array_slice($serialized, 1)); |
| 45 | - $serialized = array_map(function ($item) use ($itemParameter) { |
|
| 45 | + $serialized = array_map(function($item) use ($itemParameter) { |
|
| 46 | 46 | return $this->fields->getField($itemParameter)->inflate($itemParameter, $item); |
| 47 | 47 | }, $serialized); |
| 48 | 48 | return $serialized; |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | public function render() { |
| 37 | - $render = function (MenuItem $item) { |
|
| 37 | + $render = function(MenuItem $item) { |
|
| 38 | 38 | return $item->render(); |
| 39 | 39 | }; |
| 40 | 40 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | new Element('span', ['class' => 'caret']) |
| 34 | 34 | ]), |
| 35 | 35 | new Element('ul', ['class' => 'dropdown-menu'], |
| 36 | - array_map(function (MenuItem $item) { |
|
| 36 | + array_map(function(MenuItem $item) { |
|
| 37 | 37 | return $item->render(); |
| 38 | 38 | }, $this->items) |
| 39 | 39 | ) |
@@ -34,21 +34,21 @@ |
||
| 34 | 34 | /** @var ControllerCollection $controller */ |
| 35 | 35 | $controller = $app['controllers_factory']; |
| 36 | 36 | |
| 37 | - $controller->get('/', function (Request $request) { |
|
| 38 | - return $this->respond($request, function (BreadCrumbsTrail $crumbs) { |
|
| 37 | + $controller->get('/', function(Request $request) { |
|
| 38 | + return $this->respond($request, function(BreadCrumbsTrail $crumbs) { |
|
| 39 | 39 | $actionList = new ActionListResource($this->domin, $crumbs); |
| 40 | 40 | return $actionList->handleGet(); |
| 41 | 41 | }); |
| 42 | 42 | }); |
| 43 | - $controller->get('/{action}', function ($action, Request $request) { |
|
| 44 | - return $this->respond($request, function (BreadCrumbsTrail $crumbs, ParameterReader $reader) use ($action, $request) { |
|
| 43 | + $controller->get('/{action}', function($action, Request $request) { |
|
| 44 | + return $this->respond($request, function(BreadCrumbsTrail $crumbs, ParameterReader $reader) use ($action, $request) { |
|
| 45 | 45 | $execution = new ExecutionResource($this->domin, $reader, $crumbs); |
| 46 | 46 | $force = !!$request->get(ExecutionResource::FORCE_ARG, false); |
| 47 | 47 | return $execution->handleGet($action, $force); |
| 48 | 48 | }); |
| 49 | 49 | }); |
| 50 | - $controller->post('/{action}', function ($action, Request $request) { |
|
| 51 | - return $this->respond($request, function (BreadCrumbsTrail $crumbs, ParameterReader $reader) use ($action, $request) { |
|
| 50 | + $controller->post('/{action}', function($action, Request $request) { |
|
| 51 | + return $this->respond($request, function(BreadCrumbsTrail $crumbs, ParameterReader $reader) use ($action, $request) { |
|
| 52 | 52 | $execution = new ExecutionResource($this->domin, $reader, $crumbs); |
| 53 | 53 | return $execution->handlePost($action); |
| 54 | 54 | }); |
@@ -30,13 +30,13 @@ |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $serialized = json_decode($cookies->get(self::COOKIE_NAME), true); |
| 33 | - return array_map(function ($item) { |
|
| 33 | + return array_map(function($item) { |
|
| 34 | 34 | return new BreadCrumb($item['caption'], $item['target']); |
| 35 | 35 | }, $serialized); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | public function getCookie() { |
| 39 | - return new Cookie(self::COOKIE_NAME, json_encode(array_map(function (BreadCrumb $crumb) { |
|
| 39 | + return new Cookie(self::COOKIE_NAME, json_encode(array_map(function(BreadCrumb $crumb) { |
|
| 40 | 40 | return [ |
| 41 | 41 | 'target' => $crumb->getTarget(), |
| 42 | 42 | 'caption' => $crumb->getCaption() |