@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | */ |
40 | 40 | class TemplateResponse extends Response { |
41 | 41 | |
42 | - const EVENT_LOAD_ADDITIONAL_SCRIPTS = self::class . '::loadAdditionalScripts'; |
|
43 | - const EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN = self::class . '::loadAdditionalScriptsLoggedIn'; |
|
42 | + const EVENT_LOAD_ADDITIONAL_SCRIPTS = self::class.'::loadAdditionalScripts'; |
|
43 | + const EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN = self::class.'::loadAdditionalScriptsLoggedIn'; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * name of the template |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @param string $renderAs how the page should be rendered, defaults to user |
76 | 76 | * @since 6.0.0 - parameters $params and $renderAs were added in 7.0.0 |
77 | 77 | */ |
78 | - public function __construct($appName, $templateName, array $params=[], |
|
79 | - $renderAs='user') { |
|
78 | + public function __construct($appName, $templateName, array $params = [], |
|
79 | + $renderAs = 'user') { |
|
80 | 80 | parent::__construct(); |
81 | 81 | |
82 | 82 | $this->templateName = $templateName; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return TemplateResponse Reference to this object |
97 | 97 | * @since 6.0.0 - return value was added in 7.0.0 |
98 | 98 | */ |
99 | - public function setParams(array $params){ |
|
99 | + public function setParams(array $params) { |
|
100 | 100 | $this->params = $params; |
101 | 101 | |
102 | 102 | return $this; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @return array the params |
109 | 109 | * @since 6.0.0 |
110 | 110 | */ |
111 | - public function getParams(){ |
|
111 | + public function getParams() { |
|
112 | 112 | return $this->params; |
113 | 113 | } |
114 | 114 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @return string the name of the used template |
119 | 119 | * @since 6.0.0 |
120 | 120 | */ |
121 | - public function getTemplateName(){ |
|
121 | + public function getTemplateName() { |
|
122 | 122 | return $this->templateName; |
123 | 123 | } |
124 | 124 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @return TemplateResponse Reference to this object |
133 | 133 | * @since 6.0.0 - return value was added in 7.0.0 |
134 | 134 | */ |
135 | - public function renderAs($renderAs){ |
|
135 | + public function renderAs($renderAs) { |
|
136 | 136 | $this->renderAs = $renderAs; |
137 | 137 | |
138 | 138 | return $this; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @return string the renderAs value |
145 | 145 | * @since 6.0.0 |
146 | 146 | */ |
147 | - public function getRenderAs(){ |
|
147 | + public function getRenderAs() { |
|
148 | 148 | return $this->renderAs; |
149 | 149 | } |
150 | 150 | |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | * @return string the rendered html |
155 | 155 | * @since 6.0.0 |
156 | 156 | */ |
157 | - public function render(){ |
|
157 | + public function render() { |
|
158 | 158 | // \OCP\Template needs an empty string instead of 'blank' for an unwrapped response |
159 | 159 | $renderAs = $this->renderAs === 'blank' ? '' : $this->renderAs; |
160 | 160 | |
161 | 161 | $template = new \OCP\Template($this->appName, $this->templateName, $renderAs); |
162 | 162 | |
163 | - foreach($this->params as $key => $value){ |
|
163 | + foreach ($this->params as $key => $value) { |
|
164 | 164 | $template->assign($key, $value); |
165 | 165 | } |
166 | 166 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param int $statusCode the Http status code, defaults to 200 |
54 | 54 | * @since 6.0.0 |
55 | 55 | */ |
56 | - public function __construct($data=[], $statusCode=Http::STATUS_OK) { |
|
56 | + public function __construct($data = [], $statusCode = Http::STATUS_OK) { |
|
57 | 57 | parent::__construct(); |
58 | 58 | |
59 | 59 | $this->data = $data; |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function render() { |
72 | 72 | $response = json_encode($this->data, JSON_HEX_TAG); |
73 | - if($response === false) { |
|
74 | - throw new \Exception(sprintf('Could not json_encode due to invalid ' . |
|
73 | + if ($response === false) { |
|
74 | + throw new \Exception(sprintf('Could not json_encode due to invalid '. |
|
75 | 75 | 'non UTF-8 characters in the array: %s', var_export($this->data, true))); |
76 | 76 | } |
77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return JSONResponse Reference to this object |
86 | 86 | * @since 6.0.0 - return value was added in 7.0.0 |
87 | 87 | */ |
88 | - public function setData($data){ |
|
88 | + public function setData($data) { |
|
89 | 89 | $this->data = $data; |
90 | 90 | |
91 | 91 | return $this; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * @return array the data |
98 | 98 | * @since 6.0.0 |
99 | 99 | */ |
100 | - public function getData(){ |
|
100 | + public function getData() { |
|
101 | 101 | return $this->data; |
102 | 102 | } |
103 | 103 |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * @param array $headers additional key value based headers |
52 | 52 | * @since 8.0.0 |
53 | 53 | */ |
54 | - public function __construct($data=[], $statusCode=Http::STATUS_OK, |
|
55 | - array $headers=[]) { |
|
54 | + public function __construct($data = [], $statusCode = Http::STATUS_OK, |
|
55 | + array $headers = []) { |
|
56 | 56 | parent::__construct(); |
57 | 57 | |
58 | 58 | $this->data = $data; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @return DataResponse Reference to this object |
68 | 68 | * @since 8.0.0 |
69 | 69 | */ |
70 | - public function setData($data){ |
|
70 | + public function setData($data) { |
|
71 | 71 | $this->data = $data; |
72 | 72 | |
73 | 73 | return $this; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @return array the data |
80 | 80 | * @since 8.0.0 |
81 | 81 | */ |
82 | - public function getData(){ |
|
82 | + public function getData() { |
|
83 | 83 | return $this->data; |
84 | 84 | } |
85 | 85 |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | public static function fromParams(array $params) { |
53 | 53 | $instance = new static(); |
54 | 54 | |
55 | - foreach($params as $key => $value) { |
|
56 | - $method = 'set' . ucfirst($key); |
|
55 | + foreach ($params as $key => $value) { |
|
56 | + $method = 'set'.ucfirst($key); |
|
57 | 57 | $instance->$method($value); |
58 | 58 | } |
59 | 59 | |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | * @param array $row the row to map onto the entity |
67 | 67 | * @since 7.0.0 |
68 | 68 | */ |
69 | - public static function fromRow(array $row){ |
|
69 | + public static function fromRow(array $row) { |
|
70 | 70 | $instance = new static(); |
71 | 71 | |
72 | - foreach($row as $key => $value){ |
|
72 | + foreach ($row as $key => $value) { |
|
73 | 73 | $prop = ucfirst($instance->columnToProperty($key)); |
74 | - $setter = 'set' . $prop; |
|
74 | + $setter = 'set'.$prop; |
|
75 | 75 | $instance->$setter($value); |
76 | 76 | } |
77 | 77 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * Marks the entity as clean needed for setting the id after the insertion |
95 | 95 | * @since 7.0.0 |
96 | 96 | */ |
97 | - public function resetUpdatedFields(){ |
|
97 | + public function resetUpdatedFields() { |
|
98 | 98 | $this->_updatedFields = []; |
99 | 99 | } |
100 | 100 | |
@@ -104,20 +104,20 @@ discard block |
||
104 | 104 | */ |
105 | 105 | protected function setter($name, $args) { |
106 | 106 | // setters should only work for existing attributes |
107 | - if(property_exists($this, $name)){ |
|
108 | - if($this->$name === $args[0]) { |
|
107 | + if (property_exists($this, $name)) { |
|
108 | + if ($this->$name === $args[0]) { |
|
109 | 109 | return; |
110 | 110 | } |
111 | 111 | $this->markFieldUpdated($name); |
112 | 112 | |
113 | 113 | // if type definition exists, cast to correct type |
114 | - if($args[0] !== null && array_key_exists($name, $this->_fieldTypes)) { |
|
114 | + if ($args[0] !== null && array_key_exists($name, $this->_fieldTypes)) { |
|
115 | 115 | settype($args[0], $this->_fieldTypes[$name]); |
116 | 116 | } |
117 | 117 | $this->$name = $args[0]; |
118 | 118 | |
119 | 119 | } else { |
120 | - throw new \BadFunctionCallException($name . |
|
120 | + throw new \BadFunctionCallException($name. |
|
121 | 121 | ' is not a valid attribute'); |
122 | 122 | } |
123 | 123 | } |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | */ |
129 | 129 | protected function getter($name) { |
130 | 130 | // getters should only work for existing attributes |
131 | - if(property_exists($this, $name)){ |
|
131 | + if (property_exists($this, $name)) { |
|
132 | 132 | return $this->$name; |
133 | 133 | } else { |
134 | - throw new \BadFunctionCallException($name . |
|
134 | + throw new \BadFunctionCallException($name. |
|
135 | 135 | ' is not a valid attribute'); |
136 | 136 | } |
137 | 137 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } elseif ($this->isGetterForBoolProperty($methodName)) { |
153 | 153 | return $this->getter(lcfirst(substr($methodName, 2))); |
154 | 154 | } else { |
155 | - throw new \BadFunctionCallException($methodName . |
|
155 | + throw new \BadFunctionCallException($methodName. |
|
156 | 156 | ' does not exist'); |
157 | 157 | } |
158 | 158 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @param string $attribute the name of the attribute |
177 | 177 | * @since 7.0.0 |
178 | 178 | */ |
179 | - protected function markFieldUpdated($attribute){ |
|
179 | + protected function markFieldUpdated($attribute) { |
|
180 | 180 | $this->_updatedFields[$attribute] = true; |
181 | 181 | } |
182 | 182 | |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | * @return string the property name |
188 | 188 | * @since 7.0.0 |
189 | 189 | */ |
190 | - public function columnToProperty($columnName){ |
|
190 | + public function columnToProperty($columnName) { |
|
191 | 191 | $parts = explode('_', $columnName); |
192 | 192 | $property = null; |
193 | 193 | |
194 | - foreach($parts as $part){ |
|
195 | - if($property === null){ |
|
194 | + foreach ($parts as $part) { |
|
195 | + if ($property === null) { |
|
196 | 196 | $property = $part; |
197 | 197 | } else { |
198 | 198 | $property .= ucfirst($part); |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | * @return string the column name |
210 | 210 | * @since 7.0.0 |
211 | 211 | */ |
212 | - public function propertyToColumn($property){ |
|
212 | + public function propertyToColumn($property) { |
|
213 | 213 | $parts = preg_split('/(?=[A-Z])/', $property); |
214 | 214 | $column = null; |
215 | 215 | |
216 | - foreach($parts as $part){ |
|
217 | - if($column === null){ |
|
216 | + foreach ($parts as $part) { |
|
217 | + if ($column === null) { |
|
218 | 218 | $column = $part; |
219 | 219 | } else { |
220 | - $column .= '_' . lcfirst($part); |
|
220 | + $column .= '_'.lcfirst($part); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * @return array array of updated fields for update query |
230 | 230 | * @since 7.0.0 |
231 | 231 | */ |
232 | - public function getUpdatedFields(){ |
|
232 | + public function getUpdatedFields() { |
|
233 | 233 | return $this->_updatedFields; |
234 | 234 | } |
235 | 235 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param string $type the type which will be used to call settype() |
242 | 242 | * @since 7.0.0 |
243 | 243 | */ |
244 | - protected function addType($fieldName, $type){ |
|
244 | + protected function addType($fieldName, $type) { |
|
245 | 245 | $this->_fieldTypes[$fieldName] = $type; |
246 | 246 | } |
247 | 247 | |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | * @return string slugified value |
254 | 254 | * @since 7.0.0 |
255 | 255 | */ |
256 | - public function slugify($attributeName){ |
|
256 | + public function slugify($attributeName) { |
|
257 | 257 | // toSlug should only work for existing attributes |
258 | - if(property_exists($this, $attributeName)){ |
|
258 | + if (property_exists($this, $attributeName)) { |
|
259 | 259 | $value = $this->$attributeName; |
260 | 260 | // replace everything except alphanumeric with a single '-' |
261 | 261 | $value = preg_replace('/[^A-Za-z0-9]+/', '-', $value); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | // trim '-' |
264 | 264 | return trim($value, '-'); |
265 | 265 | } else { |
266 | - throw new \BadFunctionCallException($attributeName . |
|
266 | + throw new \BadFunctionCallException($attributeName. |
|
267 | 267 | ' is not a valid attribute'); |
268 | 268 | } |
269 | 269 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | // default responders |
80 | 80 | $this->responders = [ |
81 | - 'json' => function ($data) { |
|
81 | + 'json' => function($data) { |
|
82 | 82 | if ($data instanceof DataResponse) { |
83 | 83 | $response = new JSONResponse( |
84 | 84 | $data->getData(), |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @since 7.0.0 |
108 | 108 | * @since 9.1.0 Added default parameter |
109 | 109 | */ |
110 | - public function getResponderByHTTPHeader($acceptHeader, $default='json') { |
|
110 | + public function getResponderByHTTPHeader($acceptHeader, $default = 'json') { |
|
111 | 111 | $headers = explode(',', $acceptHeader); |
112 | 112 | |
113 | 113 | // return the first matching responder |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | * @return Response |
147 | 147 | * @since 7.0.0 |
148 | 148 | */ |
149 | - public function buildResponse($response, $format='json') { |
|
150 | - if(array_key_exists($format, $this->responders)) { |
|
149 | + public function buildResponse($response, $format = 'json') { |
|
150 | + if (array_key_exists($format, $this->responders)) { |
|
151 | 151 | |
152 | 152 | $responder = $this->responders[$format]; |
153 | 153 | |
@@ -155,6 +155,6 @@ discard block |
||
155 | 155 | |
156 | 156 | } |
157 | 157 | throw new \DomainException('No responder registered for format '. |
158 | - $format . '!'); |
|
158 | + $format.'!'); |
|
159 | 159 | } |
160 | 160 | } |
@@ -124,7 +124,7 @@ |
||
124 | 124 | * @since 8.0.0 |
125 | 125 | * @suppress PhanDeprecatedFunction |
126 | 126 | */ |
127 | - public static function html_select_options($options, $selected, $params=[]) { |
|
127 | + public static function html_select_options($options, $selected, $params = []) { |
|
128 | 128 | return \html_select_options($options, $selected, $params); |
129 | 129 | } |
130 | 130 | } |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * @deprecated 14.0.0 use \OCP\ILogger::DEBUG |
61 | 61 | */ |
62 | - const DEBUG=0; |
|
62 | + const DEBUG = 0; |
|
63 | 63 | /** |
64 | 64 | * @deprecated 14.0.0 use \OCP\ILogger::INFO |
65 | 65 | */ |
66 | - const INFO=1; |
|
66 | + const INFO = 1; |
|
67 | 67 | /** |
68 | 68 | * @deprecated 14.0.0 use \OCP\ILogger::WARN |
69 | 69 | */ |
70 | - const WARN=2; |
|
70 | + const WARN = 2; |
|
71 | 71 | /** |
72 | 72 | * @deprecated 14.0.0 use \OCP\ILogger::ERROR |
73 | 73 | */ |
74 | - const ERROR=3; |
|
74 | + const ERROR = 3; |
|
75 | 75 | /** |
76 | 76 | * @deprecated 14.0.0 use \OCP\ILogger::FATAL |
77 | 77 | */ |
78 | - const FATAL=4; |
|
78 | + const FATAL = 4; |
|
79 | 79 | |
80 | 80 | /** \OCP\Share\IManager */ |
81 | 81 | private static $shareManager; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @since 4.0.0 |
128 | 128 | * @deprecated 13.0.0 use log of \OCP\ILogger |
129 | 129 | */ |
130 | - public static function writeLog( $app, $message, $level ) { |
|
130 | + public static function writeLog($app, $message, $level) { |
|
131 | 131 | $context = ['app' => $app]; |
132 | 132 | \OC::$server->getLogger()->log($level, $message, $context); |
133 | 133 | } |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * @param string $file |
170 | 170 | * @since 4.0.0 |
171 | 171 | */ |
172 | - public static function addStyle( $application, $file = null ) { |
|
173 | - \OC_Util::addStyle( $application, $file ); |
|
172 | + public static function addStyle($application, $file = null) { |
|
173 | + \OC_Util::addStyle($application, $file); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | * @param string $file |
180 | 180 | * @since 4.0.0 |
181 | 181 | */ |
182 | - public static function addScript( $application, $file = null ) { |
|
183 | - \OC_Util::addScript( $application, $file ); |
|
182 | + public static function addScript($application, $file = null) { |
|
183 | + \OC_Util::addScript($application, $file); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @param string $text the text content for the element |
203 | 203 | * @since 4.0.0 |
204 | 204 | */ |
205 | - public static function addHeader($tag, $attributes, $text=null) { |
|
205 | + public static function addHeader($tag, $attributes, $text = null) { |
|
206 | 206 | \OC_Util::addHeader($tag, $attributes, $text); |
207 | 207 | } |
208 | 208 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @return string the url |
216 | 216 | * @since 4.0.0 - parameter $args was added in 4.5.0 |
217 | 217 | */ |
218 | - public static function linkToAbsolute( $app, $file, $args = [] ) { |
|
218 | + public static function linkToAbsolute($app, $file, $args = []) { |
|
219 | 219 | $urlGenerator = \OC::$server->getURLGenerator(); |
220 | 220 | return $urlGenerator->getAbsoluteURL( |
221 | 221 | $urlGenerator->linkTo($app, $file, $args) |
@@ -228,11 +228,11 @@ discard block |
||
228 | 228 | * @return string the url |
229 | 229 | * @since 4.0.0 |
230 | 230 | */ |
231 | - public static function linkToRemote( $service ) { |
|
231 | + public static function linkToRemote($service) { |
|
232 | 232 | $urlGenerator = \OC::$server->getURLGenerator(); |
233 | - $remoteBase = $urlGenerator->linkTo('', 'remote.php') . '/' . $service; |
|
233 | + $remoteBase = $urlGenerator->linkTo('', 'remote.php').'/'.$service; |
|
234 | 234 | return $urlGenerator->getAbsoluteURL( |
235 | - $remoteBase . (($service[strlen($service) - 1] != '/') ? '/' : '') |
|
235 | + $remoteBase.(($service[strlen($service) - 1] != '/') ? '/' : '') |
|
236 | 236 | ); |
237 | 237 | } |
238 | 238 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @since 4.5.0 |
366 | 366 | */ |
367 | 367 | public static function callRegister() { |
368 | - if(self::$token === '') { |
|
368 | + if (self::$token === '') { |
|
369 | 369 | self::$token = \OC::$server->getCsrfTokenManager()->getToken()->getEncryptedValue(); |
370 | 370 | } |
371 | 371 | return self::$token; |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | */ |
512 | 512 | public static function needUpgrade() { |
513 | 513 | if (!isset(self::$needUpgradeCache)) { |
514 | - self::$needUpgradeCache=\OC_Util::needUpgrade(\OC::$server->getSystemConfig()); |
|
514 | + self::$needUpgradeCache = \OC_Util::needUpgrade(\OC::$server->getSystemConfig()); |
|
515 | 515 | } |
516 | 516 | return self::$needUpgradeCache; |
517 | 517 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | return parent::connect(); |
66 | 66 | } catch (DBALException $e) { |
67 | 67 | // throw a new exception to prevent leaking info from the stacktrace |
68 | - throw new DBALException('Failed to connect to the database: ' . $e->getMessage(), $e->getCode()); |
|
68 | + throw new DBALException('Failed to connect to the database: '.$e->getMessage(), $e->getCode()); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | // 0 is the method where we use `getCallerBacktrace` |
118 | 118 | // 1 is the target method which uses the method we want to log |
119 | 119 | if (isset($traces[1])) { |
120 | - return $traces[1]['file'] . ':' . $traces[1]['line']; |
|
120 | + return $traces[1]['file'].':'.$traces[1]['line']; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | return ''; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param int $offset |
162 | 162 | * @return \Doctrine\DBAL\Driver\Statement The prepared statement. |
163 | 163 | */ |
164 | - public function prepare( $statement, $limit=null, $offset=null ) { |
|
164 | + public function prepare($statement, $limit = null, $offset = null) { |
|
165 | 165 | if ($limit === -1) { |
166 | 166 | $limit = null; |
167 | 167 | } |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | throw new \BadMethodCallException('Can not lock a new table until the previous lock is released.'); |
335 | 335 | } |
336 | 336 | |
337 | - $tableName = $this->tablePrefix . $tableName; |
|
337 | + $tableName = $this->tablePrefix.$tableName; |
|
338 | 338 | $this->lockedTable = $tableName; |
339 | 339 | $this->adapter->lockTable($tableName); |
340 | 340 | } |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | * @return string |
356 | 356 | */ |
357 | 357 | public function getError() { |
358 | - $msg = $this->errorCode() . ': '; |
|
358 | + $msg = $this->errorCode().': '; |
|
359 | 359 | $errorInfo = $this->errorInfo(); |
360 | 360 | if (is_array($errorInfo)) { |
361 | - $msg .= 'SQLSTATE = '.$errorInfo[0] . ', '; |
|
362 | - $msg .= 'Driver Code = '.$errorInfo[1] . ', '; |
|
361 | + $msg .= 'SQLSTATE = '.$errorInfo[0].', '; |
|
362 | + $msg .= 'Driver Code = '.$errorInfo[1].', '; |
|
363 | 363 | $msg .= 'Driver Message = '.$errorInfo[2]; |
364 | 364 | } |
365 | 365 | return $msg; |
@@ -371,9 +371,9 @@ discard block |
||
371 | 371 | * @param string $table table name without the prefix |
372 | 372 | */ |
373 | 373 | public function dropTable($table) { |
374 | - $table = $this->tablePrefix . trim($table); |
|
374 | + $table = $this->tablePrefix.trim($table); |
|
375 | 375 | $schema = $this->getSchemaManager(); |
376 | - if($schema->tablesExist([$table])) { |
|
376 | + if ($schema->tablesExist([$table])) { |
|
377 | 377 | $schema->dropTable($table); |
378 | 378 | } |
379 | 379 | } |
@@ -384,8 +384,8 @@ discard block |
||
384 | 384 | * @param string $table table name without the prefix |
385 | 385 | * @return bool |
386 | 386 | */ |
387 | - public function tableExists($table){ |
|
388 | - $table = $this->tablePrefix . trim($table); |
|
387 | + public function tableExists($table) { |
|
388 | + $table = $this->tablePrefix.trim($table); |
|
389 | 389 | $schema = $this->getSchemaManager(); |
390 | 390 | return $schema->tablesExist([$table]); |
391 | 391 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * @return string |
397 | 397 | */ |
398 | 398 | protected function replaceTablePrefix($statement) { |
399 | - return str_replace( '*PREFIX*', $this->tablePrefix, $statement ); |
|
399 | + return str_replace('*PREFIX*', $this->tablePrefix, $statement); |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | private function quoteKeys(array $data) { |
34 | 34 | $return = []; |
35 | 35 | $c = $this->getDatabasePlatform()->getIdentifierQuoteCharacter(); |
36 | - foreach($data as $key => $value) { |
|
36 | + foreach ($data as $key => $value) { |
|
37 | 37 | if ($key[0] !== $c) { |
38 | 38 | $return[$this->quoteIdentifier($key)] = $value; |
39 | 39 | } else { |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | * @param string $table table name without the prefix |
84 | 84 | */ |
85 | 85 | public function dropTable($table) { |
86 | - $table = $this->tablePrefix . trim($table); |
|
86 | + $table = $this->tablePrefix.trim($table); |
|
87 | 87 | $table = $this->quoteIdentifier($table); |
88 | 88 | $schema = $this->getSchemaManager(); |
89 | - if($schema->tablesExist([$table])) { |
|
89 | + if ($schema->tablesExist([$table])) { |
|
90 | 90 | $schema->dropTable($table); |
91 | 91 | } |
92 | 92 | } |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @param string $table table name without the prefix |
98 | 98 | * @return bool |
99 | 99 | */ |
100 | - public function tableExists($table){ |
|
101 | - $table = $this->tablePrefix . trim($table); |
|
100 | + public function tableExists($table) { |
|
101 | + $table = $this->tablePrefix.trim($table); |
|
102 | 102 | $table = $this->quoteIdentifier($table); |
103 | 103 | $schema = $this->getSchemaManager(); |
104 | 104 | return $schema->tablesExist([$table]); |