@@ -8,9 +8,9 @@ |
||
| 8 | 8 | class Component_number |
| 9 | 9 | extends AbstractComponent |
| 10 | 10 | implements ValueComponentInterface, |
| 11 | - DisableableComponentInterface, |
|
| 12 | - FilterableComponentInterface, |
|
| 13 | - ValidatableComponentInterface |
|
| 11 | + DisableableComponentInterface, |
|
| 12 | + FilterableComponentInterface, |
|
| 13 | + ValidatableComponentInterface |
|
| 14 | 14 | { |
| 15 | 15 | public function default_model() |
| 16 | 16 | { |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | 'required' => false, |
| 26 | 26 | 'readonly' => false, |
| 27 | 27 | 'default' => null, |
| 28 | - 'filter' => array( $this, 'filter' ), |
|
| 29 | - 'validation' => array( $this, 'validation' ) |
|
| 28 | + 'filter' => array($this, 'filter'), |
|
| 29 | + 'validation' => array($this, 'validation') |
|
| 30 | 30 | ); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -35,15 +35,15 @@ discard block |
||
| 35 | 35 | return floatval($v); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public function validation($v,&$e) |
|
| 38 | + public function validation($v, &$e) |
|
| 39 | 39 | { |
| 40 | - if(null !== $this->max && $v > $this->max) |
|
| 40 | + if (null !== $this->max && $v > $this->max) |
|
| 41 | 41 | { |
| 42 | 42 | $e = "must be less than {$this->max}"; |
| 43 | 43 | return false; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if(null !== $this->min && $v < $this->min) |
|
| 46 | + if (null !== $this->min && $v < $this->min) |
|
| 47 | 47 | { |
| 48 | 48 | $e = "must be greater than {$this->min}"; |
| 49 | 49 | return false; |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | class Component_checkbox |
| 9 | 9 | extends AbstractComponent |
| 10 | 10 | implements ValueComponentInterface, |
| 11 | - DisableableComponentInterface |
|
| 11 | + DisableableComponentInterface |
|
| 12 | 12 | { |
| 13 | 13 | public function default_model() |
| 14 | 14 | { |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | * @param array $model |
| 26 | 26 | * @param string $template_path |
| 27 | 27 | */ |
| 28 | - public function __construct( array $model = array(), $template_path = null ) |
|
| 28 | + public function __construct(array $model = array(), $template_path = null) |
|
| 29 | 29 | { |
| 30 | - $this->set_model( $model ); |
|
| 30 | + $this->set_model($model); |
|
| 31 | 31 | $this->template = $template_path; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return mixed the argument's value. |
| 40 | 40 | */ |
| 41 | - public function __get( $name ) |
|
| 41 | + public function __get($name) |
|
| 42 | 42 | { |
| 43 | - if( isset( $this->model[$name] ) ) |
|
| 43 | + if (isset($this->model[$name])) |
|
| 44 | 44 | { |
| 45 | 45 | return $this->model[$name]; |
| 46 | 46 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @return mixed the settings' argument value. |
| 56 | 56 | */ |
| 57 | - public function __set( $name, $value ) |
|
| 57 | + public function __set($name, $value) |
|
| 58 | 58 | { |
| 59 | 59 | $this->model[$name] = $value; |
| 60 | 60 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @return array |
| 76 | 76 | */ |
| 77 | - public function set_model( $model ) |
|
| 77 | + public function set_model($model) |
|
| 78 | 78 | { |
| 79 | 79 | $this->model = $model; |
| 80 | 80 | } |
@@ -95,22 +95,22 @@ discard block |
||
| 95 | 95 | * @return string The rendered template. |
| 96 | 96 | * @throws TemplateNotFoundException Thrown if the template file cannot be found. |
| 97 | 97 | */ |
| 98 | - public function render( $echo = false ) |
|
| 98 | + public function render($echo = false) |
|
| 99 | 99 | { |
| 100 | 100 | $rendered_html = ''; |
| 101 | 101 | |
| 102 | - if( file_exists( $this->get_template_path() ) ) |
|
| 102 | + if (file_exists($this->get_template_path())) |
|
| 103 | 103 | { |
| 104 | 104 | ob_start(); |
| 105 | - include( $this->get_template_path() ); |
|
| 105 | + include($this->get_template_path()); |
|
| 106 | 106 | $rendered_html = ob_get_clean(); |
| 107 | 107 | } |
| 108 | 108 | else |
| 109 | 109 | { |
| 110 | - throw new \RuntimeException( "Error: cannot render HTML, template file not found at " . $this->get_template_path() ); |
|
| 110 | + throw new \RuntimeException("Error: cannot render HTML, template file not found at ".$this->get_template_path()); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if( !$echo ) |
|
| 113 | + if (!$echo) |
|
| 114 | 114 | { |
| 115 | 115 | return $rendered_html; |
| 116 | 116 | } |
@@ -90,8 +90,7 @@ |
||
| 90 | 90 | ob_start(); |
| 91 | 91 | include( $this->get_template_path() ); |
| 92 | 92 | $rendered_html = ob_get_clean(); |
| 93 | - } |
|
| 94 | - else |
|
| 93 | + } else |
|
| 95 | 94 | { |
| 96 | 95 | throw new \RuntimeException( "Error: cannot render HTML, template file not found at " . $this->get_template_path() ); |
| 97 | 96 | } |