aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/legacy/json.php
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2020-03-26 16:35:30 +0100
committerGitHub <noreply@github.com>2020-03-26 16:35:30 +0100
commit0c3e2fac54602926cfa1a0965650481dcaf86743 (patch)
treeec20e0ffa2f86b9b54939a83a785407319f94559 /lib/private/legacy/json.php
parent62403d0932be7d620c7bdadc6b4e13eb496fcd6f (diff)
parentb80ebc96748b45fd2e0ba9323308657c4b00b7ec (diff)
downloadnextcloud-server-0c3e2fac54602926cfa1a0965650481dcaf86743.tar.gz
nextcloud-server-0c3e2fac54602926cfa1a0965650481dcaf86743.zip
Merge pull request #20168 from nextcloud/techdebt/short-array-syntax
Use the short array syntax, everywhere
Diffstat (limited to 'lib/private/legacy/json.php')
-rw-r--r--lib/private/legacy/json.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/private/legacy/json.php b/lib/private/legacy/json.php
index 29d0029a3a0..f83fca0a433 100644
--- a/lib/private/legacy/json.php
+++ b/lib/private/legacy/json.php
@@ -44,7 +44,7 @@ class OC_JSON{
public static function checkAppEnabled($app) {
if( !\OC::$server->getAppManager()->isEnabledForUser($app)) {
$l = \OC::$server->getL10N('lib');
- self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' )));
+ self::error([ 'data' => [ 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' ]]);
exit();
}
}
@@ -60,7 +60,7 @@ class OC_JSON{
|| $twoFactorAuthManger->needsSecondFactor(\OC::$server->getUserSession()->getUser())) {
$l = \OC::$server->getL10N('lib');
http_response_code(\OCP\AppFramework\Http::STATUS_UNAUTHORIZED);
- self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));
+ self::error([ 'data' => [ 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ]]);
exit();
}
}
@@ -78,7 +78,7 @@ class OC_JSON{
if( !\OC::$server->getRequest()->passesCSRFCheck()) {
$l = \OC::$server->getL10N('lib');
- self::error(array( 'data' => array( 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' )));
+ self::error([ 'data' => [ 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' ]]);
exit();
}
}
@@ -91,7 +91,7 @@ class OC_JSON{
public static function checkAdminUser() {
if( !OC_User::isAdminUser(OC_User::getUser())) {
$l = \OC::$server->getL10N('lib');
- self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));
+ self::error([ 'data' => [ 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' ]]);
exit();
}
}
@@ -101,7 +101,7 @@ class OC_JSON{
* @deprecated Use a AppFramework JSONResponse instead
* @suppress PhanDeprecatedFunction
*/
- public static function error($data = array()) {
+ public static function error($data = []) {
$data['status'] = 'error';
header( 'Content-Type: application/json; charset=utf-8');
echo self::encode($data);
@@ -112,7 +112,7 @@ class OC_JSON{
* @deprecated Use a AppFramework JSONResponse instead
* @suppress PhanDeprecatedFunction
*/
- public static function success($data = array()) {
+ public static function success($data = []) {
$data['status'] = 'success';
header( 'Content-Type: application/json; charset=utf-8');
echo self::encode($data);
@@ -133,7 +133,7 @@ class OC_JSON{
*/
public static function encode($data) {
if (is_array($data)) {
- array_walk_recursive($data, array('OC_JSON', 'to_string'));
+ array_walk_recursive($data, ['OC_JSON', 'to_string']);
}
return json_encode($data, JSON_HEX_TAG);
}