@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace EnergieProduction\Chart; |
| 4 | 4 | |
| 5 | -use Illuminate\Support\Collection; |
|
| 6 | 5 | use Illuminate\Support\ServiceProvider; |
| 7 | 6 | |
| 8 | 7 | class ChartServiceProvider extends ServiceProvider |
@@ -8,22 +8,22 @@ |
||
| 8 | 8 | class ChartServiceProvider extends ServiceProvider |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Indicates if loading of the provider is deferred. |
|
| 13 | - * |
|
| 14 | - * @var bool |
|
| 15 | - */ |
|
| 16 | - protected $defer = false; |
|
| 11 | + /** |
|
| 12 | + * Indicates if loading of the provider is deferred. |
|
| 13 | + * |
|
| 14 | + * @var bool |
|
| 15 | + */ |
|
| 16 | + protected $defer = false; |
|
| 17 | 17 | |
| 18 | - public function boot() |
|
| 19 | - { |
|
| 20 | - // |
|
| 21 | - } |
|
| 18 | + public function boot() |
|
| 19 | + { |
|
| 20 | + // |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function register() |
|
| 24 | - { |
|
| 25 | - $this->app->bind('chart', function ($app) { |
|
| 26 | - return new Chart(); |
|
| 27 | - }); |
|
| 28 | - } |
|
| 23 | + public function register() |
|
| 24 | + { |
|
| 25 | + $this->app->bind('chart', function ($app) { |
|
| 26 | + return new Chart(); |
|
| 27 | + }); |
|
| 28 | + } |
|
| 29 | 29 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function register() |
| 24 | 24 | { |
| 25 | - $this->app->bind('chart', function ($app) { |
|
| 25 | + $this->app->bind('chart', function($app) { |
|
| 26 | 26 | return new Chart(); |
| 27 | 27 | }); |
| 28 | 28 | } |
@@ -4,82 +4,82 @@ |
||
| 4 | 4 | |
| 5 | 5 | class TestRenderable extends \PHPUnit\Framework\TestCase |
| 6 | 6 | { |
| 7 | - public function testBasicRender() |
|
| 8 | - { |
|
| 9 | - $render = new Renderable\Render; |
|
| 7 | + public function testBasicRender() |
|
| 8 | + { |
|
| 9 | + $render = new Renderable\Render; |
|
| 10 | 10 | |
| 11 | - $result = $render->handle('test_key', 'test_content'); |
|
| 11 | + $result = $render->handle('test_key', 'test_content'); |
|
| 12 | 12 | |
| 13 | - $this->assertArraySubset(['test_key' => 'test_content'], $result); |
|
| 14 | - } |
|
| 13 | + $this->assertArraySubset(['test_key' => 'test_content'], $result); |
|
| 14 | + } |
|
| 15 | 15 | |
| 16 | - public function testRenderCriteria() |
|
| 17 | - { |
|
| 18 | - $render = new Renderable\Render; |
|
| 16 | + public function testRenderCriteria() |
|
| 17 | + { |
|
| 18 | + $render = new Renderable\Render; |
|
| 19 | 19 | |
| 20 | - $render = new Renderable\Criteria($render); |
|
| 20 | + $render = new Renderable\Criteria($render); |
|
| 21 | 21 | |
| 22 | - $result = $render->handle('test_key', 'test_content'); |
|
| 22 | + $result = $render->handle('test_key', 'test_content'); |
|
| 23 | 23 | |
| 24 | - $this->assertArraySubset(['test_key' => 'test_content'], $result); |
|
| 25 | - } |
|
| 24 | + $this->assertArraySubset(['test_key' => 'test_content'], $result); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - public function testRenderExpression() |
|
| 28 | - { |
|
| 29 | - $render = new Renderable\Render; |
|
| 27 | + public function testRenderExpression() |
|
| 28 | + { |
|
| 29 | + $render = new Renderable\Render; |
|
| 30 | 30 | |
| 31 | - $render = new Renderable\Expression($render); |
|
| 31 | + $render = new Renderable\Expression($render); |
|
| 32 | 32 | |
| 33 | - $result = $render->handle('test_key', 'test_content'); |
|
| 33 | + $result = $render->handle('test_key', 'test_content'); |
|
| 34 | 34 | |
| 35 | - $this->assertArraySubset(['test_key' => '#!!test_content!!#'], $result); |
|
| 36 | - } |
|
| 35 | + $this->assertArraySubset(['test_key' => '#!!test_content!!#'], $result); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - public function testRenderCriteriaWithExpression() |
|
| 39 | - { |
|
| 40 | - $render = new Renderable\Render; |
|
| 38 | + public function testRenderCriteriaWithExpression() |
|
| 39 | + { |
|
| 40 | + $render = new Renderable\Render; |
|
| 41 | 41 | |
| 42 | - $render = new Renderable\Criteria($render); |
|
| 42 | + $render = new Renderable\Criteria($render); |
|
| 43 | 43 | |
| 44 | - $render = new Renderable\Expression($render); |
|
| 44 | + $render = new Renderable\Expression($render); |
|
| 45 | 45 | |
| 46 | - $result = $render->handle('test_key', 'test_content'); |
|
| 46 | + $result = $render->handle('test_key', 'test_content'); |
|
| 47 | 47 | |
| 48 | - $this->assertArraySubset(['test_key' => '#!!test_content!!#'], $result); |
|
| 49 | - } |
|
| 48 | + $this->assertArraySubset(['test_key' => '#!!test_content!!#'], $result); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - public function testRenderSubset() |
|
| 52 | - { |
|
| 53 | - $render = new Renderable\Render; |
|
| 51 | + public function testRenderSubset() |
|
| 52 | + { |
|
| 53 | + $render = new Renderable\Render; |
|
| 54 | 54 | |
| 55 | - $render = new Renderable\Subset($render); |
|
| 55 | + $render = new Renderable\Subset($render); |
|
| 56 | 56 | |
| 57 | - $result = $render->handle('test_key', 'test_content'); |
|
| 57 | + $result = $render->handle('test_key', 'test_content'); |
|
| 58 | 58 | |
| 59 | - $this->assertArraySubset(['test_key' => 'test_content'], $result); |
|
| 60 | - } |
|
| 59 | + $this->assertArraySubset(['test_key' => 'test_content'], $result); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - public function testRenderSubsetWhitDotNotation() |
|
| 63 | - { |
|
| 64 | - $render = new Renderable\Render; |
|
| 62 | + public function testRenderSubsetWhitDotNotation() |
|
| 63 | + { |
|
| 64 | + $render = new Renderable\Render; |
|
| 65 | 65 | |
| 66 | - $render = new Renderable\Subset($render); |
|
| 66 | + $render = new Renderable\Subset($render); |
|
| 67 | 67 | |
| 68 | - $result = $render->handle('test.key', 'test_content'); |
|
| 68 | + $result = $render->handle('test.key', 'test_content'); |
|
| 69 | 69 | |
| 70 | - $this->assertArraySubset(['test' => ['key' => 'test_content']], $result); |
|
| 71 | - } |
|
| 70 | + $this->assertArraySubset(['test' => ['key' => 'test_content']], $result); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - public function testRenderSubsetExpressionWhitDotNotation() |
|
| 74 | - { |
|
| 75 | - $render = new Renderable\Render; |
|
| 73 | + public function testRenderSubsetExpressionWhitDotNotation() |
|
| 74 | + { |
|
| 75 | + $render = new Renderable\Render; |
|
| 76 | 76 | |
| 77 | - $render = new Renderable\Subset($render); |
|
| 77 | + $render = new Renderable\Subset($render); |
|
| 78 | 78 | |
| 79 | - $render = new Renderable\Expression($render); |
|
| 79 | + $render = new Renderable\Expression($render); |
|
| 80 | 80 | |
| 81 | - $result = $render->handle('test.key', 'test_content'); |
|
| 81 | + $result = $render->handle('test.key', 'test_content'); |
|
| 82 | 82 | |
| 83 | - $this->assertArraySubset(['test' => ['key' => '#!!test_content!!#']], $result); |
|
| 84 | - } |
|
| 83 | + $this->assertArraySubset(['test' => ['key' => '#!!test_content!!#']], $result); |
|
| 84 | + } |
|
| 85 | 85 | } |
@@ -5,35 +5,35 @@ |
||
| 5 | 5 | |
| 6 | 6 | class Test extends \PHPUnit\Framework\TestCase |
| 7 | 7 | { |
| 8 | - // public function __construct() |
|
| 9 | - // { |
|
| 10 | - // $this->renderMock = Mockery::mock(Rendered\Render::class); |
|
| 11 | - // } |
|
| 8 | + // public function __construct() |
|
| 9 | + // { |
|
| 10 | + // $this->renderMock = Mockery::mock(Rendered\Render::class); |
|
| 11 | + // } |
|
| 12 | 12 | |
| 13 | - // public function testRenderedRender() |
|
| 14 | - // { |
|
| 15 | - // $render = new Rendered\Render; |
|
| 13 | + // public function testRenderedRender() |
|
| 14 | + // { |
|
| 15 | + // $render = new Rendered\Render; |
|
| 16 | 16 | |
| 17 | - // $render->handle('test_key', 'test_content'); |
|
| 17 | + // $render->handle('test_key', 'test_content'); |
|
| 18 | 18 | |
| 19 | - // $this->assertArraySubset(['test_key' => 'test_content'], $result); |
|
| 20 | - // } |
|
| 19 | + // $this->assertArraySubset(['test_key' => 'test_content'], $result); |
|
| 20 | + // } |
|
| 21 | 21 | |
| 22 | - // public function testCriteria() |
|
| 23 | - // { |
|
| 22 | + // public function testCriteria() |
|
| 23 | + // { |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | - // $render = new Rendered\Render; |
|
| 27 | - // $render = new Rendered\Criteria($render); |
|
| 26 | + // $render = new Rendered\Render; |
|
| 27 | + // $render = new Rendered\Criteria($render); |
|
| 28 | 28 | |
| 29 | - // $this->renderMock->shouldReceive('handle') |
|
| 30 | - // ->once() |
|
| 31 | - // ->andReturn(['test_key' => 'test_content']); |
|
| 29 | + // $this->renderMock->shouldReceive('handle') |
|
| 30 | + // ->once() |
|
| 31 | + // ->andReturn(['test_key' => 'test_content']); |
|
| 32 | 32 | |
| 33 | - // $this->app->instance(Rendered\Render::class, $mock); |
|
| 33 | + // $this->app->instance(Rendered\Render::class, $mock); |
|
| 34 | 34 | |
| 35 | - // $result = $render->handle('test_key', 'test_content'); |
|
| 35 | + // $result = $render->handle('test_key', 'test_content'); |
|
| 36 | 36 | |
| 37 | - // $this->assertArraySubset(['test_key' => 'test_content'], $result); |
|
| 38 | - // } |
|
| 37 | + // $this->assertArraySubset(['test_key' => 'test_content'], $result); |
|
| 38 | + // } |
|
| 39 | 39 | } |
@@ -7,53 +7,53 @@ |
||
| 7 | 7 | class Subset implements Renderable |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * [__construct description] |
|
| 12 | - * @param \EnergieProduction\Chart\Contracts\Renderable $render |
|
| 13 | - */ |
|
| 14 | - public function __construct(Renderable $render) |
|
| 15 | - { |
|
| 16 | - $this->render = $render; |
|
| 17 | - } |
|
| 18 | - |
|
| 19 | - /** |
|
| 20 | - * [handle description] |
|
| 21 | - * @param string $key |
|
| 22 | - * @param mixed $content |
|
| 23 | - * @return array |
|
| 24 | - */ |
|
| 25 | - public function handle($key, $content) |
|
| 26 | - { |
|
| 27 | - if (str_contains($key, '.')) { |
|
| 28 | - $path = explode('.', $key); |
|
| 29 | - |
|
| 30 | - $result = []; |
|
| 31 | - |
|
| 32 | - $this->dotNotationToArray($result, $path, $content); |
|
| 33 | - |
|
| 34 | - return $this->render->handle($path[0], $result); |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - return $this->render->handle($key, $content); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * [dotNotationToArray description] |
|
| 42 | - * @param array &$arr |
|
| 43 | - * @param string $path |
|
| 44 | - * @param string $val |
|
| 45 | - * @return array |
|
| 46 | - */ |
|
| 47 | - protected function dotNotationToArray(array &$arr, $path, $val) |
|
| 48 | - { |
|
| 49 | - $loc = &$arr; |
|
| 50 | - |
|
| 51 | - array_shift($path); |
|
| 52 | - |
|
| 53 | - foreach ($path as $step) { |
|
| 54 | - $loc = &$loc[$step]; |
|
| 55 | - } |
|
| 10 | + /** |
|
| 11 | + * [__construct description] |
|
| 12 | + * @param \EnergieProduction\Chart\Contracts\Renderable $render |
|
| 13 | + */ |
|
| 14 | + public function __construct(Renderable $render) |
|
| 15 | + { |
|
| 16 | + $this->render = $render; |
|
| 17 | + } |
|
| 18 | + |
|
| 19 | + /** |
|
| 20 | + * [handle description] |
|
| 21 | + * @param string $key |
|
| 22 | + * @param mixed $content |
|
| 23 | + * @return array |
|
| 24 | + */ |
|
| 25 | + public function handle($key, $content) |
|
| 26 | + { |
|
| 27 | + if (str_contains($key, '.')) { |
|
| 28 | + $path = explode('.', $key); |
|
| 29 | + |
|
| 30 | + $result = []; |
|
| 31 | + |
|
| 32 | + $this->dotNotationToArray($result, $path, $content); |
|
| 33 | + |
|
| 34 | + return $this->render->handle($path[0], $result); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + return $this->render->handle($key, $content); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * [dotNotationToArray description] |
|
| 42 | + * @param array &$arr |
|
| 43 | + * @param string $path |
|
| 44 | + * @param string $val |
|
| 45 | + * @return array |
|
| 46 | + */ |
|
| 47 | + protected function dotNotationToArray(array &$arr, $path, $val) |
|
| 48 | + { |
|
| 49 | + $loc = &$arr; |
|
| 50 | + |
|
| 51 | + array_shift($path); |
|
| 52 | + |
|
| 53 | + foreach ($path as $step) { |
|
| 54 | + $loc = &$loc[$step]; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - return $loc = $val; |
|
| 58 | - } |
|
| 57 | + return $loc = $val; |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -7,14 +7,14 @@ |
||
| 7 | 7 | class Render implements Renderable |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * [handle description] |
|
| 12 | - * @param string $key |
|
| 13 | - * @param mixed $content |
|
| 14 | - * @return array |
|
| 15 | - */ |
|
| 16 | - public function handle($key, $content) |
|
| 17 | - { |
|
| 18 | - return [$key => $content]; |
|
| 19 | - } |
|
| 10 | + /** |
|
| 11 | + * [handle description] |
|
| 12 | + * @param string $key |
|
| 13 | + * @param mixed $content |
|
| 14 | + * @return array |
|
| 15 | + */ |
|
| 16 | + public function handle($key, $content) |
|
| 17 | + { |
|
| 18 | + return [$key => $content]; |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -7,23 +7,23 @@ |
||
| 7 | 7 | class Criteria implements Renderable |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - /** |
|
| 11 | - * [__construct description] |
|
| 12 | - * @param \EnergieProduction\Chart\Contracts\Renderable $render |
|
| 13 | - */ |
|
| 14 | - public function __construct(Renderable $render) |
|
| 15 | - { |
|
| 16 | - $this->render = $render; |
|
| 17 | - } |
|
| 10 | + /** |
|
| 11 | + * [__construct description] |
|
| 12 | + * @param \EnergieProduction\Chart\Contracts\Renderable $render |
|
| 13 | + */ |
|
| 14 | + public function __construct(Renderable $render) |
|
| 15 | + { |
|
| 16 | + $this->render = $render; |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * [handle description] |
|
| 21 | - * @param string $key |
|
| 22 | - * @param mixed $content |
|
| 23 | - * @return array |
|
| 24 | - */ |
|
| 25 | - public function handle($key, $content) |
|
| 26 | - { |
|
| 27 | - return $this->render->handle($key, $content); |
|
| 28 | - } |
|
| 19 | + /** |
|
| 20 | + * [handle description] |
|
| 21 | + * @param string $key |
|
| 22 | + * @param mixed $content |
|
| 23 | + * @return array |
|
| 24 | + */ |
|
| 25 | + public function handle($key, $content) |
|
| 26 | + { |
|
| 27 | + return $this->render->handle($key, $content); |
|
| 28 | + } |
|
| 29 | 29 | } |
@@ -7,25 +7,25 @@ |
||
| 7 | 7 | class Expression implements Renderable |
| 8 | 8 | { |
| 9 | 9 | |
| 10 | - protected $render; |
|
| 10 | + protected $render; |
|
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * [__construct description] |
|
| 14 | - * @param \EnergieProduction\Chart\Contracts\Renderable $render |
|
| 15 | - */ |
|
| 16 | - public function __construct(Renderable $render) |
|
| 17 | - { |
|
| 18 | - $this->render = $render; |
|
| 19 | - } |
|
| 12 | + /** |
|
| 13 | + * [__construct description] |
|
| 14 | + * @param \EnergieProduction\Chart\Contracts\Renderable $render |
|
| 15 | + */ |
|
| 16 | + public function __construct(Renderable $render) |
|
| 17 | + { |
|
| 18 | + $this->render = $render; |
|
| 19 | + } |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * [handle description] |
|
| 23 | - * @param string $key |
|
| 24 | - * @param mixed $content |
|
| 25 | - * @return array |
|
| 26 | - */ |
|
| 27 | - public function handle($key, $content) |
|
| 28 | - { |
|
| 29 | - return $this->render->handle($key, "#!!" . $content . "!!#"); |
|
| 30 | - } |
|
| 21 | + /** |
|
| 22 | + * [handle description] |
|
| 23 | + * @param string $key |
|
| 24 | + * @param mixed $content |
|
| 25 | + * @return array |
|
| 26 | + */ |
|
| 27 | + public function handle($key, $content) |
|
| 28 | + { |
|
| 29 | + return $this->render->handle($key, "#!!" . $content . "!!#"); |
|
| 30 | + } |
|
| 31 | 31 | } |
@@ -8,59 +8,59 @@ |
||
| 8 | 8 | class Chart |
| 9 | 9 | { |
| 10 | 10 | |
| 11 | - protected $options = []; |
|
| 11 | + protected $options = []; |
|
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * [pushSubset description] |
|
| 15 | - * @param string $subset |
|
| 16 | - * @param closure $closure |
|
| 17 | - * @throws EnergieProduction\Chart\Exceptions\DotNotationNotAvailableException |
|
| 18 | - * @return void |
|
| 19 | - */ |
|
| 20 | - public function pushSubset($subset, closure $closure) |
|
| 21 | - { |
|
| 22 | - $option = new Option(); |
|
| 13 | + /** |
|
| 14 | + * [pushSubset description] |
|
| 15 | + * @param string $subset |
|
| 16 | + * @param closure $closure |
|
| 17 | + * @throws EnergieProduction\Chart\Exceptions\DotNotationNotAvailableException |
|
| 18 | + * @return void |
|
| 19 | + */ |
|
| 20 | + public function pushSubset($subset, closure $closure) |
|
| 21 | + { |
|
| 22 | + $option = new Option(); |
|
| 23 | 23 | |
| 24 | - $option->pushSubset($subset, $closure); |
|
| 24 | + $option->pushSubset($subset, $closure); |
|
| 25 | 25 | |
| 26 | - $render = $option->render(); |
|
| 26 | + $render = $option->render(); |
|
| 27 | 27 | |
| 28 | - if (starts_with($subset, 'series')) { |
|
| 29 | - if (str_contains($subset, '.')) { |
|
| 30 | - throw new Exceptions\DotNotationNotAvailableException(); |
|
| 31 | - } |
|
| 28 | + if (starts_with($subset, 'series')) { |
|
| 29 | + if (str_contains($subset, '.')) { |
|
| 30 | + throw new Exceptions\DotNotationNotAvailableException(); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - $this->options['series'][] = $render['series']; |
|
| 34 | - } else { |
|
| 35 | - $this->options = array_merge_recursive($this->options, $render); |
|
| 36 | - } |
|
| 37 | - } |
|
| 33 | + $this->options['series'][] = $render['series']; |
|
| 34 | + } else { |
|
| 35 | + $this->options = array_merge_recursive($this->options, $render); |
|
| 36 | + } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * [render description] |
|
| 41 | - * @return void |
|
| 42 | - */ |
|
| 43 | - public function render() |
|
| 44 | - { |
|
| 45 | - $formatedOption = json_encode($this->options); |
|
| 39 | + /** |
|
| 40 | + * [render description] |
|
| 41 | + * @return void |
|
| 42 | + */ |
|
| 43 | + public function render() |
|
| 44 | + { |
|
| 45 | + $formatedOption = json_encode($this->options); |
|
| 46 | 46 | |
| 47 | - if (str_contains($formatedOption, '"#!!')) { |
|
| 48 | - $formatedOption = $this->restoreExpressions($formatedOption); |
|
| 49 | - } |
|
| 47 | + if (str_contains($formatedOption, '"#!!')) { |
|
| 48 | + $formatedOption = $this->restoreExpressions($formatedOption); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - return $formatedOption; |
|
| 52 | - } |
|
| 51 | + return $formatedOption; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * [restoreExpressions description] |
|
| 56 | - * @param string $formatedOption |
|
| 57 | - * @return string |
|
| 58 | - */ |
|
| 59 | - protected function restoreExpressions($formatedOption) |
|
| 60 | - { |
|
| 61 | - $formatedOption = str_replace('"#!!', '', $formatedOption); |
|
| 62 | - $formatedOption = str_replace('!!#"', '', $formatedOption); |
|
| 54 | + /** |
|
| 55 | + * [restoreExpressions description] |
|
| 56 | + * @param string $formatedOption |
|
| 57 | + * @return string |
|
| 58 | + */ |
|
| 59 | + protected function restoreExpressions($formatedOption) |
|
| 60 | + { |
|
| 61 | + $formatedOption = str_replace('"#!!', '', $formatedOption); |
|
| 62 | + $formatedOption = str_replace('!!#"', '', $formatedOption); |
|
| 63 | 63 | |
| 64 | - return $formatedOption; |
|
| 65 | - } |
|
| 64 | + return $formatedOption; |
|
| 65 | + } |
|
| 66 | 66 | } |
@@ -9,63 +9,63 @@ |
||
| 9 | 9 | class Option |
| 10 | 10 | { |
| 11 | 11 | |
| 12 | - protected $options; |
|
| 12 | + protected $options; |
|
| 13 | 13 | |
| 14 | - public function __construct() |
|
| 15 | - { |
|
| 16 | - $this->options = []; |
|
| 17 | - } |
|
| 14 | + public function __construct() |
|
| 15 | + { |
|
| 16 | + $this->options = []; |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * [pushSubset description] |
|
| 21 | - * @param string $subset |
|
| 22 | - * @param \closure $closure |
|
| 23 | - * @return void |
|
| 24 | - */ |
|
| 25 | - public function pushSubset($subset, closure $closure) |
|
| 26 | - { |
|
| 27 | - $option = new self; |
|
| 19 | + /** |
|
| 20 | + * [pushSubset description] |
|
| 21 | + * @param string $subset |
|
| 22 | + * @param \closure $closure |
|
| 23 | + * @return void |
|
| 24 | + */ |
|
| 25 | + public function pushSubset($subset, closure $closure) |
|
| 26 | + { |
|
| 27 | + $option = new self; |
|
| 28 | 28 | |
| 29 | - call_user_func($closure, $option); |
|
| 29 | + call_user_func($closure, $option); |
|
| 30 | 30 | |
| 31 | - $render = new Renderable\Render(); |
|
| 32 | - $render = new Renderable\Subset($render); |
|
| 31 | + $render = new Renderable\Render(); |
|
| 32 | + $render = new Renderable\Subset($render); |
|
| 33 | 33 | |
| 34 | - $this->options = array_merge($this->options, $render->handle( |
|
| 35 | - $subset, |
|
| 36 | - $option->render() |
|
| 37 | - )); |
|
| 38 | - } |
|
| 34 | + $this->options = array_merge($this->options, $render->handle( |
|
| 35 | + $subset, |
|
| 36 | + $option->render() |
|
| 37 | + )); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * [pushCriteria description] |
|
| 42 | - * @param mixed $criteria |
|
| 43 | - * @return void |
|
| 44 | - */ |
|
| 45 | - public function pushCriteria($criteria) |
|
| 46 | - { |
|
| 47 | - $content = $criteria->getcontent(); |
|
| 40 | + /** |
|
| 41 | + * [pushCriteria description] |
|
| 42 | + * @param mixed $criteria |
|
| 43 | + * @return void |
|
| 44 | + */ |
|
| 45 | + public function pushCriteria($criteria) |
|
| 46 | + { |
|
| 47 | + $content = $criteria->getcontent(); |
|
| 48 | 48 | |
| 49 | - $render = new Renderable\Render(); |
|
| 50 | - $render = new Renderable\Criteria($render); |
|
| 49 | + $render = new Renderable\Render(); |
|
| 50 | + $render = new Renderable\Criteria($render); |
|
| 51 | 51 | |
| 52 | - if ($content instanceof Expression) { |
|
| 53 | - $render = new Renderable\Expression($render); |
|
| 54 | - $content = $content->render(); |
|
| 55 | - } |
|
| 52 | + if ($content instanceof Expression) { |
|
| 53 | + $render = new Renderable\Expression($render); |
|
| 54 | + $content = $content->render(); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - $this->options = array_merge($this->options, $render->handle( |
|
| 58 | - $criteria->resolveKey(), |
|
| 59 | - $content |
|
| 60 | - )); |
|
| 61 | - } |
|
| 57 | + $this->options = array_merge($this->options, $render->handle( |
|
| 58 | + $criteria->resolveKey(), |
|
| 59 | + $content |
|
| 60 | + )); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * [render description] |
|
| 65 | - * @return array |
|
| 66 | - */ |
|
| 67 | - public function render() |
|
| 68 | - { |
|
| 69 | - return $this->options; |
|
| 70 | - } |
|
| 63 | + /** |
|
| 64 | + * [render description] |
|
| 65 | + * @return array |
|
| 66 | + */ |
|
| 67 | + public function render() |
|
| 68 | + { |
|
| 69 | + return $this->options; |
|
| 70 | + } |
|
| 71 | 71 | } |