@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function setValueFromModel($model) |
| 43 | 43 | { |
| 44 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
| 44 | + if (property_exists($model, $this->name)) { |
|
| 45 | + $this->value = $model->{$this->name}; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | public function setValueFromRequest($request) |
@@ -51,7 +53,9 @@ discard block |
||
| 51 | 53 | |
| 52 | 54 | public function fillModelWithValue($model) |
| 53 | 55 | { |
| 54 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 56 | + if (property_exists($model, $this->name)) { |
|
| 57 | + $model->{$this->name} = $this->value; |
|
| 58 | + } |
|
| 55 | 59 | } |
| 56 | 60 | |
| 57 | 61 | public function validateRequired() |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function setValueFromModel($model) |
| 43 | 43 | { |
| 44 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
| 44 | + if (property_exists($model, $this->name)) { |
|
| 45 | + $this->value = $model->{$this->name}; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | public function setValueFromRequest($request) |
@@ -51,7 +53,9 @@ discard block |
||
| 51 | 53 | |
| 52 | 54 | public function fillModelWithValue($model) |
| 53 | 55 | { |
| 54 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 56 | + if (property_exists($model, $this->name)) { |
|
| 57 | + $model->{$this->name} = $this->value; |
|
| 58 | + } |
|
| 55 | 59 | } |
| 56 | 60 | |
| 57 | 61 | public function validateRequired() |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function setValueFromModel($model) |
| 43 | 43 | { |
| 44 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
| 44 | + if (property_exists($model, $this->name)) { |
|
| 45 | + $this->value = $model->{$this->name}; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | public function setValueFromRequest($request) |
@@ -51,7 +53,9 @@ discard block |
||
| 51 | 53 | |
| 52 | 54 | public function fillModelWithValue($model) |
| 53 | 55 | { |
| 54 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 56 | + if (property_exists($model, $this->name)) { |
|
| 57 | + $model->{$this->name} = $this->value; |
|
| 58 | + } |
|
| 55 | 59 | } |
| 56 | 60 | |
| 57 | 61 | public function validateRequired() |
@@ -41,7 +41,9 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function setValueFromModel($model) |
| 43 | 43 | { |
| 44 | - if (property_exists($model, $this->name)) $this->value = $model->{$this->name}; |
|
| 44 | + if (property_exists($model, $this->name)) { |
|
| 45 | + $this->value = $model->{$this->name}; |
|
| 46 | + } |
|
| 45 | 47 | } |
| 46 | 48 | |
| 47 | 49 | public function setValueFromRequest($request) |
@@ -51,7 +53,9 @@ discard block |
||
| 51 | 53 | |
| 52 | 54 | public function fillModelWithValue($model) |
| 53 | 55 | { |
| 54 | - if (property_exists($model, $this->name)) $model->{$this->name} = $this->value; |
|
| 56 | + if (property_exists($model, $this->name)) { |
|
| 57 | + $model->{$this->name} = $this->value; |
|
| 58 | + } |
|
| 55 | 59 | } |
| 56 | 60 | |
| 57 | 61 | public function validateRequired() |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * |
| 13 | 13 | * @var string |
| 14 | 14 | */ |
| 15 | - protected $path; |
|
| 15 | + protected $path; |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Create a new plugin instance. |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | * @param array $config |
| 21 | 21 | * @return void |
| 22 | 22 | */ |
| 23 | - public function __construct($config = null) |
|
| 24 | - { |
|
| 23 | + public function __construct($config = null) |
|
| 24 | + { |
|
| 25 | 25 | $this->configure($config); |
| 26 | 26 | |
| 27 | - $this->setPath(); |
|
| 28 | - } |
|
| 27 | + $this->setPath(); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Configure the plugin. |
@@ -43,39 +43,39 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - /** |
|
| 46 | + /** |
|
| 47 | 47 | * Set the plugin autoload path. |
| 48 | 48 | * |
| 49 | 49 | * @return void |
| 50 | 50 | */ |
| 51 | - public function setPath() |
|
| 52 | - { |
|
| 51 | + public function setPath() |
|
| 52 | + { |
|
| 53 | 53 | $this->path = Reflect::getDirectory($this); |
| 54 | - } |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 56 | + /** |
|
| 57 | 57 | * Get autoload path. |
| 58 | 58 | * |
| 59 | 59 | * @return string |
| 60 | 60 | */ |
| 61 | - public function path($append = null) |
|
| 62 | - { |
|
| 63 | - return is_null($append) ? $this->path |
|
| 64 | - : $this->path.'/'.ltrim(rtrim($append, '/'), '/').'/'; |
|
| 65 | - } |
|
| 61 | + public function path($append = null) |
|
| 62 | + { |
|
| 63 | + return is_null($append) ? $this->path |
|
| 64 | + : $this->path.'/'.ltrim(rtrim($append, '/'), '/').'/'; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 67 | + /** |
|
| 68 | 68 | * Get paths to templates. |
| 69 | 69 | * |
| 70 | 70 | * @return string |
| 71 | 71 | */ |
| 72 | - public function templatePaths() |
|
| 73 | - { |
|
| 74 | - $path = $this->path('templates'); |
|
| 75 | - return [$path]; |
|
| 76 | - } |
|
| 72 | + public function templatePaths() |
|
| 73 | + { |
|
| 74 | + $path = $this->path('templates'); |
|
| 75 | + return [$path]; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 78 | + /** |
|
| 79 | 79 | * Trigger an event callback. This allows |
| 80 | 80 | * you to hook into events from within the plugin. |
| 81 | 81 | * - onLoad |
@@ -88,19 +88,19 @@ discard block |
||
| 88 | 88 | * - onValid |
| 89 | 89 | * - onInvalid |
| 90 | 90 | * |
| 91 | - * @param \Helmut\Forms\Form $form |
|
| 92 | - * @param string $name |
|
| 93 | - * @param array $params |
|
| 91 | + * @param \Helmut\Forms\Form $form |
|
| 92 | + * @param string $name |
|
| 93 | + * @param array $params |
|
| 94 | 94 | * @return mixed |
| 95 | 95 | */ |
| 96 | - public function event($form, $name, $params = []) |
|
| 97 | - { |
|
| 98 | - $name = Str::studly($name); |
|
| 96 | + public function event($form, $name, $params = []) |
|
| 97 | + { |
|
| 98 | + $name = Str::studly($name); |
|
| 99 | 99 | |
| 100 | - if (method_exists($this, 'on'.$name)) { |
|
| 101 | - return call_user_func_array(array($this, 'on'.$name), [$form, $params]); |
|
| 102 | - } |
|
| 100 | + if (method_exists($this, 'on'.$name)) { |
|
| 101 | + return call_user_func_array(array($this, 'on'.$name), [$form, $params]); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - } |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 106 | } |