@@ -47,6 +47,9 @@ |
||
| 47 | 47 | return $this->options[$key] = $value; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | + /** |
|
| 51 | + * @param string $type |
|
| 52 | + */ |
|
| 50 | 53 | protected function formatMethod($key, $type) |
| 51 | 54 | { |
| 52 | 55 | $method = $type . studly_case($key) . 'Attribute'; |
@@ -27,34 +27,34 @@ |
||
| 27 | 27 | $this->pattern = $value; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function __set($key, $value) |
|
| 31 | - { |
|
| 32 | - if (! in_array($key, $this->availableMethods)) { |
|
| 33 | - throw new UnavailableMethodException; |
|
| 34 | - } |
|
| 30 | + public function __set($key, $value) |
|
| 31 | + { |
|
| 32 | + if (! in_array($key, $this->availableMethods)) { |
|
| 33 | + throw new UnavailableMethodException; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - return $this->setAttribute($key, $value); |
|
| 37 | - } |
|
| 36 | + return $this->setAttribute($key, $value); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - protected function setAttribute($key, $value) |
|
| 40 | - { |
|
| 41 | - $method = $this->formatMethod($key, 'set'); |
|
| 39 | + protected function setAttribute($key, $value) |
|
| 40 | + { |
|
| 41 | + $method = $this->formatMethod($key, 'set'); |
|
| 42 | 42 | |
| 43 | - if ($method) { |
|
| 44 | - return $this->{$method}($value); |
|
| 45 | - } |
|
| 43 | + if ($method) { |
|
| 44 | + return $this->{$method}($value); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return $this->options[$key] = $value; |
|
| 48 | - } |
|
| 47 | + return $this->options[$key] = $value; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - protected function formatMethod($key, $type) |
|
| 51 | - { |
|
| 52 | - $method = $type . studly_case($key) . 'Attribute'; |
|
| 50 | + protected function formatMethod($key, $type) |
|
| 51 | + { |
|
| 52 | + $method = $type . studly_case($key) . 'Attribute'; |
|
| 53 | 53 | |
| 54 | - if (method_exists($this, $method)) { |
|
| 55 | - return $method; |
|
| 56 | - } |
|
| 54 | + if (method_exists($this, $method)) { |
|
| 55 | + return $method; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - return null; |
|
| 59 | - } |
|
| 58 | + return null; |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -22,14 +22,14 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function pattern($value) |
| 24 | 24 | { |
| 25 | - $value = (is_array($value)) ? $value : [$value] ; |
|
| 25 | + $value = (is_array($value)) ? $value : [$value]; |
|
| 26 | 26 | |
| 27 | 27 | $this->pattern = $value; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | public function __set($key, $value) |
| 31 | 31 | { |
| 32 | - if (! in_array($key, $this->availableMethods)) { |
|
| 32 | + if (!in_array($key, $this->availableMethods)) { |
|
| 33 | 33 | throw new UnavailableMethodException; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | $availableTypes = array_keys($this->config['options']['available_types']); |
| 27 | 27 | |
| 28 | - if (! in_array($type, $availableTypes)) { |
|
| 28 | + if (!in_array($type, $availableTypes)) { |
|
| 29 | 29 | throw new UnavailableOptionType; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function make($callback) |
| 31 | 31 | { |
| 32 | - if (! $this->class) { |
|
| 32 | + if (!$this->class) { |
|
| 33 | 33 | throw new NoClassInstanciedException; |
| 34 | 34 | } |
| 35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | protected function callFunc($callback, $option) |
| 42 | 42 | { |
| 43 | - if (! $callback instanceof Closure) |
|
| 43 | + if (!$callback instanceof Closure) |
|
| 44 | 44 | { |
| 45 | 45 | throw new CallbackNotValidException(); |
| 46 | 46 | } |
@@ -6,34 +6,34 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ChartServiceProvider extends ServiceProvider{ |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * Indicates if loading of the provider is deferred. |
|
| 11 | - * |
|
| 12 | - * @var bool |
|
| 13 | - */ |
|
| 14 | - protected $defer = false; |
|
| 15 | - |
|
| 16 | - public function boot() |
|
| 17 | - { |
|
| 18 | - $this->publishesConfig(); |
|
| 19 | - } |
|
| 20 | - |
|
| 21 | - public function register() |
|
| 22 | - { |
|
| 23 | - $this->app->bind('chart', function($app) { |
|
| 24 | - |
|
| 25 | - $builder = new Builder(); |
|
| 26 | - |
|
| 27 | - $config = config('charts'); |
|
| 28 | - |
|
| 29 | - return new Chart($builder, $config); |
|
| 30 | - }); |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - protected function publishesConfig() |
|
| 34 | - { |
|
| 35 | - $this->publishes([ |
|
| 36 | - __DIR__.'/Config/charts.php' => config_path('charts.php'), |
|
| 37 | - ]); |
|
| 38 | - } |
|
| 9 | + /** |
|
| 10 | + * Indicates if loading of the provider is deferred. |
|
| 11 | + * |
|
| 12 | + * @var bool |
|
| 13 | + */ |
|
| 14 | + protected $defer = false; |
|
| 15 | + |
|
| 16 | + public function boot() |
|
| 17 | + { |
|
| 18 | + $this->publishesConfig(); |
|
| 19 | + } |
|
| 20 | + |
|
| 21 | + public function register() |
|
| 22 | + { |
|
| 23 | + $this->app->bind('chart', function($app) { |
|
| 24 | + |
|
| 25 | + $builder = new Builder(); |
|
| 26 | + |
|
| 27 | + $config = config('charts'); |
|
| 28 | + |
|
| 29 | + return new Chart($builder, $config); |
|
| 30 | + }); |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + protected function publishesConfig() |
|
| 34 | + { |
|
| 35 | + $this->publishes([ |
|
| 36 | + __DIR__.'/Config/charts.php' => config_path('charts.php'), |
|
| 37 | + ]); |
|
| 38 | + } |
|
| 39 | 39 | } |
| 40 | 40 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | use Illuminate\Support\ServiceProvider; |
| 6 | 6 | |
| 7 | -class ChartServiceProvider extends ServiceProvider{ |
|
| 7 | +class ChartServiceProvider extends ServiceProvider { |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Indicates if loading of the provider is deferred. |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | protected function publishesConfig() |
| 34 | 34 | { |
| 35 | 35 | $this->publishes([ |
| 36 | - __DIR__.'/Config/charts.php' => config_path('charts.php'), |
|
| 36 | + __DIR__ . '/Config/charts.php' => config_path('charts.php'), |
|
| 37 | 37 | ]); |
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | { |
| 10 | 10 | protected function setEnabledAttribute($value) |
| 11 | 11 | { |
| 12 | - if (! is_bool($value)) { |
|
| 12 | + if (!is_bool($value)) { |
|
| 13 | 13 | throw new InvalidArgumentException('Credits Enabled must be : boolean'); |
| 14 | 14 | } |
| 15 | 15 | |
@@ -4,18 +4,18 @@ |
||
| 4 | 4 | |
| 5 | 5 | 'options' => [ |
| 6 | 6 | 'available_types' => [ |
| 7 | - 'title' => ['text','align','style'], |
|
| 7 | + 'title' => ['text', 'align', 'style'], |
|
| 8 | 8 | 'legend' => ['itemStyle'], |
| 9 | - 'plotOptions' => ['plotOption','shared','valueSuffix','series'], |
|
| 10 | - 'subtitle' => ['text','style'], |
|
| 11 | - 'xAxis' => ['title','categories','tickWidth','gridLineWidth','labels'], |
|
| 12 | - 'yAxis' => ['title','label','showFirstLabel'], |
|
| 13 | - 'chart' => ['style','backgroundColor','borderColor','borderRadius','borderWidth','marginTop','className'], |
|
| 9 | + 'plotOptions' => ['plotOption', 'shared', 'valueSuffix', 'series'], |
|
| 10 | + 'subtitle' => ['text', 'style'], |
|
| 11 | + 'xAxis' => ['title', 'categories', 'tickWidth', 'gridLineWidth', 'labels'], |
|
| 12 | + 'yAxis' => ['title', 'label', 'showFirstLabel'], |
|
| 13 | + 'chart' => ['style', 'backgroundColor', 'borderColor', 'borderRadius', 'borderWidth', 'marginTop', 'className'], |
|
| 14 | 14 | 'credits' => ['enabled'], |
| 15 | 15 | ], |
| 16 | 16 | ], |
| 17 | 17 | |
| 18 | 18 | 'series' => [ |
| 19 | - 'available_types' => ['name','data','zIndex','color','type','fillOpacity','lineWidth'], |
|
| 19 | + 'available_types' => ['name', 'data', 'zIndex', 'color', 'type', 'fillOpacity', 'lineWidth'], |
|
| 20 | 20 | ] |
| 21 | 21 | ]; |