@@ -11,30 +11,30 @@ |
||
11 | 11 | */ |
12 | 12 | interface ScopeInterface extends ScopeStorageInterface |
13 | 13 | { |
14 | - /** |
|
15 | - * Check if everything in required scope is contained in available scope. |
|
16 | - * |
|
17 | - * @param $required_scope |
|
18 | - * A space-separated string of scopes. |
|
19 | - * |
|
20 | - * @return |
|
21 | - * TRUE if everything in required scope is contained in available scope, |
|
22 | - * and FALSE if it isn't. |
|
23 | - * |
|
24 | - * @see http://tools.ietf.org/html/rfc6749#section-7 |
|
25 | - * |
|
26 | - * @ingroup oauth2_section_7 |
|
27 | - */ |
|
28 | - public function checkScope($required_scope, $available_scope); |
|
14 | + /** |
|
15 | + * Check if everything in required scope is contained in available scope. |
|
16 | + * |
|
17 | + * @param $required_scope |
|
18 | + * A space-separated string of scopes. |
|
19 | + * |
|
20 | + * @return |
|
21 | + * TRUE if everything in required scope is contained in available scope, |
|
22 | + * and FALSE if it isn't. |
|
23 | + * |
|
24 | + * @see http://tools.ietf.org/html/rfc6749#section-7 |
|
25 | + * |
|
26 | + * @ingroup oauth2_section_7 |
|
27 | + */ |
|
28 | + public function checkScope($required_scope, $available_scope); |
|
29 | 29 | |
30 | - /** |
|
31 | - * Return scope info from request |
|
32 | - * |
|
33 | - * @param OAuth2\RequestInterface |
|
34 | - * Request object to check |
|
35 | - * |
|
36 | - * @return |
|
37 | - * string representation of requested scope |
|
38 | - */ |
|
39 | - public function getScopeFromRequest(RequestInterface $request); |
|
30 | + /** |
|
31 | + * Return scope info from request |
|
32 | + * |
|
33 | + * @param OAuth2\RequestInterface |
|
34 | + * Request object to check |
|
35 | + * |
|
36 | + * @return |
|
37 | + * string representation of requested scope |
|
38 | + */ |
|
39 | + public function getScopeFromRequest(RequestInterface $request); |
|
40 | 40 | } |
@@ -75,13 +75,11 @@ discard block |
||
75 | 75 | if (count($config['primaryFields']) > 1) |
76 | 76 | { |
77 | 77 | $tableKey = $config['primaryFields']; |
78 | - } |
|
79 | - else |
|
78 | + } else |
|
80 | 79 | { |
81 | 80 | $tableKey = $config['primaryFields'][0]; |
82 | 81 | } |
83 | - } |
|
84 | - else |
|
82 | + } else |
|
85 | 83 | { |
86 | 84 | $tableKey = 'id'; |
87 | 85 | } |
@@ -207,8 +205,7 @@ discard block |
||
207 | 205 | { |
208 | 206 | $pk[$pkKey] = (!empty($data[$pkKey])) ? $data[$pkKey] : (int) $this->getState($this->getName() . '.' . $pkKey); |
209 | 207 | } |
210 | - } |
|
211 | - else |
|
208 | + } else |
|
212 | 209 | { |
213 | 210 | $pk = (!empty($data[$key])) ? $data[$key] : (int) $this->getState($this->getName() . '.id'); |
214 | 211 | } |
@@ -270,8 +267,7 @@ discard block |
||
270 | 267 | |
271 | 268 | // Trigger the after save event. |
272 | 269 | $dispatcher->trigger($this->event_after_save, array($context, $table, $isNew)); |
273 | - } |
|
274 | - catch (Exception $e) |
|
270 | + } catch (Exception $e) |
|
275 | 271 | { |
276 | 272 | $this->setError($e->getMessage()); |
277 | 273 |
@@ -94,7 +94,7 @@ |
||
94 | 94 | protected function getListQuery() |
95 | 95 | { |
96 | 96 | $table = $this->getTableName(); |
97 | - $db = $this->getDbo(); |
|
97 | + $db = $this->getDbo(); |
|
98 | 98 | $query = $db->getQuery(true); |
99 | 99 | $activeFields = array(); |
100 | 100 | $hiddenFields = array(); |
@@ -109,8 +109,7 @@ discard block |
||
109 | 109 | if (!empty($field['isHiddenField']) && strtolower($field['isHiddenField']) == 'true') |
110 | 110 | { |
111 | 111 | $hiddenFields[] = $field['name']; |
112 | - } |
|
113 | - else |
|
112 | + } else |
|
114 | 113 | { |
115 | 114 | $activeFields[] = $field['name']; |
116 | 115 | $query->select($db->qn($field['name'])); |
@@ -138,8 +137,7 @@ discard block |
||
138 | 137 | } |
139 | 138 | } |
140 | 139 | } |
141 | - } |
|
142 | - else |
|
140 | + } else |
|
143 | 141 | { |
144 | 142 | // If no fields are defined then we select all fields |
145 | 143 | $query->select('*'); |
@@ -215,13 +213,11 @@ discard block |
||
215 | 213 | if (count($config['primaryFields']) > 1) |
216 | 214 | { |
217 | 215 | $tableKey = $config['primaryFields']; |
218 | - } |
|
219 | - else |
|
216 | + } else |
|
220 | 217 | { |
221 | 218 | $tableKey = $config['primaryFields'][0]; |
222 | 219 | } |
223 | - } |
|
224 | - else |
|
220 | + } else |
|
225 | 221 | { |
226 | 222 | $tableKey = 'id'; |
227 | 223 | } |
@@ -38,8 +38,7 @@ discard block |
||
38 | 38 | $this->_tbl_keys = $key; |
39 | 39 | $this->_tbl_key = $key; |
40 | 40 | $this->_tableKey = $key[key($key)]; |
41 | - } |
|
42 | - else |
|
41 | + } else |
|
43 | 42 | { |
44 | 43 | $this->_tbl_key = $key; |
45 | 44 | $this->_tableKey = $key; |
@@ -81,8 +80,7 @@ discard block |
||
81 | 80 | { |
82 | 81 | // If we want multiple keys, return the raw array. |
83 | 82 | return $this->_tbl_keys; |
84 | - } |
|
85 | - else |
|
83 | + } else |
|
86 | 84 | { |
87 | 85 | // If we want the standard method, just return the first key. |
88 | 86 | return $this->_tbl_keys[0]; |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | 'webservice.documentation', |
649 | 649 | array( |
650 | 650 | 'view' => $this, |
651 | - 'options' => array ( |
|
651 | + 'options' => array( |
|
652 | 652 | 'xml' => $currentConfiguration, |
653 | 653 | 'soapEnabled' => RBootstrap::getConfig('enable_soap', 0), |
654 | 654 | 'print' => isset($dataGet->print) |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | } |
1346 | 1346 | else |
1347 | 1347 | { |
1348 | - $documentOptions = array( |
|
1348 | + $documentOptions = array( |
|
1349 | 1349 | 'absoluteHrefs' => $this->options->get('absoluteHrefs', false), |
1350 | 1350 | 'documentFormat' => $format, |
1351 | 1351 | 'uriParams' => $this->uriParams, |
@@ -203,8 +203,7 @@ discard block |
||
203 | 203 | if (RBootstrap::getConfig('webservices_authorization_check', 0) == 0) |
204 | 204 | { |
205 | 205 | $this->authorizationCheck = 'oauth2'; |
206 | - } |
|
207 | - elseif (RBootstrap::getConfig('webservices_authorization_check', 0) == 1) |
|
206 | + } elseif (RBootstrap::getConfig('webservices_authorization_check', 0) == 1) |
|
208 | 207 | { |
209 | 208 | $this->authorizationCheck = 'joomla'; |
210 | 209 | } |
@@ -450,8 +449,7 @@ discard block |
||
450 | 449 | break; |
451 | 450 | } |
452 | 451 | } |
453 | - } |
|
454 | - else |
|
452 | + } else |
|
455 | 453 | { |
456 | 454 | // If default page needs authorization to access it |
457 | 455 | if (!$this->isAuthorized('', RBootstrap::getConfig('webservices_default_page_authorization', 0))) |
@@ -469,8 +467,7 @@ discard block |
||
469 | 467 | |
470 | 468 | $executionErrors = ob_get_contents(); |
471 | 469 | ob_end_clean(); |
472 | - } |
|
473 | - catch (Exception $e) |
|
470 | + } catch (Exception $e) |
|
474 | 471 | { |
475 | 472 | $executionErrors = ob_get_contents(); |
476 | 473 | ob_end_clean(); |
@@ -809,8 +806,7 @@ discard block |
||
809 | 806 | if (method_exists($model, $functionName)) |
810 | 807 | { |
811 | 808 | $result = $this->triggerCallFunction($model, $functionName, $args); |
812 | - } |
|
813 | - else |
|
809 | + } else |
|
814 | 810 | { |
815 | 811 | $customError = $this->triggerFunction('createCustomHttpError', 400, $this->apiErrors); |
816 | 812 | $this->setStatusCode(400, $customError); |
@@ -840,8 +836,7 @@ discard block |
||
840 | 836 | { |
841 | 837 | $customError = $this->triggerFunction('createCustomHttpError', 404, $this->apiErrors); |
842 | 838 | $this->setStatusCode(404, $customError); |
843 | - } |
|
844 | - else |
|
839 | + } else |
|
845 | 840 | { |
846 | 841 | $this->setStatusCode(201); |
847 | 842 | } |
@@ -891,20 +886,17 @@ discard block |
||
891 | 886 | if (!empty($primaryKeys)) |
892 | 887 | { |
893 | 888 | $result = $model->{$functionName}($primaryKeys); |
894 | - } |
|
895 | - else |
|
889 | + } else |
|
896 | 890 | { |
897 | 891 | $result = $model->{$functionName}($args); |
898 | 892 | } |
899 | - } |
|
900 | - else |
|
893 | + } else |
|
901 | 894 | { |
902 | 895 | // Checks if that method exists in model class file and executes it |
903 | 896 | if (method_exists($model, $functionName)) |
904 | 897 | { |
905 | 898 | $result = $this->triggerCallFunction($model, $functionName, $args); |
906 | - } |
|
907 | - else |
|
899 | + } else |
|
908 | 900 | { |
909 | 901 | $customError = $this->triggerFunction('createCustomHttpError', 400, $this->apiErrors); |
910 | 902 | $this->setStatusCode(400, $customError); |
@@ -972,8 +964,7 @@ discard block |
||
972 | 964 | if (method_exists($model, $functionName)) |
973 | 965 | { |
974 | 966 | $result = $this->triggerCallFunction($model, $functionName, $args); |
975 | - } |
|
976 | - else |
|
967 | + } else |
|
977 | 968 | { |
978 | 969 | $customError = $this->triggerFunction('createCustomHttpError', 400, $this->apiErrors); |
979 | 970 | $this->setStatusCode(400, $customError); |
@@ -1056,8 +1047,7 @@ discard block |
||
1056 | 1047 | if (method_exists($model, $functionName)) |
1057 | 1048 | { |
1058 | 1049 | $result = $this->triggerCallFunction($model, $functionName, $args); |
1059 | - } |
|
1060 | - else |
|
1050 | + } else |
|
1061 | 1051 | { |
1062 | 1052 | $customError = $this->triggerFunction('createCustomHttpError', 400, $this->apiErrors); |
1063 | 1053 | $this->setStatusCode(400, $customError); |
@@ -1112,8 +1102,7 @@ discard block |
||
1112 | 1102 | { |
1113 | 1103 | unset($item[$key]); |
1114 | 1104 | continue; |
1115 | - } |
|
1116 | - else |
|
1105 | + } else |
|
1117 | 1106 | { |
1118 | 1107 | $item[$this->assignGlobalValueToResource($key)] = $this->assignValueToResource( |
1119 | 1108 | $this->resources['listItem'][$key], $item |
@@ -1164,15 +1153,13 @@ discard block |
||
1164 | 1153 | RApiHalHelper::isAttributeTrue($resource, 'linkTemplated') |
1165 | 1154 | ), $linkSingular = false, $linkPlural |
1166 | 1155 | ); |
1167 | - } |
|
1168 | - else |
|
1156 | + } else |
|
1169 | 1157 | { |
1170 | 1158 | $resourceDocument->setDataGrouped( |
1171 | 1159 | $resource['displayGroup'], $this->assignGlobalValueToResource($resource['displayName']), $this->assignValueToResource($resource, $data) |
1172 | 1160 | ); |
1173 | 1161 | } |
1174 | - } |
|
1175 | - else |
|
1162 | + } else |
|
1176 | 1163 | { |
1177 | 1164 | $resourceDocument->setData($this->assignGlobalValueToResource($resource['displayName']), $this->assignValueToResource($resource, $data)); |
1178 | 1165 | } |
@@ -1300,8 +1287,7 @@ discard block |
||
1300 | 1287 | $value = !empty($this->resources['rcwsGlobal'][$key]) ? $this->assignValueToResource($this->resources['rcwsGlobal'][$key], $item) : $value; |
1301 | 1288 | $this->setData($this->assignGlobalValueToResource($key), $value); |
1302 | 1289 | } |
1303 | - } |
|
1304 | - else |
|
1290 | + } else |
|
1305 | 1291 | { |
1306 | 1292 | // 404 => 'Not found' |
1307 | 1293 | $customError = $this->triggerFunction('createCustomHttpError', 404, $this->apiErrors); |
@@ -1342,8 +1328,7 @@ discard block |
||
1342 | 1328 | { |
1343 | 1329 | // This is already in HTML format |
1344 | 1330 | echo $this->documentation; |
1345 | - } |
|
1346 | - else |
|
1331 | + } else |
|
1347 | 1332 | { |
1348 | 1333 | $documentOptions = array( |
1349 | 1334 | 'absoluteHrefs' => $this->options->get('absoluteHrefs', false), |
@@ -1405,8 +1390,7 @@ discard block |
||
1405 | 1390 | { |
1406 | 1391 | $this->data[$k] = $v; |
1407 | 1392 | } |
1408 | - } |
|
1409 | - else |
|
1393 | + } else |
|
1410 | 1394 | { |
1411 | 1395 | $this->data[$key] = $data; |
1412 | 1396 | } |
@@ -1666,16 +1650,14 @@ discard block |
||
1666 | 1650 | { |
1667 | 1651 | $terminateIfNotAuthorized = false; |
1668 | 1652 | } |
1669 | - } |
|
1670 | - elseif ($this->operation == 'read') |
|
1653 | + } elseif ($this->operation == 'read') |
|
1671 | 1654 | { |
1672 | 1655 | // Disable authorization on operation read level |
1673 | 1656 | if (isset($allowedOperations->{$this->operation}['authorizationNeeded']) |
1674 | 1657 | && strtolower($allowedOperations->{$this->operation}['authorizationNeeded']) == 'false') |
1675 | 1658 | { |
1676 | 1659 | $terminateIfNotAuthorized = false; |
1677 | - } |
|
1678 | - else |
|
1660 | + } else |
|
1679 | 1661 | { |
1680 | 1662 | $primaryKeys = array(); |
1681 | 1663 | $isReadItem = $this->apiFillPrimaryKeys($primaryKeys); |
@@ -1687,8 +1669,7 @@ discard block |
||
1687 | 1669 | $terminateIfNotAuthorized = false; |
1688 | 1670 | } |
1689 | 1671 | } |
1690 | - } |
|
1691 | - elseif (isset($allowedOperations->{$this->operation}['authorizationNeeded']) |
|
1672 | + } elseif (isset($allowedOperations->{$this->operation}['authorizationNeeded']) |
|
1692 | 1673 | && strtolower($allowedOperations->{$this->operation}['authorizationNeeded']) == 'false') |
1693 | 1674 | { |
1694 | 1675 | $terminateIfNotAuthorized = false; |
@@ -1785,12 +1766,10 @@ discard block |
||
1785 | 1766 | |
1786 | 1767 | JFactory::getApplication()->close(); |
1787 | 1768 | } |
1788 | - } |
|
1789 | - elseif ($response === false && $terminateIfNotAuthorized) |
|
1769 | + } elseif ($response === false && $terminateIfNotAuthorized) |
|
1790 | 1770 | { |
1791 | 1771 | throw new Exception(JText::_('LIB_REDCORE_API_OAUTH2_SERVER_IS_NOT_ACTIVE')); |
1792 | - } |
|
1793 | - else |
|
1772 | + } else |
|
1794 | 1773 | { |
1795 | 1774 | $response = json_decode($response); |
1796 | 1775 | |
@@ -2012,8 +1991,7 @@ discard block |
||
2012 | 1991 | { |
2013 | 1992 | return new $modelClass; |
2014 | 1993 | } |
2015 | - } |
|
2016 | - else |
|
1994 | + } else |
|
2017 | 1995 | { |
2018 | 1996 | $componentName = ucfirst(strtolower(substr($this->optionName, 4))); |
2019 | 1997 | $prefix = $componentName . 'Model'; |
@@ -2060,8 +2038,7 @@ discard block |
||
2060 | 2038 | JTable::addIncludePath($path . '/tables'); |
2061 | 2039 | RForm::addFormPath($path . '/models/forms'); |
2062 | 2040 | RForm::addFieldPath($path . '/models/fields'); |
2063 | - } |
|
2064 | - else |
|
2041 | + } else |
|
2065 | 2042 | { |
2066 | 2043 | $this->loadExtensionLanguage($optionName); |
2067 | 2044 | $path = JPATH_SITE . '/components/' . $optionName; |
@@ -2177,8 +2154,7 @@ discard block |
||
2177 | 2154 | if ($errors[$i] instanceof Exception) |
2178 | 2155 | { |
2179 | 2156 | $app->enqueueMessage($errors[$i]->getMessage(), 'error'); |
2180 | - } |
|
2181 | - else |
|
2157 | + } else |
|
2182 | 2158 | { |
2183 | 2159 | $app->enqueueMessage($errors[$i], 'error'); |
2184 | 2160 | } |
@@ -2230,8 +2206,7 @@ discard block |
||
2230 | 2206 | $format = str_replace('{' . $replacementKey . '}', $this->transformField($transform, $value->{$replacementKey}), $format); |
2231 | 2207 | } |
2232 | 2208 | } |
2233 | - } |
|
2234 | - elseif (is_array($value)) |
|
2209 | + } elseif (is_array($value)) |
|
2235 | 2210 | { |
2236 | 2211 | if (isset($value[$replacementKey])) |
2237 | 2212 | { |
@@ -2246,8 +2221,7 @@ discard block |
||
2246 | 2221 | $format = str_replace('{' . $replacementKey . '}', $this->transformField($transform, $value[$replacementKey]), $format); |
2247 | 2222 | } |
2248 | 2223 | } |
2249 | - } |
|
2250 | - else |
|
2224 | + } else |
|
2251 | 2225 | { |
2252 | 2226 | // We are transforming only value |
2253 | 2227 | if ($format == '{' . $replacementKey . '}') |
@@ -2381,8 +2355,7 @@ discard block |
||
2381 | 2355 | if ($className instanceof RApiHalTransformInterface) |
2382 | 2356 | { |
2383 | 2357 | return $directionExternal ? $className::toExternal($definition) : $className::toInternal($definition); |
2384 | - } |
|
2385 | - else |
|
2358 | + } else |
|
2386 | 2359 | { |
2387 | 2360 | return $definition; |
2388 | 2361 | } |
@@ -2423,8 +2396,7 @@ discard block |
||
2423 | 2396 | if ($return !== null) |
2424 | 2397 | { |
2425 | 2398 | return $return; |
2426 | - } |
|
2427 | - else |
|
2399 | + } else |
|
2428 | 2400 | { |
2429 | 2401 | return $result; |
2430 | 2402 | } |
@@ -2434,8 +2406,7 @@ discard block |
||
2434 | 2406 | if (method_exists($apiHelperClass, $functionName)) |
2435 | 2407 | { |
2436 | 2408 | $result = call_user_func_array(array($apiHelperClass, $functionName), $temp); |
2437 | - } |
|
2438 | - else |
|
2409 | + } else |
|
2439 | 2410 | { |
2440 | 2411 | $result = call_user_func_array(array($this, $functionName), $temp); |
2441 | 2412 | } |
@@ -2503,14 +2474,12 @@ discard block |
||
2503 | 2474 | if ($parameter[1] == 'value') |
2504 | 2475 | { |
2505 | 2476 | $parameterValue = $parameter[0]; |
2506 | - } |
|
2507 | - else |
|
2477 | + } else |
|
2508 | 2478 | { |
2509 | 2479 | if (isset($data[$parameter[0]])) |
2510 | 2480 | { |
2511 | 2481 | $parameterValue = $this->transformField($parameter[1], $data[$parameter[0]]); |
2512 | - } |
|
2513 | - else |
|
2482 | + } else |
|
2514 | 2483 | { |
2515 | 2484 | $parameterValue = null; |
2516 | 2485 | } |
@@ -2518,8 +2487,7 @@ discard block |
||
2518 | 2487 | |
2519 | 2488 | $args[] = $parameterValue; |
2520 | 2489 | } |
2521 | - } |
|
2522 | - else |
|
2490 | + } else |
|
2523 | 2491 | { |
2524 | 2492 | $args[] = $data; |
2525 | 2493 | } |
@@ -2640,8 +2608,7 @@ discard block |
||
2640 | 2608 | } |
2641 | 2609 | |
2642 | 2610 | $data = $this->triggerFunction('processPostData', $this->options->get('dataGet', array()), $configuration); |
2643 | - } |
|
2644 | - else |
|
2611 | + } else |
|
2645 | 2612 | { |
2646 | 2613 | $data = $this->triggerFunction('processPostData', $this->options->get('data', array()), $configuration); |
2647 | 2614 | } |
@@ -2658,8 +2625,7 @@ discard block |
||
2658 | 2625 | if (isset($data[$primaryKey]) && $data[$primaryKey] != '') |
2659 | 2626 | { |
2660 | 2627 | $primaryKeys[$primaryKey] = $this->transformField($primaryKeyField['transform'], $data[$primaryKey], false); |
2661 | - } |
|
2662 | - else |
|
2628 | + } else |
|
2663 | 2629 | { |
2664 | 2630 | $primaryKeys[$primaryKey] = null; |
2665 | 2631 | } |
@@ -177,8 +177,7 @@ discard block |
||
177 | 177 | if (is_array($command)) |
178 | 178 | { |
179 | 179 | $command = $filter->clean(array_pop(array_keys($command)), 'cmd'); |
180 | - } |
|
181 | - else |
|
180 | + } else |
|
182 | 181 | { |
183 | 182 | $command = $filter->clean($command, 'cmd'); |
184 | 183 | } |
@@ -188,8 +187,7 @@ discard block |
||
188 | 187 | { |
189 | 188 | // Explode the controller.task command. |
190 | 189 | list ($type, $task) = explode('.', $command); |
191 | - } |
|
192 | - else |
|
190 | + } else |
|
193 | 191 | { |
194 | 192 | $task = $command; |
195 | 193 | } |
@@ -216,14 +214,12 @@ discard block |
||
216 | 214 | try |
217 | 215 | { |
218 | 216 | self::loadWebservices($client, $webserviceName, $version, $path); |
219 | - } |
|
220 | - catch (Exception $e) |
|
217 | + } catch (Exception $e) |
|
221 | 218 | { |
222 | 219 | if ($showNotifications) |
223 | 220 | { |
224 | 221 | JFactory::getApplication()->enqueueMessage($e->getMessage(), 'message'); |
225 | - } |
|
226 | - else |
|
222 | + } else |
|
227 | 223 | { |
228 | 224 | throw $e; |
229 | 225 | } |
@@ -283,22 +279,19 @@ discard block |
||
283 | 279 | $xml->webservicePath = trim($webserviceXmlPath); |
284 | 280 | self::$webservices[$client][(string) $xml->config->name][$version] = $xml; |
285 | 281 | } |
286 | - } |
|
287 | - catch (Exception $e) |
|
282 | + } catch (Exception $e) |
|
288 | 283 | { |
289 | 284 | if ($showNotifications) |
290 | 285 | { |
291 | 286 | JFactory::getApplication()->enqueueMessage($e->getMessage(), 'message'); |
292 | - } |
|
293 | - else |
|
287 | + } else |
|
294 | 288 | { |
295 | 289 | throw $e; |
296 | 290 | } |
297 | 291 | } |
298 | 292 | } |
299 | 293 | } |
300 | - } |
|
301 | - else |
|
294 | + } else |
|
302 | 295 | { |
303 | 296 | try |
304 | 297 | { |
@@ -311,14 +304,12 @@ discard block |
||
311 | 304 | $xml->webservicePath = trim($path); |
312 | 305 | self::$webservices[$client][(string) $xml->config->name][$version] = $xml; |
313 | 306 | } |
314 | - } |
|
315 | - catch (Exception $e) |
|
307 | + } catch (Exception $e) |
|
316 | 308 | { |
317 | 309 | if ($showNotifications) |
318 | 310 | { |
319 | 311 | JFactory::getApplication()->enqueueMessage($e->getMessage(), 'message'); |
320 | - } |
|
321 | - else |
|
312 | + } else |
|
322 | 313 | { |
323 | 314 | throw $e; |
324 | 315 | } |
@@ -443,8 +434,7 @@ discard block |
||
443 | 434 | $client = self::getWebserviceClient($fileContent); |
444 | 435 | |
445 | 436 | $file['name'] = $client . '.' . $name . '.' . $version . '.xml'; |
446 | - } |
|
447 | - catch (Exception $e) |
|
437 | + } catch (Exception $e) |
|
448 | 438 | { |
449 | 439 | unset($files[$key]); |
450 | 440 | JFactory::getApplication()->enqueueMessage(JText::_('COM_REDCORE_WEBSERVICES_WEBSERVICE_FILE_NOT_VALID'), 'message'); |
@@ -487,8 +477,7 @@ discard block |
||
487 | 477 | } |
488 | 478 | |
489 | 479 | $db->transactionCommit(); |
490 | - } |
|
491 | - catch (Exception $e) |
|
480 | + } catch (Exception $e) |
|
492 | 481 | { |
493 | 482 | $db->transactionRollback(); |
494 | 483 | |
@@ -920,8 +909,7 @@ discard block |
||
920 | 909 | 'isRequiredField' => 'false', |
921 | 910 | 'transform' => 'string' |
922 | 911 | ); |
923 | - } |
|
924 | - else |
|
912 | + } else |
|
925 | 913 | { |
926 | 914 | $filterFields[] = 'search'; |
927 | 915 | } |
@@ -947,8 +935,7 @@ discard block |
||
947 | 935 | 'isRequiredField' => $required, |
948 | 936 | 'transform' => (isset($field['transform'])) ? (string) $field['transform'] : 'string' |
949 | 937 | ); |
950 | - } |
|
951 | - else |
|
938 | + } else |
|
952 | 939 | { |
953 | 940 | $filterFields[] = (string) $field["name"]; |
954 | 941 | } |
@@ -100,8 +100,7 @@ discard block |
||
100 | 100 | if ($this->documentFormat == 'xml') |
101 | 101 | { |
102 | 102 | $content = $hal->getXML()->asXML(); |
103 | - } |
|
104 | - else |
|
103 | + } else |
|
105 | 104 | { |
106 | 105 | $content = (string) $hal; |
107 | 106 | } |
@@ -190,8 +189,7 @@ discard block |
||
190 | 189 | $arrayLink->setHref($href); |
191 | 190 | $hal->setReplacedLink($arrayLink, $group); |
192 | 191 | } |
193 | - } |
|
194 | - else |
|
192 | + } else |
|
195 | 193 | { |
196 | 194 | $href = $link->getHref(); |
197 | 195 | $href = $this->addUriParameters($href, $absoluteHrefs); |
@@ -209,8 +207,7 @@ discard block |
||
209 | 207 | if (is_object($resources)) |
210 | 208 | { |
211 | 209 | $this->relToAbs($resources, $absoluteHrefs); |
212 | - } |
|
213 | - elseif (is_array($resources)) |
|
210 | + } elseif (is_array($resources)) |
|
214 | 211 | { |
215 | 212 | foreach ($resources as $resource) |
216 | 213 | { |
@@ -120,8 +120,7 @@ discard block |
||
120 | 120 | if ($singular || (!isset($this->_links[$rel]) && !$plural)) |
121 | 121 | { |
122 | 122 | $this->_links[$rel] = $link; |
123 | - } |
|
124 | - else |
|
123 | + } else |
|
125 | 124 | { |
126 | 125 | if (isset($this->_links[$rel]) && !is_array($this->_links[$rel])) |
127 | 126 | { |
@@ -169,8 +168,7 @@ discard block |
||
169 | 168 | if ($group !== '') |
170 | 169 | { |
171 | 170 | $this->_links[$rel][$group] = $link; |
172 | - } |
|
173 | - else |
|
171 | + } else |
|
174 | 172 | { |
175 | 173 | $this->_links[$rel] = $link; |
176 | 174 | } |
@@ -194,8 +192,7 @@ discard block |
||
194 | 192 | { |
195 | 193 | $this->_data[$k] = $v; |
196 | 194 | } |
197 | - } |
|
198 | - else |
|
195 | + } else |
|
199 | 196 | { |
200 | 197 | $this->_data[$rel] = $data; |
201 | 198 | } |
@@ -219,8 +216,7 @@ discard block |
||
219 | 216 | if ($singular || (!isset($this->_data[$rel]) && !$plural)) |
220 | 217 | { |
221 | 218 | $this->_data[$rel][$key] = $data; |
222 | - } |
|
223 | - else |
|
219 | + } else |
|
224 | 220 | { |
225 | 221 | if (isset($this->_data[$rel]) && !is_array($this->_data[$rel])) |
226 | 222 | { |
@@ -248,8 +244,7 @@ discard block |
||
248 | 244 | if ($singular) |
249 | 245 | { |
250 | 246 | $this->_embedded[$rel] = $resource; |
251 | - } |
|
252 | - else |
|
247 | + } else |
|
253 | 248 | { |
254 | 249 | $this->_embedded[$rel][] = $resource; |
255 | 250 | } |
@@ -308,8 +303,7 @@ discard block |
||
308 | 303 | if ($embedded instanceof self) |
309 | 304 | { |
310 | 305 | $result = $embedded->toArray(); |
311 | - } |
|
312 | - else |
|
306 | + } else |
|
313 | 307 | { |
314 | 308 | foreach ($embedded as $embed) |
315 | 309 | { |
@@ -337,8 +331,7 @@ discard block |
||
337 | 331 | if (!is_array($links)) |
338 | 332 | { |
339 | 333 | $result = $links->toArray(); |
340 | - } |
|
341 | - else |
|
334 | + } else |
|
342 | 335 | { |
343 | 336 | foreach ($links as $link) |
344 | 337 | { |
@@ -404,8 +397,7 @@ discard block |
||
404 | 397 | { |
405 | 398 | $this->_addLinks($link); |
406 | 399 | } |
407 | - } |
|
408 | - else |
|
400 | + } else |
|
409 | 401 | { |
410 | 402 | $this->_addLinks($links); |
411 | 403 | } |
@@ -434,14 +426,12 @@ discard block |
||
434 | 426 | { |
435 | 427 | $rel = is_numeric($rel) ? $_rel : $rel; |
436 | 428 | $this->_getEmbRes($embed)->addAttribute('rel', $rel); |
437 | - } |
|
438 | - else |
|
429 | + } else |
|
439 | 430 | { |
440 | 431 | if (!is_null($embed)) |
441 | 432 | { |
442 | 433 | $this->_getEmbedded($embed, $rel); |
443 | - } |
|
444 | - else |
|
434 | + } else |
|
445 | 435 | { |
446 | 436 | $rel = is_numeric($rel) ? $_rel : $rel; |
447 | 437 | $this->xml->addChild('resource')->addAttribute('rel', $rel); |
@@ -559,12 +549,10 @@ discard block |
||
559 | 549 | if ($name == '_links') |
560 | 550 | { |
561 | 551 | $this->_links = array_merge((array) $this->_links, (array) $value); |
562 | - } |
|
563 | - elseif ($name == '_embedded') |
|
552 | + } elseif ($name == '_embedded') |
|
564 | 553 | { |
565 | 554 | $this->_embedded = array_merge((array) $this->_embedded, (array) $value); |
566 | - } |
|
567 | - else |
|
555 | + } else |
|
568 | 556 | { |
569 | 557 | $this->_data[$name] = $value; |
570 | 558 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return string |
95 | 95 | */ |
96 | - public function getRel () |
|
96 | + public function getRel() |
|
97 | 97 | { |
98 | 98 | return $this->_rel; |
99 | 99 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - public function getHref () |
|
106 | + public function getHref() |
|
107 | 107 | { |
108 | 108 | return $this->_href; |
109 | 109 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return string |
125 | 125 | */ |
126 | - public function getTitle () |
|
126 | + public function getTitle() |
|
127 | 127 | { |
128 | 128 | return $this->_title; |
129 | 129 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @return string |
135 | 135 | */ |
136 | - public function getHreflang () |
|
136 | + public function getHreflang() |
|
137 | 137 | { |
138 | 138 | return $this->_hreflang; |
139 | 139 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * |
156 | 156 | * @return RApiHalDocumentLink |
157 | 157 | */ |
158 | - public function setRel ($rel) |
|
158 | + public function setRel($rel) |
|
159 | 159 | { |
160 | 160 | $this->_rel = $rel; |
161 | 161 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @return RApiHalDocumentLink |
171 | 171 | */ |
172 | - public function setHref ($href) |
|
172 | + public function setHref($href) |
|
173 | 173 | { |
174 | 174 | $this->_href = $href; |
175 | 175 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @return RApiHalDocumentLink |
199 | 199 | */ |
200 | - public function setTitle ($title) |
|
200 | + public function setTitle($title) |
|
201 | 201 | { |
202 | 202 | $this->_title = $title; |
203 | 203 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * |
212 | 212 | * @return RApiHalDocumentLink |
213 | 213 | */ |
214 | - public function setHreflang ($hreflang) |
|
214 | + public function setHreflang($hreflang) |
|
215 | 215 | { |
216 | 216 | $this->_hreflang = $hreflang; |
217 | 217 |