Use short array declaration

This commit is contained in:
Romain Neutron
2013-11-18 11:58:12 +01:00
parent 2898b317c4
commit 56b373ee6e
723 changed files with 8350 additions and 8352 deletions

View File

@@ -108,7 +108,7 @@ class API_V1_Log
api_log_id = :log_id';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute(array(':log_id' => $this->id));
$stmt->execute([':log_id' => $this->id]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -137,10 +137,10 @@ class API_V1_Log
SET api_account_id = :account_id
WHERE api_log_id = :log_id';
$params = array(
$params = [
':api_account_id' => $this->account_id
, ':log_id' => $this->id
);
];
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -162,10 +162,10 @@ class API_V1_Log
SET api_log_date = :date
WHERE api_log_id = :log_id';
$params = array(
$params = [
':date' => $this->date->format("Y-m-d H:i:s")
, ':log_id' => $this->id
);
];
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -187,10 +187,10 @@ class API_V1_Log
SET api_log_status_code = :code
WHERE api_log_id = :log_id';
$params = array(
$params = [
':code' => $this->status_code
, ':log_id' => $this->id
);
];
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -207,7 +207,7 @@ class API_V1_Log
public function set_format($format)
{
if ( ! in_array($format, array('json', 'jsonp', 'yaml', 'unknow')))
if ( ! in_array($format, ['json', 'jsonp', 'yaml', 'unknow']))
throw new Exception_InvalidArgument();
$this->format = $format;
@@ -216,10 +216,10 @@ class API_V1_Log
SET api_log_format = :format
WHERE api_log_id = :log_id';
$params = array(
$params = [
':format' => $this->format
, ':log_id' => $this->id
);
];
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -235,7 +235,7 @@ class API_V1_Log
public function set_ressource($ressource)
{
if ( ! in_array($format, array(self::DATABOXES_RESSOURCE, self::BASKETS_RESSOURCE, self::FEEDS_RESSOURCE, self::RECORDS_RESSOURCE)))
if ( ! in_array($format, [self::DATABOXES_RESSOURCE, self::BASKETS_RESSOURCE, self::FEEDS_RESSOURCE, self::RECORDS_RESSOURCE]))
throw new Exception_InvalidArgument();
$this->ressource = $ressource;
@@ -244,10 +244,10 @@ class API_V1_Log
SET api_log_ressource = :ressource
WHERE api_log_id = :log_id';
$params = array(
$params = [
':ressource' => $this->ressource
, ':log_id' => $this->id
);
];
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -269,10 +269,10 @@ class API_V1_Log
SET api_log_general = :general
WHERE api_log_id = :log_id';
$params = array(
$params = [
':general' => $this->general
, ':log_id' => $this->id
);
];
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -294,10 +294,10 @@ class API_V1_Log
SET api_log_aspect = :aspect
WHERE api_log_id = :log_id';
$params = array(
$params = [
':aspect' => $this->aspect
, ':log_id' => $this->id
);
];
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -319,10 +319,10 @@ class API_V1_Log
SET api_log_action = :action
WHERE api_log_id = :log_id';
$params = array(
$params = [
':action' => $this->action
, ':log_id' => $this->id
);
];
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -365,7 +365,7 @@ class API_V1_Log
:action
)';
$params = array(
$params = [
':account_id' => $account->get_id(),
':route' => $route,
':status_code' => $status_code,
@@ -374,7 +374,7 @@ class API_V1_Log
':general' => $general,
':aspect' => $aspect,
':action' => $action
);
];
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);

View File

@@ -28,11 +28,11 @@ class API_V1_Timer implements ServiceProviderInterface
$n++;
$name = $event->getName() . '#' . $n;
}
$app['api.timers']->add(array(
$app['api.timers']->add([
'name' => $name,
'memory' => memory_get_usage(),
'time' => microtime(true) - $app['api.timers.start'],
));
]);
};
$app['dispatcher']->addListener(KernelEvents::CONTROLLER, $callback, -999999);

File diff suppressed because it is too large Load Diff

View File

@@ -124,7 +124,7 @@ class API_V1_result
}
$accept = $this->request->getAcceptableContentTypes();
$response_types = array();
$response_types = [];
foreach ($accept as $key => $app_type) {
$response_types[strtolower($app_type)] = true;
@@ -183,8 +183,8 @@ class API_V1_result
. $this->request->getPathInfo()
);
$ret = array(
'meta' => array(
$ret = [
'meta' => [
'api_version' => $this->api_version
, 'request' => $request_uri
, 'response_time' => $this->response_time
@@ -193,9 +193,9 @@ class API_V1_result
, 'error_message' => $this->error_message
, 'error_details' => $this->error_details
, 'charset' => 'UTF-8'
)
]
, 'response' => $this->response
);
];
$this->app['dispatcher']->dispatch(PhraseaEvents::API_RESULT, new ApiResultEvent());
@@ -214,7 +214,7 @@ class API_V1_result
break;
case self::FORMAT_YAML:
if ($ret['response'] instanceof stdClass)
$ret['response'] = array();
$ret['response'] = [];
$dumper = new Symfony\Component\Yaml\Dumper();
$return_value = $dumper->dump($ret, 8);
@@ -388,7 +388,7 @@ class API_V1_result
$response = new Response(
$this->format(),
$this->get_http_code(),
array('Content-Type' => $this->get_content_type())
['Content-Type' => $this->get_content_type()]
);
$response->setCharset('UTF-8');