Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/gallery.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Paroz <github@oparoz.com>2015-01-15 01:57:22 +0300
committerOlivier Paroz <github@oparoz.com>2015-01-15 01:57:22 +0300
commit9c48355f8904927150840e29890af7051018351b (patch)
treeb9095f6400c25bc3bcf223be1a241b96b30e1ad7 /utility
parentadafca5a503438d80eb26418b4cc6a30adf3ee10 (diff)
Use shorter syntax for arrays (5.4+ only)
Diffstat (limited to 'utility')
-rw-r--r--utility/normalizer.php14
-rw-r--r--utility/smarterlogger.php18
2 files changed, 16 insertions, 16 deletions
diff --git a/utility/normalizer.php b/utility/normalizer.php
index c039cf03..45140944 100644
--- a/utility/normalizer.php
+++ b/utility/normalizer.php
@@ -35,11 +35,11 @@ class Normalizer {
if (!is_array($scalar)) {
return $scalar;
}
- $decisionArray = array(
+ $decisionArray = [
$this->normalizeTraversable($data, $depth),
$this->normalizeObject($data, $depth),
$this->normalizeResource($data),
- );
+ ];
foreach ($decisionArray as $dataType) {
if ($dataType !== null) {
@@ -69,7 +69,7 @@ class Normalizer {
return $data;
}
- return array();
+ return [];
}
/**
@@ -99,7 +99,7 @@ class Normalizer {
private function normalizeTraversableElement($data, $depth) {
$maxArrayRecursion = 20;
$count = 1;
- $normalized = array();
+ $normalized = [];
foreach ($data as $key => $value) {
if ($count++ >= $maxArrayRecursion) {
$normalized['...'] =
@@ -136,7 +136,7 @@ class Normalizer {
}
// Don't convert to json here as we would double encode
- return array(sprintf("[object] (%s)", get_class($data)), $response);
+ return [sprintf("[object] (%s)", get_class($data)), $response];
}
return null;
@@ -150,12 +150,12 @@ class Normalizer {
* @return string[]
*/
private function normalizeException(\Exception $exception) {
- $data = array(
+ $data = [
'class' => get_class($exception),
'message' => $exception->getMessage(),
'code' => $exception->getCode(),
'file' => $exception->getFile() . ':' . $exception->getLine(),
- );
+ ];
$trace = $exception->getTraceAsString();
$data['trace'][] = $trace;
diff --git a/utility/smarterlogger.php b/utility/smarterlogger.php
index 4e4a1b20..72dd788a 100644
--- a/utility/smarterlogger.php
+++ b/utility/smarterlogger.php
@@ -56,7 +56,7 @@ class SmarterLogger implements ILogger {
*
* @return null
*/
- public function emergency($message, array $context = array()) {
+ public function emergency($message, array $context = []) {
$this->log(\OCP\Util::FATAL, $message, $context);
}
@@ -68,7 +68,7 @@ class SmarterLogger implements ILogger {
*
* @return null
*/
- public function alert($message, array $context = array()) {
+ public function alert($message, array $context = []) {
$this->log(\OCP\Util::ERROR, $message, $context);
}
@@ -80,7 +80,7 @@ class SmarterLogger implements ILogger {
*
* @return null
*/
- public function critical($message, array $context = array()) {
+ public function critical($message, array $context = []) {
$this->log(\OCP\Util::ERROR, $message, $context);
}
@@ -93,7 +93,7 @@ class SmarterLogger implements ILogger {
*
* @return null
*/
- public function error($message, array $context = array()) {
+ public function error($message, array $context = []) {
$this->log(\OCP\Util::ERROR, $message, $context);
}
@@ -105,7 +105,7 @@ class SmarterLogger implements ILogger {
*
* @return null
*/
- public function warning($message, array $context = array()) {
+ public function warning($message, array $context = []) {
$this->log(\OCP\Util::WARN, $message, $context);
}
@@ -117,7 +117,7 @@ class SmarterLogger implements ILogger {
*
* @return null
*/
- public function notice($message, array $context = array()) {
+ public function notice($message, array $context = []) {
$this->log(\OCP\Util::INFO, $message, $context);
}
@@ -129,7 +129,7 @@ class SmarterLogger implements ILogger {
*
* @return null
*/
- public function info($message, array $context = array()) {
+ public function info($message, array $context = []) {
$this->log(\OCP\Util::INFO, $message, $context);
}
@@ -141,7 +141,7 @@ class SmarterLogger implements ILogger {
*
* @return null
*/
- public function debug($message, array $context = array()) {
+ public function debug($message, array $context = []) {
$this->log(\OCP\Util::DEBUG, $message, $context);
}
@@ -155,7 +155,7 @@ class SmarterLogger implements ILogger {
*
* @return mixed
*/
- public function log($level, $message, array $context = array()) {
+ public function log($level, $message, array $context = []) {
array_walk($context, [$this, 'contextNormalizer']);
if (!isset($context['app'])) {