From 5b2cff9972e784e59beea5d1cff6ebc0643ee0fe Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Sat, 18 Nov 2017 04:43:36 +0000 Subject: [PATCH] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- demo.php | 8 +++--- example/Editable.php | 2 +- src/Editable.php | 43 ++++++++++++++++------------ src/Integrates/EditableException.php | 5 ++-- src/Integrates/EditableResponse.php | 8 +++--- src/Interfaces/EditableInterface.php | 2 +- 6 files changed, 37 insertions(+), 31 deletions(-) diff --git a/demo.php b/demo.php index 1d64494..65c95a3 100644 --- a/demo.php +++ b/demo.php @@ -1,9 +1,9 @@ 0, 'text' => 'Unmarried 未婚'), array('value' => 1, 'text' => 'Marriaged 已婚'), @@ -22,7 +22,7 @@

PHP Editable Demo

- +
diff --git a/example/Editable.php b/example/Editable.php index 0feeda5..56a2de5 100644 --- a/example/Editable.php +++ b/example/Editable.php @@ -1,7 +1,7 @@ row = $row; $this->pk = isset($this->row[$pk]) ? $this->row[$pk] : null; @@ -110,11 +111,13 @@ public function __construct($row = null, $pk = "id", $hidden = [], $ajax = '') $this->hidden[$pk] = 1; - if(class_exists('\Editable\Assets\LocalAssets')) - $this->vendor_assets = \Editable\Assets\LocalAssets::instance()->getVendorAssetsRoutingUrl(); + if(class_exists('\Editable\Assets\LocalAssets')) { + $this->vendor_assets = \Editable\Assets\LocalAssets::instance()->getVendorAssetsRoutingUrl(); + } - foreach($this->row as $key => $value) - $this->input($key, $value); + foreach($this->row as $key => $value) { + $this->input($key, $value); + } } @@ -140,13 +143,13 @@ public function registerComponent($type, $key, $value = null, $options = [], $in */ public function protect($key) { - if(is_array($key)) - foreach($key as $each) { + if(is_array($key)) { + foreach($key as $each) { $this->protect($each); - } - - else - $this->hidden[$key] = 1; + } + } else { + $this->hidden[$key] = 1; + } return $this; } @@ -289,7 +292,9 @@ protected function __every_element($each) } $value = $each[2]; $show_name = ucfirst(preg_replace_callback('/(_([a-zA-Z0-9]))/', function($a) { - if(isset($a[2])) return ' '.strtoupper($a[2]); + if(isset($a[2])) { + return ' '.strtoupper($a[2]); + } return $a; }, $key)); $title = 'Type the '.$show_name; @@ -309,7 +314,7 @@ protected function __every_element($each) } else if(is_string($each[3])) { } - }else if($type == 'typeaheadjs') { + } else if($type == 'typeaheadjs') { $show_value = ''; foreach($each[3] as $option) { $option_value = isset($option['value']) ? $option['value']: null; @@ -318,9 +323,9 @@ protected function __every_element($each) break; } } - }else if($type == 'wysiwyg') { + } else if($type == 'wysiwyg') { $show_type = 'wysihtml5'; - }else if($type == 'tag') { + } else if($type == 'tag') { $show_type = 'select2'; } @@ -341,19 +346,19 @@ protected function __every_element($each) /**//**//**/} /**//**//**/if($type == 'select' || $type == 'tag' || $type == 'checklist') { /**//**//**//**/$this->builder->setDataSource(is_string($each[3])?$each[3]:json_encode($each[3])); - /**//**//**/}else if($type == 'typeaheadjs') { + /**//**//**/} else if($type == 'typeaheadjs') { /**//**//**//**/$this->builder->setDataTypeahead( # @todo: template /**//**//**//**//**/json_encode([ /**//**//**//**//**/'name' => $key, /**//**//**//**//**/'local' => $each[3], /**//**//**//**//**/]) /**//**//**//**/); - /**//**//**/}else if($type == 'date') { + /**//**//**/} else if($type == 'date') { /**//**//**//**/$this->builder->setDataType('combodate') /**//**//**//**//**//**/->setDataTemplate('YYYY/MM/DD') /**//**//**//**//**//**/->setDataFormat('YYYY-MM-DD') /**//**//**//**//**//**/->setDataViewformat('YYYY-MM-DD'); - /**//**//**/}else if($type == 'datetime') { + /**//**//**/} else if($type == 'datetime') { /**//**//**//**/$this->builder->setDataType('combodate') /**//**//**//**//**//**/->setDataTemplate('YYYY/MM/DD HH:mm:ss') /**//**//**//**//**//**/->setDataFormat('YYYY-MM-DD HH:mm:ss') diff --git a/src/Integrates/EditableException.php b/src/Integrates/EditableException.php index b08344a..23ceb5e 100644 --- a/src/Integrates/EditableException.php +++ b/src/Integrates/EditableException.php @@ -10,8 +10,9 @@ class EditableException extends \Exception{ public function __construct($message = null, $code, $previous = null) { - if($message === null) - $message = self::$messages[$code]; + if($message === null) { + $message = self::$messages[$code]; + } call_user_func_array([parent::class, __FUNCTION__], func_get_args()); } diff --git a/src/Integrates/EditableResponse.php b/src/Integrates/EditableResponse.php index e504bc9..a1b0981 100644 --- a/src/Integrates/EditableResponse.php +++ b/src/Integrates/EditableResponse.php @@ -35,10 +35,10 @@ public function __construct($status_code = null, $body = null) * * @return int */ - public function getStatusCode() - { - return $this->status_code; - } + public function getStatusCode() + { + return $this->status_code; + } /** diff --git a/src/Interfaces/EditableInterface.php b/src/Interfaces/EditableInterface.php index 07ea82f..b1a1af9 100644 --- a/src/Interfaces/EditableInterface.php +++ b/src/Interfaces/EditableInterface.php @@ -1,7 +1,7 @@