Use short array syntax

[MAILPOET-2090]
This commit is contained in:
Pavel Dohnal
2019-05-20 13:48:48 +02:00
committed by M. Shull
parent 9f16cb6a5f
commit 5da7110eb6
385 changed files with 40133 additions and 40131 deletions

View File

@@ -8,33 +8,33 @@ use MailPoet\WP\Functions as WPFunctions;
if (!defined('ABSPATH')) exit;
abstract class Endpoint {
public $permissions = array(
public $permissions = [
'global' => AccessControl::PERMISSION_MANAGE_SETTINGS,
'methods' => array()
);
'methods' => [],
];
function successResponse(
$data = array(), $meta = array(), $status = Response::STATUS_OK
$data = [], $meta = [], $status = Response::STATUS_OK
) {
return new SuccessResponse($data, $meta, $status);
}
function errorResponse(
$errors = array(), $meta = array(), $status = Response::STATUS_NOT_FOUND
$errors = [], $meta = [], $status = Response::STATUS_NOT_FOUND
) {
if (empty($errors)) {
$errors = array(
Error::UNKNOWN => WPFunctions::get()->__('An unknown error occurred.', 'mailpoet')
);
$errors = [
Error::UNKNOWN => WPFunctions::get()->__('An unknown error occurred.', 'mailpoet'),
];
}
return new ErrorResponse($errors, $meta, $status);
}
function badRequest($errors = array(), $meta = array()) {
function badRequest($errors = [], $meta = []) {
if (empty($errors)) {
$errors = array(
Error::BAD_REQUEST => WPFunctions::get()->__('Invalid request parameters', 'mailpoet')
);
$errors = [
Error::BAD_REQUEST => WPFunctions::get()->__('Invalid request parameters', 'mailpoet'),
];
}
return new ErrorResponse($errors, $meta, Response::STATUS_BAD_REQUEST);
}