diff --git a/bin/developer b/bin/developer
index ac7088e183..6326046041 100755
--- a/bin/developer
+++ b/bin/developer
@@ -57,10 +57,10 @@ $cli = new CLI("
. ' Phraseanet Developer Tools ', Version::getName() . ' ' . Version::getNumber());
if ($cli['configuration']->isSetup()) {
- $helpers = array(
+ $helpers = [
'db' => new ConnectionHelper($cli['EM']->getConnection()),
'em' => new EntityManagerHelper($cli['EM'])
- );
+ ];
$helperSet = $cli['console']->getHelperSet();
foreach ($helpers as $name => $helper) {
@@ -80,7 +80,7 @@ $cli->command(new Uninstaller());
$cli->command(new \module_console_systemTemplateGenerator('system:generate-templates'));
-$cli['console']->addCommands(array(
+$cli['console']->addCommands([
// DBAL Commands
new RunSqlCommand(),
new ImportCommand(),
@@ -99,6 +99,6 @@ $cli['console']->addCommands(array(
new ConvertMappingCommand(),
new RunDqlCommand(),
new ValidateSchemaCommand(),
-));
+]);
exit($cli->runCLI());
diff --git a/builder.php b/builder.php
index 3c6ca744c8..78767e1b3d 100755
--- a/builder.php
+++ b/builder.php
@@ -48,20 +48,20 @@ $finder
->ignoreVCS(false)
->in(__DIR__);
-$files = array();
+$files = [];
foreach ($finder as $file) {
$files[$file->getRealpath()] = $file->getRealpath();
}
-foreach (array(
+foreach ([
__DIR__ . '/bin/behat',
__DIR__ . '/bin/developer',
__DIR__ . '/bin/doctrine.php',
__DIR__ . '/bin/doctrine',
__DIR__ . '/bin/phpunit',
__DIR__ . '/bin/validate-json',
-) as $binary) {
+] as $binary) {
if (is_file($binary)) {
$files[$binary] = $binary;
}
@@ -71,7 +71,7 @@ $finder = new Finder();
$finder
->ignoreDotFiles(false)
->ignoreVCS(false)
- ->in(array('logs'));
+ ->in(['logs']);
foreach ($finder as $file) {
$files[$file->getRealpath()] = $file->getRealpath();
@@ -118,7 +118,7 @@ $finder
->in(__DIR__);
-$dirs = array();
+$dirs = [];
foreach ($finder as $dir) {
$dirs[] = $dir->getRealpath();
diff --git a/functionnal-tests/api/dailymotion.php b/functionnal-tests/api/dailymotion.php
index 084c46eb2d..c287c1a55b 100644
--- a/functionnal-tests/api/dailymotion.php
+++ b/functionnal-tests/api/dailymotion.php
@@ -49,13 +49,13 @@ $console
$bridge->set_oauth_token($configuration['dailymotion']['dev_token']);
- $options = array();
- $samples = array(
+ $options = [];
+ $samples = [
'title' => $record->get_title(),
'description' => 'Upload functionnal test',
'tags' => 'phraseanet upload test dm api',
'private' => true,
- );
+ ];
foreach($bridge->get_fields() as $field) {
$options[$field['name']] = isset($samples[$field['name']]) ? $samples[$field['name']] : uniqid('test_upload');
diff --git a/launchpadToLocales.php b/launchpadToLocales.php
index 87070a8486..3583ef2771 100755
--- a/launchpadToLocales.php
+++ b/launchpadToLocales.php
@@ -29,9 +29,9 @@ $finder
->files()
->name('phraseanet-*.po')
->in(
- array(
+ [
__DIR__ . '/' . $argv[1],
- )
+ ]
)
;
diff --git a/lib/Alchemy/Phrasea/Application.php b/lib/Alchemy/Phrasea/Application.php
index 732d03ed5f..1085b8d590 100644
--- a/lib/Alchemy/Phrasea/Application.php
+++ b/lib/Alchemy/Phrasea/Application.php
@@ -152,13 +152,13 @@ use Symfony\Component\Form\Exception\FormException;
class Application extends SilexApplication
{
- private static $availableLanguages = array(
+ private static $availableLanguages = [
'de_DE' => 'Deutsch',
'en_GB' => 'English',
'fr_FR' => 'Français',
'nl_NL' => 'Dutch',
- );
- private static $flashTypes = array('warning', 'info', 'success', 'error');
+ ];
+ private static $flashTypes = ['warning', 'info', 'success', 'error'];
private $environment;
const ENV_DEV = 'dev';
@@ -222,9 +222,9 @@ class Application extends SilexApplication
$this->register(new MediaAlchemystServiceProvider());
$this['media-alchemyst.configuration'] = $this->share(function (Application $app) {
- $configuration = array();
+ $configuration = [];
- foreach (array(
+ foreach ([
'swftools.pdf2swf.binaries' => 'pdf2swf_binary',
'swftools.swfrender.binaries' => 'swf_render_binary',
'swftools.swfextract.binaries' => 'swf_extract_binary',
@@ -239,7 +239,7 @@ class Application extends SilexApplication
'mp4box.timeout' => 'mp4box_timeout',
'swftools.timeout' => 'swftools_timeout',
'unoconv.timeout' => 'unoconv_timeout',
- ) as $parameter => $key) {
+ ] as $parameter => $key) {
if (isset($this['configuration']['binaries'][$key])) {
$configuration[$parameter] = $this['configuration']['binaries'][$key];
}
@@ -284,20 +284,20 @@ class Application extends SilexApplication
});
$this->register(new SearchEngineServiceProvider());
- $this->register(new SessionServiceProvider(), array(
+ $this->register(new SessionServiceProvider(), [
'session.test' => $this->getEnvironment() === static::ENV_TEST
- ));
+ ]);
$this->register(new ServiceControllerServiceProvider());
$this->register(new SwiftmailerServiceProvider());
$this->register(new TasksServiceProvider());
$this->register(new TemporaryFilesystemServiceProvider());
$this->register(new TokensServiceProvider());
- $this->register(new TwigServiceProvider(), array(
- 'twig.options' => array(
+ $this->register(new TwigServiceProvider(), [
+ 'twig.options' => [
'cache' => $this['root.path'] . '/tmp/cache_twig/',
- ),
- 'twig.form.templates' => array('login/common/form_div_layout.html.twig')
- ));
+ ],
+ 'twig.form.templates' => ['login/common/form_div_layout.html.twig']
+ ]);
$this->register(new FormServiceProvider());
$this->setupTwig();
@@ -319,24 +319,24 @@ class Application extends SilexApplication
if ($app['phraseanet.registry']->get('GV_smtp')) {
$transport = new \Swift_Transport_EsmtpTransport(
$app['swiftmailer.transport.buffer'],
- array($app['swiftmailer.transport.authhandler']),
+ [$app['swiftmailer.transport.authhandler']],
$app['swiftmailer.transport.eventdispatcher']
);
$encryption = null;
- if (in_array($app['phraseanet.registry']->get('GV_smtp_secure'), array('ssl', 'tls'))) {
+ if (in_array($app['phraseanet.registry']->get('GV_smtp_secure'), ['ssl', 'tls'])) {
$encryption = $app['phraseanet.registry']->get('GV_smtp_secure');
}
- $options = $app['swiftmailer.options'] = array_replace(array(
+ $options = $app['swiftmailer.options'] = array_replace([
'host' => $app['phraseanet.registry']->get('GV_smtp_host'),
'port' => $app['phraseanet.registry']->get('GV_smtp_port'),
'username' => $app['phraseanet.registry']->get('GV_smtp_user'),
'password' => $app['phraseanet.registry']->get('GV_smtp_password'),
'encryption' => $encryption,
'auth_mode' => null,
- ), $app['swiftmailer.options']);
+ ], $app['swiftmailer.options']);
$transport->setHost($options['host']);
$transport->setPort($options['port']);
@@ -400,8 +400,8 @@ class Application extends SilexApplication
$this['dispatcher'] = $this->share(
$this->extend('dispatcher', function ($dispatcher, Application $app) {
- $dispatcher->addListener(KernelEvents::REQUEST, array($app, 'initSession'), 254);
- $dispatcher->addListener(KernelEvents::RESPONSE, array($app, 'addUTF8Charset'), -128);
+ $dispatcher->addListener(KernelEvents::REQUEST, [$app, 'initSession'], 254);
+ $dispatcher->addListener(KernelEvents::RESPONSE, [$app, 'addUTF8Charset'], -128);
$dispatcher->addSubscriber(new LogoutSubscriber());
$dispatcher->addSubscriber(new PhraseaLocaleSubscriber($app));
$dispatcher->addSubscriber(new MaintenanceSubscriber($app));
@@ -411,7 +411,7 @@ class Application extends SilexApplication
})
);
- $this['log.channels'] = array('monolog', 'task-manager.logger');
+ $this['log.channels'] = ['monolog', 'task-manager.logger'];
$this->register(new LocaleServiceProvider());
@@ -462,7 +462,7 @@ class Application extends SilexApplication
*
* @throws FormException if any given option is not applicable to the given type
*/
- public function form($type = 'form', $data = null, array $options = array(), FormBuilderInterface $parent = null)
+ public function form($type = 'form', $data = null, array $options = [], FormBuilderInterface $parent = null)
{
return $this['form.factory']->create($type, $data, $options, $parent);
}
@@ -475,7 +475,7 @@ class Application extends SilexApplication
*
* @return string The generated path
*/
- public function path($route, $parameters = array())
+ public function path($route, $parameters = [])
{
return $this['url_generator']->generate($route, $parameters, UrlGenerator::ABSOLUTE_PATH);
}
@@ -488,7 +488,7 @@ class Application extends SilexApplication
*
* @return RedirectResponse
*/
- public function redirectPath($route, $parameters = array())
+ public function redirectPath($route, $parameters = [])
{
return $this->redirect($this->path($route, $parameters));
}
@@ -501,7 +501,7 @@ class Application extends SilexApplication
*
* @return string The generated URL
*/
- public function url($route, $parameters = array())
+ public function url($route, $parameters = [])
{
return $this['url_generator']->generate($route, $parameters, UrlGenerator::ABSOLUTE_URL);
}
@@ -514,7 +514,7 @@ class Application extends SilexApplication
*
* @return RedirectResponse
*/
- public function redirectUrl($route, $parameters = array())
+ public function redirectUrl($route, $parameters = [])
{
return $this->redirect($this->url($route, $parameters));
}
@@ -671,7 +671,7 @@ class Application extends SilexApplication
*
* @return array
*/
- public function getFlash($type, array $default = array())
+ public function getFlash($type, array $default = [])
{
return $this['session']->getFlashBag()->get($type, $default);
}
@@ -763,7 +763,7 @@ class Application extends SilexApplication
*/
public function getOpenCollections()
{
- return array();
+ return [];
}
public function bindRoutes()
diff --git a/lib/Alchemy/Phrasea/Application/Api.php b/lib/Alchemy/Phrasea/Application/Api.php
index 55c33d3cd3..7e88af31cb 100644
--- a/lib/Alchemy/Phrasea/Application/Api.php
+++ b/lib/Alchemy/Phrasea/Application/Api.php
@@ -39,24 +39,24 @@ return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
$result = new \API_V1_result($app, $request, $apiAdapter);
- return $result->set_datas(array(
+ return $result->set_datas([
'name' => $app['phraseanet.registry']->get('GV_homeTitle'),
'type' => 'phraseanet',
'description' => $app['phraseanet.registry']->get('GV_metaDescription'),
'documentation' => 'https://docs.phraseanet.com/Devel',
- 'versions' => array(
- '1' => array(
+ 'versions' => [
+ '1' => [
'number' => $apiAdapter->get_version(),
'uri' => '/api/v1/',
'authenticationProtocol' => 'OAuth2',
'authenticationVersion' => 'draft#v9',
- 'authenticationEndPoints' => array(
+ 'authenticationEndPoints' => [
'authorization_token' => '/api/oauthv2/authorize',
'access_token' => '/api/oauthv2/token'
- )
- )
- )
- ))->get_response();
+ ]
+ ]
+ ]
+ ])->get_response();
});
$app->mount('/api/oauthv2', new Oauth2());
diff --git a/lib/Alchemy/Phrasea/Application/Root.php b/lib/Alchemy/Phrasea/Application/Root.php
index e6470185d9..cf48540fae 100644
--- a/lib/Alchemy/Phrasea/Application/Root.php
+++ b/lib/Alchemy/Phrasea/Application/Root.php
@@ -50,9 +50,9 @@ return call_user_func(function ($environment = PhraseaApplication::ENV_PROD) {
$app->bindRoutes();
if (PhraseaApplication::ENV_DEV === $app->getEnvironment()) {
- $app->register($p = new WebProfilerServiceProvider(), array(
+ $app->register($p = new WebProfilerServiceProvider(), [
'profiler.cache_dir' => $app['root.path'] . '/tmp/cache/profiler',
- ));
+ ]);
$app->mount('/_profiler', $p);
}
diff --git a/lib/Alchemy/Phrasea/Authentication/ACLProvider.php b/lib/Alchemy/Phrasea/Authentication/ACLProvider.php
index 420a290155..61d1bd1a4d 100644
--- a/lib/Alchemy/Phrasea/Authentication/ACLProvider.php
+++ b/lib/Alchemy/Phrasea/Authentication/ACLProvider.php
@@ -21,7 +21,7 @@ class ACLProvider
*
* @var array
*/
- private static $cache = array();
+ private static $cache = [];
private $app;
@@ -51,7 +51,7 @@ class ACLProvider
*/
public function purge()
{
- self::$cache = array();
+ self::$cache = [];
}
/**
diff --git a/lib/Alchemy/Phrasea/Authentication/AccountCreator.php b/lib/Alchemy/Phrasea/Authentication/AccountCreator.php
index bee068c7ee..8ce723e9de 100644
--- a/lib/Alchemy/Phrasea/Authentication/AccountCreator.php
+++ b/lib/Alchemy/Phrasea/Authentication/AccountCreator.php
@@ -61,7 +61,7 @@ class AccountCreator
* @throws RuntimeException In case the AccountCreator is disabled
* @throws InvalidArgumentException In case a user with the same email already exists
*/
- public function create(Application $app, $id, $email = null, array $templates = array())
+ public function create(Application $app, $id, $email = null, array $templates = [])
{
if (!$this->enabled) {
throw new RuntimeException('Account creator is disabled');
@@ -81,7 +81,7 @@ class AccountCreator
$user = \User_Adapter::create($app, $login, $this->random->generatePassword(), $email, false, false);
- $base_ids = array();
+ $base_ids = [];
foreach ($this->appbox->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
$base_ids[] = $collection->get_base_id();
diff --git a/lib/Alchemy/Phrasea/Authentication/Authenticator.php b/lib/Alchemy/Phrasea/Authentication/Authenticator.php
index b9d1c39abd..3256087a15 100644
--- a/lib/Alchemy/Phrasea/Authentication/Authenticator.php
+++ b/lib/Alchemy/Phrasea/Authentication/Authenticator.php
@@ -88,7 +88,7 @@ class Authenticator
public function refreshAccount(Session $session)
{
- if (!$this->em->getRepository('Alchemy\Phrasea\Model\Entities\Session')->findOneBy(array('id' => $session->getId()))) {
+ if (!$this->em->getRepository('Alchemy\Phrasea\Model\Entities\Session')->findOneBy(['id' => $session->getId()])) {
throw new RuntimeException('Unable to refresh the session, it does not exist anymore');
}
diff --git a/lib/Alchemy/Phrasea/Authentication/Context.php b/lib/Alchemy/Phrasea/Authentication/Context.php
index 95e8bcd37e..dd039366ac 100644
--- a/lib/Alchemy/Phrasea/Authentication/Context.php
+++ b/lib/Alchemy/Phrasea/Authentication/Context.php
@@ -34,7 +34,7 @@ class Context
public function setContext($context)
{
- if (false === in_array($context, array(static::CONTEXT_OAUTH2_NATIVE, static::CONTEXT_OAUTH2_TOKEN, static::CONTEXT_NATIVE, static::CONTEXT_GUEST), true)) {
+ if (false === in_array($context, [static::CONTEXT_OAUTH2_NATIVE, static::CONTEXT_OAUTH2_TOKEN, static::CONTEXT_NATIVE, static::CONTEXT_GUEST], true)) {
throw new InvalidArgumentException(sprintf('`%s` is not a valid context', $context));
}
diff --git a/lib/Alchemy/Phrasea/Authentication/PersistentCookie/Manager.php b/lib/Alchemy/Phrasea/Authentication/PersistentCookie/Manager.php
index 5b52ff66d4..c1b4b02fde 100644
--- a/lib/Alchemy/Phrasea/Authentication/PersistentCookie/Manager.php
+++ b/lib/Alchemy/Phrasea/Authentication/PersistentCookie/Manager.php
@@ -39,7 +39,7 @@ class Manager
{
$session = $this->em
->getRepository('Alchemy\Phrasea\Model\Entities\Session')
- ->findOneBy(array('token' => $cookieValue));
+ ->findOneBy(['token' => $cookieValue]);
if (!$session) {
return false;
diff --git a/lib/Alchemy/Phrasea/Authentication/Phrasea/NativeAuthentication.php b/lib/Alchemy/Phrasea/Authentication/Phrasea/NativeAuthentication.php
index 9614db60e5..50df717c01 100644
--- a/lib/Alchemy/Phrasea/Authentication/Phrasea/NativeAuthentication.php
+++ b/lib/Alchemy/Phrasea/Authentication/Phrasea/NativeAuthentication.php
@@ -36,7 +36,7 @@ class NativeAuthentication implements PasswordAuthenticationInterface
*/
public function getUsrId($username, $password, Request $request)
{
- if (in_array($username, array('invite', 'autoregister'))) {
+ if (in_array($username, ['invite', 'autoregister'])) {
return null;
}
@@ -48,7 +48,7 @@ class NativeAuthentication implements PasswordAuthenticationInterface
LIMIT 0, 1';
$stmt = $this->conn->prepare($sql);
- $stmt->execute(array(':login' => $username));
+ $stmt->execute([':login' => $username]);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -71,11 +71,11 @@ class NativeAuthentication implements PasswordAuthenticationInterface
$sql = 'UPDATE usr SET usr_password = :password, nonce = :nonce
WHERE usr_id = :usr_id';
$stmt = $this->conn->prepare($sql);
- $stmt->execute(array(
+ $stmt->execute([
':password' => $row['usr_password'],
':nonce' => $row['nonce'],
':usr_id' => $row['usr_id'],
- ));
+ ]);
$stmt->closeCursor();
}
}
diff --git a/lib/Alchemy/Phrasea/Authentication/Provider/AbstractProvider.php b/lib/Alchemy/Phrasea/Authentication/Provider/AbstractProvider.php
index 72f71c1627..91c8210b9b 100644
--- a/lib/Alchemy/Phrasea/Authentication/Provider/AbstractProvider.php
+++ b/lib/Alchemy/Phrasea/Authentication/Provider/AbstractProvider.php
@@ -57,7 +57,7 @@ abstract class AbstractProvider implements ProviderInterface
*/
public function getTemplates(Identity $identity)
{
- return array();
+ return [];
}
/**
diff --git a/lib/Alchemy/Phrasea/Authentication/Provider/Facebook.php b/lib/Alchemy/Phrasea/Authentication/Provider/Facebook.php
index db18c3911b..7a27383d34 100644
--- a/lib/Alchemy/Phrasea/Authentication/Provider/Facebook.php
+++ b/lib/Alchemy/Phrasea/Authentication/Provider/Facebook.php
@@ -51,14 +51,14 @@ class Facebook extends AbstractProvider
*/
public function authenticate()
{
- return new RedirectResponse($this->facebook->getLoginUrl(array(
+ return new RedirectResponse($this->facebook->getLoginUrl([
'scope' => 'email',
'redirect_uri' => $this->generator->generate(
'login_authentication_provider_callback',
- array('providerId' => $this->getId()),
+ ['providerId' => $this->getId()],
UrlGenerator::ABSOLUTE_URL
)
- )));
+ ]));
}
/**
diff --git a/lib/Alchemy/Phrasea/Authentication/Provider/Factory.php b/lib/Alchemy/Phrasea/Authentication/Provider/Factory.php
index bd868e3586..918f75f098 100644
--- a/lib/Alchemy/Phrasea/Authentication/Provider/Factory.php
+++ b/lib/Alchemy/Phrasea/Authentication/Provider/Factory.php
@@ -26,7 +26,7 @@ class Factory
$this->session = $session;
}
- public function build($name, array $options = array())
+ public function build($name, array $options = [])
{
$name = implode('', array_map(function ($chunk) {
return ucfirst(strtolower($chunk));
diff --git a/lib/Alchemy/Phrasea/Authentication/Provider/Github.php b/lib/Alchemy/Phrasea/Authentication/Provider/Github.php
index c14f3fefc2..4f3988eb96 100644
--- a/lib/Alchemy/Phrasea/Authentication/Provider/Github.php
+++ b/lib/Alchemy/Phrasea/Authentication/Provider/Github.php
@@ -84,16 +84,16 @@ class Github extends AbstractProvider
$this->session->set('github.provider.state', $state);
- return new RedirectResponse('https://github.com/login/oauth/authorize?' . http_build_query(array(
+ return new RedirectResponse('https://github.com/login/oauth/authorize?' . http_build_query([
'client_id' => $this->key,
'scope' => 'user,user:email',
'state' => $state,
'redirect_uri' => $this->generator->generate(
'login_authentication_provider_callback',
- array('providerId' => $this->getId()),
+ ['providerId' => $this->getId()],
UrlGenerator::ABSOLUTE_URL
),
- ), '', '&'));
+ ], '', '&'));
}
/**
@@ -120,16 +120,16 @@ class Github extends AbstractProvider
try {
$guzzleRequest = $this->client->post('access_token');
- $guzzleRequest->addPostFields(array(
+ $guzzleRequest->addPostFields([
'code' => $request->query->get('code'),
'redirect_uri' => $this->generator->generate(
'login_authentication_provider_callback',
- array('providerId' => $this->getId()),
+ ['providerId' => $this->getId()],
UrlGenerator::ABSOLUTE_URL
),
'client_id' => $this->key,
'client_secret' => $this->secret,
- ));
+ ]);
$guzzleRequest->setHeader('Accept', 'application/json');
$response = $guzzleRequest->send();
} catch (GuzzleException $e) {
diff --git a/lib/Alchemy/Phrasea/Authentication/Provider/GooglePlus.php b/lib/Alchemy/Phrasea/Authentication/Provider/GooglePlus.php
index 6087eb0fa0..203c028f39 100644
--- a/lib/Alchemy/Phrasea/Authentication/Provider/GooglePlus.php
+++ b/lib/Alchemy/Phrasea/Authentication/Provider/GooglePlus.php
@@ -38,16 +38,16 @@ class GooglePlus extends AbstractProvider
$this->plus = new \Google_PlusService($this->client);
- $this->client->setScopes(array(
+ $this->client->setScopes([
'https://www.googleapis.com/auth/plus.me',
'https://www.googleapis.com/auth/userinfo.email',
- ));
+ ]);
$this->client->setRedirectUri(
$this->generator->generate(
- 'login_authentication_provider_callback', array(
+ 'login_authentication_provider_callback', [
'providerId' => $this->getId(),
- ), UrlGenerator::ABSOLUTE_URL
+ ], UrlGenerator::ABSOLUTE_URL
)
);
@@ -218,7 +218,7 @@ class GooglePlus extends AbstractProvider
try {
$request = $this->guzzle->get(sprintf(
'https://www.googleapis.com/oauth2/v1/tokeninfo?%s',
- http_build_query(array('access_token' => $token['access_token']), '', '&')
+ http_build_query(['access_token' => $token['access_token']], '', '&')
));
$response = $request->send();
} catch (GuzzleException $e) {
diff --git a/lib/Alchemy/Phrasea/Authentication/Provider/Linkedin.php b/lib/Alchemy/Phrasea/Authentication/Provider/Linkedin.php
index d05ab8460c..e8016475b0 100644
--- a/lib/Alchemy/Phrasea/Authentication/Provider/Linkedin.php
+++ b/lib/Alchemy/Phrasea/Authentication/Provider/Linkedin.php
@@ -84,17 +84,17 @@ class Linkedin extends AbstractProvider
$this->session->set('linkedin.provider.state', $state);
- return new RedirectResponse('https://www.linkedin.com/uas/oauth2/authorization?' . http_build_query(array(
+ return new RedirectResponse('https://www.linkedin.com/uas/oauth2/authorization?' . http_build_query([
'response_type' => 'code',
'client_id' => $this->key,
'scope' => 'r_basicprofile r_emailaddress',
'state' => $state,
'redirect_uri' => $this->generator->generate(
'login_authentication_provider_callback',
- array('providerId' => $this->getId()),
+ ['providerId' => $this->getId()],
UrlGenerator::ABSOLUTE_URL
),
- ), '', '&'));
+ ], '', '&'));
}
/**
@@ -119,17 +119,17 @@ class Linkedin extends AbstractProvider
}
try {
- $guzzleRequest = $this->client->post('https://www.linkedin.com/uas/oauth2/accessToken?' . http_build_query(array(
+ $guzzleRequest = $this->client->post('https://www.linkedin.com/uas/oauth2/accessToken?' . http_build_query([
'grant_type' => 'authorization_code',
'code' => $request->query->get('code'),
'redirect_uri' => $this->generator->generate(
'login_authentication_provider_callback',
- array('providerId' => $this->getId()),
+ ['providerId' => $this->getId()],
UrlGenerator::ABSOLUTE_URL
),
'client_id' => $this->key,
'client_secret' => $this->secret,
- ), '', '&'));
+ ], '', '&'));
$response = $guzzleRequest->send();
} catch (GuzzleException $e) {
throw new NotAuthenticatedException('Unable to query LinkedIn access token', $e->getCode(), $e);
diff --git a/lib/Alchemy/Phrasea/Authentication/Provider/Token/Identity.php b/lib/Alchemy/Phrasea/Authentication/Provider/Token/Identity.php
index ddf6e0eba2..55f9144516 100644
--- a/lib/Alchemy/Phrasea/Authentication/Provider/Token/Identity.php
+++ b/lib/Alchemy/Phrasea/Authentication/Provider/Token/Identity.php
@@ -23,7 +23,7 @@ class Identity
const PROPERTY_USERNAME = 'username';
const PROPERTY_COMPANY = 'company';
- private $data = array(
+ private $data = [
self::PROPERTY_ID => null,
self::PROPERTY_IMAGEURL => null,
self::PROPERTY_EMAIL => null,
@@ -31,9 +31,9 @@ class Identity
self::PROPERTY_LASTNAME => null,
self::PROPERTY_USERNAME => null,
self::PROPERTY_COMPANY => null,
- );
+ ];
- public function __construct(array $data = array())
+ public function __construct(array $data = [])
{
$this->data = array_merge($this->data, $data);
}
@@ -55,10 +55,10 @@ class Identity
*/
public function getDisplayName()
{
- $data = array_filter(array(
+ $data = array_filter([
$this->get(self::PROPERTY_FIRSTNAME),
$this->get(self::PROPERTY_LASTNAME),
- ));
+ ]);
return implode(' ', $data);
}
diff --git a/lib/Alchemy/Phrasea/Authentication/Provider/Twitter.php b/lib/Alchemy/Phrasea/Authentication/Provider/Twitter.php
index d7d3144c76..26dda5c1da 100644
--- a/lib/Alchemy/Phrasea/Authentication/Provider/Twitter.php
+++ b/lib/Alchemy/Phrasea/Authentication/Provider/Twitter.php
@@ -74,11 +74,11 @@ class Twitter extends AbstractProvider
$code = $this->twitter->request(
'POST',
$this->twitter->url('oauth/request_token', ''),
- array('oauth_callback' => $this->generator->generate(
+ ['oauth_callback' => $this->generator->generate(
'login_authentication_provider_callback',
- array('providerId' => $this->getId()),
+ ['providerId' => $this->getId()],
UrlGenerator::ABSOLUTE_URL
- ))
+ )]
);
if ($code != 200) {
@@ -92,7 +92,7 @@ class Twitter extends AbstractProvider
return new RedirectResponse(sprintf(
'%s?%s',
$this->twitter->url("oauth/authenticate", ''),
- http_build_query(array('oauth_token' => $oauth['oauth_token']), '', '&')
+ http_build_query(['oauth_token' => $oauth['oauth_token']], '', '&')
));
}
@@ -117,7 +117,7 @@ class Twitter extends AbstractProvider
$code = $this->twitter->request(
'POST',
$this->twitter->url('oauth/access_token', ''),
- array('oauth_verifier' => $request->query->get('oauth_verifier'))
+ ['oauth_verifier' => $request->query->get('oauth_verifier')]
);
if ($code != 200) {
@@ -248,11 +248,11 @@ class Twitter extends AbstractProvider
*/
public static function create(UrlGenerator $generator, SessionInterface $session, array $options)
{
- $twitter = new \tmhOAuth(array(
+ $twitter = new \tmhOAuth([
'consumer_key' => $options['consumer-key'],
'consumer_secret' => $options['consumer-secret'],
'timezone' => date_default_timezone_get(),
- ));
+ ]);
return new Twitter($generator, $session, $twitter);
}
diff --git a/lib/Alchemy/Phrasea/Authentication/Provider/Viadeo.php b/lib/Alchemy/Phrasea/Authentication/Provider/Viadeo.php
index 9922c70b79..d7d4e1caff 100644
--- a/lib/Alchemy/Phrasea/Authentication/Provider/Viadeo.php
+++ b/lib/Alchemy/Phrasea/Authentication/Provider/Viadeo.php
@@ -85,16 +85,16 @@ class Viadeo extends AbstractProvider
$this->session->set('viadeo.provider.state', $state);
- return new RedirectResponse('https://secure.viadeo.com/oauth-provider/authorize2?' . http_build_query(array(
+ return new RedirectResponse('https://secure.viadeo.com/oauth-provider/authorize2?' . http_build_query([
'client_id' => $this->key,
'state' => $state,
'response_type' => 'code',
'redirect_uri' => $this->generator->generate(
'login_authentication_provider_callback',
- array('providerId' => $this->getId()),
+ ['providerId' => $this->getId()],
UrlGenerator::ABSOLUTE_URL
),
- )));
+ ]));
}
/**
@@ -138,13 +138,13 @@ class Viadeo extends AbstractProvider
try {
$guzzleRequest = $this->client->post('https://secure.viadeo.com/oauth-provider/access_token2');
- $guzzleRequest->addPostFields(array(
+ $guzzleRequest->addPostFields([
'grant_type' => 'authorization_code',
'code' => $request->query->get('code'),
- 'redirect_uri' => $this->generator->generate('login_authentication_provider_callback', array('providerId' => $this->getId()), UrlGenerator::ABSOLUTE_URL),
+ 'redirect_uri' => $this->generator->generate('login_authentication_provider_callback', ['providerId' => $this->getId()], UrlGenerator::ABSOLUTE_URL),
'client_id' => $this->key,
'client_secret' => $this->secret,
- ));
+ ]);
$guzzleRequest->setHeader('Accept', 'application/json');
$response = $guzzleRequest->send();
} catch (GuzzleException $e) {
diff --git a/lib/Alchemy/Phrasea/Authentication/ProvidersCollection.php b/lib/Alchemy/Phrasea/Authentication/ProvidersCollection.php
index 65467fbf50..5bdc9736cb 100644
--- a/lib/Alchemy/Phrasea/Authentication/ProvidersCollection.php
+++ b/lib/Alchemy/Phrasea/Authentication/ProvidersCollection.php
@@ -16,7 +16,7 @@ use Alchemy\Phrasea\Exception\InvalidArgumentException;
class ProvidersCollection implements \Countable, \IteratorAggregate
{
- private $providers = array();
+ private $providers = [];
public function getIterator()
{
diff --git a/lib/Alchemy/Phrasea/Authentication/SuggestionFinder.php b/lib/Alchemy/Phrasea/Authentication/SuggestionFinder.php
index e92ee6c360..a813f1d936 100644
--- a/lib/Alchemy/Phrasea/Authentication/SuggestionFinder.php
+++ b/lib/Alchemy/Phrasea/Authentication/SuggestionFinder.php
@@ -42,7 +42,7 @@ class SuggestionFinder
$sql = 'SELECT usr_id FROM usr WHERE usr_mail = :email';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
- $stmt->execute(array(':email' => $infos->get(Identity::PROPERTY_EMAIL)));
+ $stmt->execute([':email' => $infos->get(Identity::PROPERTY_EMAIL)]);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
diff --git a/lib/Alchemy/Phrasea/Border/Attribute/MetaField.php b/lib/Alchemy/Phrasea/Border/Attribute/MetaField.php
index ee6eba475d..496a9f6dc7 100644
--- a/lib/Alchemy/Phrasea/Border/Attribute/MetaField.php
+++ b/lib/Alchemy/Phrasea/Border/Attribute/MetaField.php
@@ -87,11 +87,11 @@ class MetaField implements AttributeInterface
*/
public function asString()
{
- return serialize(array(
+ return serialize([
'id' => $this->databox_field->get_id(),
'sbas_id' => $this->databox_field->get_databox()->get_sbas_id(),
'value' => $this->value
- ));
+ ]);
}
/**
diff --git a/lib/Alchemy/Phrasea/Border/Checker/AbstractChecker.php b/lib/Alchemy/Phrasea/Border/Checker/AbstractChecker.php
index 1c0d1b277e..a37ef77626 100644
--- a/lib/Alchemy/Phrasea/Border/Checker/AbstractChecker.php
+++ b/lib/Alchemy/Phrasea/Border/Checker/AbstractChecker.php
@@ -20,8 +20,8 @@ use Alchemy\Phrasea\Border\File;
abstract class AbstractChecker implements CheckerInterface
{
protected $app;
- protected $databoxes = array();
- protected $collections = array();
+ protected $databoxes = [];
+ protected $collections = [];
public function __construct(Application $app)
{
@@ -44,7 +44,7 @@ abstract class AbstractChecker implements CheckerInterface
throw new \LogicException('You can not restrict on databoxes and collections simultanously');
}
- $this->databoxes = array();
+ $this->databoxes = [];
foreach ($this->toIterator($databoxes) as $databox) {
if (! $databox instanceof \databox) {
@@ -72,7 +72,7 @@ abstract class AbstractChecker implements CheckerInterface
throw new \LogicException('You can not restrict on databoxes and collections simultanously');
}
- $this->collections = array();
+ $this->collections = [];
foreach ($this->toIterator($collections) as $collection) {
if (! $collection instanceof \collection) {
@@ -122,6 +122,6 @@ abstract class AbstractChecker implements CheckerInterface
*/
protected function toIterator($data)
{
- return new \ArrayObject(is_array($data) ? $data : array($data));
+ return new \ArrayObject(is_array($data) ? $data : [$data]);
}
}
diff --git a/lib/Alchemy/Phrasea/Border/Checker/Filename.php b/lib/Alchemy/Phrasea/Border/Checker/Filename.php
index 78d208172f..372b66ae08 100644
--- a/lib/Alchemy/Phrasea/Border/Checker/Filename.php
+++ b/lib/Alchemy/Phrasea/Border/Checker/Filename.php
@@ -28,7 +28,7 @@ class Filename extends AbstractChecker
* @param Application $app
* @param array $options An array of options. available : 'sensitive' (false by default)
*/
- public function __construct(Application $app, array $options = array())
+ public function __construct(Application $app, array $options = [])
{
if ( ! isset($options['sensitive'])) {
$options['sensitive'] = false;
diff --git a/lib/Alchemy/Phrasea/Border/File.php b/lib/Alchemy/Phrasea/Border/File.php
index d3f9eac215..02c6c4fc50 100644
--- a/lib/Alchemy/Phrasea/Border/File.php
+++ b/lib/Alchemy/Phrasea/Border/File.php
@@ -65,7 +65,7 @@ class File
$this->app = $app;
$this->media = $media;
$this->collection = $collection;
- $this->attributes = array();
+ $this->attributes = [];
$this->originalName = $originalName ? : pathinfo($this->media->getFile()->getPathname(), PATHINFO_BASENAME);
}
@@ -96,13 +96,13 @@ class File
return $this->uuid;
}
- $availableUUIDs = array(
+ $availableUUIDs = [
'XMP-exif:ImageUniqueID',
'SigmaRaw:ImageUniqueID',
'IPTC:UniqueDocumentID',
'ExifIFD:ImageUniqueID',
'Canon:ImageUniqueID',
- );
+ ];
if (! $this->uuid) {
$metadatas = $this->media->getMetadatas();
diff --git a/lib/Alchemy/Phrasea/Border/Manager.php b/lib/Alchemy/Phrasea/Border/Manager.php
index 1c1ad8da42..1e80ceadb1 100644
--- a/lib/Alchemy/Phrasea/Border/Manager.php
+++ b/lib/Alchemy/Phrasea/Border/Manager.php
@@ -49,7 +49,7 @@ use XPDF\PdfToText;
*/
class Manager
{
- protected $checkers = array();
+ protected $checkers = [];
protected $app;
protected $filesystem;
protected $pdfToText;
@@ -279,12 +279,12 @@ class Manager
)
);
- $metadatas = array();
+ $metadatas = [];
/**
* @todo $key is not tagname but fieldname
*/
- $fieldToKeyMap = array();
+ $fieldToKeyMap = [];
if (! $fieldToKeyMap) {
foreach ($file->getCollection()->get_databox()->get_meta_structure() as $databox_field) {
@@ -292,7 +292,7 @@ class Manager
$tagname = $databox_field->get_tag()->getTagname();
if ( ! isset($fieldToKeyMap[$tagname])) {
- $fieldToKeyMap[$tagname] = array();
+ $fieldToKeyMap[$tagname] = [];
}
$fieldToKeyMap[$tagname][] = $databox_field->get_name();
@@ -309,7 +309,7 @@ class Manager
foreach ($fieldToKeyMap[$key] as $k) {
if ( ! isset($metadatas[$k])) {
- $metadatas[$k] = array();
+ $metadatas[$k] = [];
}
$metadatas[$k] = array_merge($metadatas[$k], $metadata->getValue()->asArray());
@@ -328,7 +328,7 @@ class Manager
$key = $attribute->getField()->get_name();
if ( ! isset($metadatas[$key])) {
- $metadatas[$key] = array();
+ $metadatas[$key] = [];
}
$metadatas[$key] = array_merge($metadatas[$key], $attribute->getValue());
@@ -344,7 +344,7 @@ class Manager
foreach ($fieldToKeyMap[$key] as $k) {
if ( ! isset($metadatas[$k])) {
- $metadatas[$k] = array();
+ $metadatas[$k] = [];
}
$metadatas[$k] = array_merge($metadatas[$k], $attribute->getValue()->getValue()->asArray());
@@ -368,7 +368,7 @@ class Manager
$databox = $element->get_databox();
- $metas = array();
+ $metas = [];
foreach ($metadatas as $fieldname => $values) {
foreach ($databox->get_meta_structure()->get_elements() as $databox_field) {
@@ -377,7 +377,7 @@ class Manager
if ($databox_field->is_multi()) {
- $tmpValues = array();
+ $tmpValues = [];
foreach ($values as $value) {
$tmpValues = array_merge($tmpValues, \caption_field::get_multi_values($value, $databox_field->get_separator()));
}
@@ -388,11 +388,11 @@ class Manager
if ( ! trim($value)) {
continue;
}
- $metas[] = array(
+ $metas[] = [
'meta_struct_id' => $databox_field->get_id(),
'meta_id' => null,
'value' => $value,
- );
+ ];
}
} else {
@@ -402,11 +402,11 @@ class Manager
continue;
}
- $metas[] = array(
+ $metas[] = [
'meta_struct_id' => $databox_field->get_id(),
'meta_id' => null,
'value' => $value,
- );
+ ];
}
}
}
diff --git a/lib/Alchemy/Phrasea/Border/MetaFieldsBag.php b/lib/Alchemy/Phrasea/Border/MetaFieldsBag.php
index 303bbb5029..0fee025c3e 100644
--- a/lib/Alchemy/Phrasea/Border/MetaFieldsBag.php
+++ b/lib/Alchemy/Phrasea/Border/MetaFieldsBag.php
@@ -25,7 +25,7 @@ class MetaFieldsBag extends ArrayCollection implements MetaBagInterface
*/
public function toMetadataArray(\databox_descriptionStructure $metadatasStructure)
{
- $metas = array();
+ $metas = [];
$unicode = new \unicode();
foreach ($metadatasStructure as $databox_field) {
@@ -34,7 +34,7 @@ class MetaFieldsBag extends ArrayCollection implements MetaBagInterface
$values = $this->get($databox_field->get_name())->getValue();
- $tmp = array();
+ $tmp = [];
foreach ($values as $value) {
foreach (\caption_field::get_multi_values($value, $databox_field->get_separator()) as $v) {
@@ -52,11 +52,11 @@ class MetaFieldsBag extends ArrayCollection implements MetaBagInterface
$value = $unicode->parseDate($value);
}
- $metas[] = array(
+ $metas[] = [
'meta_struct_id' => $databox_field->get_id(),
'value' => $value,
'meta_id' => null
- );
+ ];
}
} else {
@@ -69,11 +69,11 @@ class MetaFieldsBag extends ArrayCollection implements MetaBagInterface
$value = $unicode->parseDate($value);
}
- $metas[] = array(
+ $metas[] = [
'meta_struct_id' => $databox_field->get_id(),
'value' => $value,
'meta_id' => null
- );
+ ];
}
}
}
diff --git a/lib/Alchemy/Phrasea/Border/MetadataBag.php b/lib/Alchemy/Phrasea/Border/MetadataBag.php
index 07528a9ad0..6cffd252d7 100644
--- a/lib/Alchemy/Phrasea/Border/MetadataBag.php
+++ b/lib/Alchemy/Phrasea/Border/MetadataBag.php
@@ -26,7 +26,7 @@ class MetadataBag extends ArrayCollection implements MetaBagInterface
*/
public function toMetadataArray(\databox_descriptionStructure $metadatasStructure)
{
- $metas = array();
+ $metas = [];
$unicode = new \unicode();
foreach ($metadatasStructure as $databox_field) {
@@ -42,7 +42,7 @@ class MetadataBag extends ArrayCollection implements MetaBagInterface
$values = $this->get($databox_field->get_tag()->getTagname())->getValue()->asArray();
- $tmp = array();
+ $tmp = [];
foreach ($values as $value) {
foreach (\caption_field::get_multi_values($value, $databox_field->get_separator()) as $v) {
@@ -60,11 +60,11 @@ class MetadataBag extends ArrayCollection implements MetaBagInterface
$value = $unicode->parseDate($value);
}
- $metas[] = array(
+ $metas[] = [
'meta_struct_id' => $databox_field->get_id(),
'value' => $value,
'meta_id' => null
- );
+ ];
}
} else {
$value = $this->get($databox_field->get_tag()->getTagname())->getValue()->asString();
@@ -75,11 +75,11 @@ class MetadataBag extends ArrayCollection implements MetaBagInterface
$value = $unicode->parseDate($value);
}
- $metas[] = array(
+ $metas[] = [
'meta_struct_id' => $databox_field->get_id(),
'value' => $value,
'meta_id' => null
- );
+ ];
}
}
}
diff --git a/lib/Alchemy/Phrasea/Border/Visa.php b/lib/Alchemy/Phrasea/Border/Visa.php
index b4bde581a7..671e7d60a9 100644
--- a/lib/Alchemy/Phrasea/Border/Visa.php
+++ b/lib/Alchemy/Phrasea/Border/Visa.php
@@ -33,7 +33,7 @@ class Visa
*/
public function __construct()
{
- $this->responses = array();
+ $this->responses = [];
}
/**
diff --git a/lib/Alchemy/Phrasea/Cache/ConnectionFactory.php b/lib/Alchemy/Phrasea/Cache/ConnectionFactory.php
index 2ec5f41e1f..39be32c34d 100644
--- a/lib/Alchemy/Phrasea/Cache/ConnectionFactory.php
+++ b/lib/Alchemy/Phrasea/Cache/ConnectionFactory.php
@@ -15,7 +15,7 @@ use Alchemy\Phrasea\Exception\RuntimeException;
class ConnectionFactory
{
- private $connections = array();
+ private $connections = [];
/**
* Returns a Redis connection.
@@ -26,9 +26,9 @@ class ConnectionFactory
*
* @throws RuntimeException
*/
- public function getRedisConnection(array $options = array())
+ public function getRedisConnection(array $options = [])
{
- $options = array_replace(array('host' => 'localhost', 'port' => 6379), $options);
+ $options = array_replace(['host' => 'localhost', 'port' => 6379], $options);
if (null !== $cache = $this->getConnection('redis', $options)) {
return $cache;
}
@@ -58,9 +58,9 @@ class ConnectionFactory
*
* @throws RuntimeException
*/
- public function getMemcacheConnection(array $options = array())
+ public function getMemcacheConnection(array $options = [])
{
- $options = array_replace(array('host' => 'localhost', 'port' => 11211), $options);
+ $options = array_replace(['host' => 'localhost', 'port' => 11211], $options);
if (null !== $cache = $this->getConnection('memcache', $options)) {
return $cache;
}
@@ -91,9 +91,9 @@ class ConnectionFactory
*
* @throws RuntimeException
*/
- public function getMemcachedConnection(array $options = array())
+ public function getMemcachedConnection(array $options = [])
{
- $options = array_replace(array('host' => 'localhost', 'port' => 11211), $options);
+ $options = array_replace(['host' => 'localhost', 'port' => 11211], $options);
if (null !== $cache = $this->getConnection('memcached', $options)) {
return $cache;
}
diff --git a/lib/Alchemy/Phrasea/Cache/Manager.php b/lib/Alchemy/Phrasea/Cache/Manager.php
index 0ed4ead53d..3a2f830c53 100644
--- a/lib/Alchemy/Phrasea/Cache/Manager.php
+++ b/lib/Alchemy/Phrasea/Cache/Manager.php
@@ -22,8 +22,8 @@ class Manager
private $file;
/** @var Compiler */
private $compiler;
- private $registry = array();
- private $drivers = array();
+ private $registry = [];
+ private $drivers = [];
/** @var Logger */
private $logger;
/** @var Factory */
@@ -37,7 +37,7 @@ class Manager
$this->factory = $factory;
if (!is_file($file)) {
- $this->registry = array();
+ $this->registry = [];
$this->save();
} else {
$this->registry = require $file;
@@ -55,7 +55,7 @@ class Manager
$driver->flushAll();
}
- $this->registry = array();
+ $this->registry = [];
$this->save();
return $this;
@@ -78,7 +78,7 @@ class Manager
$cache = $this->factory->create($name, $options);
} catch (RuntimeException $e) {
$this->logger->error($e->getMessage());
- $cache = $this->factory->create('array', array());
+ $cache = $this->factory->create('array', []);
}
$cache->setNamespace(md5(__DIR__));
diff --git a/lib/Alchemy/Phrasea/Cache/RedisCache.php b/lib/Alchemy/Phrasea/Cache/RedisCache.php
index 58efb346de..e2ecc934e9 100644
--- a/lib/Alchemy/Phrasea/Cache/RedisCache.php
+++ b/lib/Alchemy/Phrasea/Cache/RedisCache.php
@@ -96,13 +96,13 @@ class RedisCache extends CacheProvider implements Cache
{
$stats = $this->_redis->info();
- return array(
+ return [
Cache::STATS_HITS => false,
Cache::STATS_MISSES => false,
Cache::STATS_UPTIME => $stats['uptime_in_seconds'],
Cache::STATS_MEMORY_USAGE => $stats['used_memory'],
Cache::STATS_MEMORY_AVAILIABLE => false,
- );
+ ];
}
/**
diff --git a/lib/Alchemy/Phrasea/Command/BuildMissingSubdefs.php b/lib/Alchemy/Phrasea/Command/BuildMissingSubdefs.php
index 094bdf0c92..939512694c 100644
--- a/lib/Alchemy/Phrasea/Command/BuildMissingSubdefs.php
+++ b/lib/Alchemy/Phrasea/Command/BuildMissingSubdefs.php
@@ -73,7 +73,7 @@ class BuildMissingSubdefs extends Command
if ( ! $record->has_subdef($subdef->get_name())) {
$todo = true;
}
- if (in_array($subdef->get_name(), array('preview', 'thumbnail', 'thumbnailgif'))) {
+ if (in_array($subdef->get_name(), ['preview', 'thumbnail', 'thumbnailgif'])) {
try {
$sub = $record->get_subdef($subdef->get_name());
if ( ! $sub->is_physically_present()) {
@@ -85,7 +85,7 @@ class BuildMissingSubdefs extends Command
}
if ($todo) {
- $record->generate_subdefs($databox, $this->container, array($subdef->get_name()));
+ $record->generate_subdefs($databox, $this->container, [$subdef->get_name()]);
$this->container['monolog']->addInfo("generate " . $subdef->get_name() . " for record " . $record->get_record_id());
$n ++;
}
diff --git a/lib/Alchemy/Phrasea/Command/CheckConfig.php b/lib/Alchemy/Phrasea/Command/CheckConfig.php
index 964c67e048..041356868d 100644
--- a/lib/Alchemy/Phrasea/Command/CheckConfig.php
+++ b/lib/Alchemy/Phrasea/Command/CheckConfig.php
@@ -40,7 +40,7 @@ class CheckConfig extends AbstractCheckCommand
protected function provideRequirements()
{
- return array(
+ return [
BinariesProbe::create($this->container),
CacheServerProbe::create($this->container),
DataboxStructureProbe::create($this->container),
@@ -52,6 +52,6 @@ class CheckConfig extends AbstractCheckCommand
SearchEngineProbe::create($this->container),
SubdefsPathsProbe::create($this->container),
SystemProbe::create($this->container),
- );
+ ];
}
}
diff --git a/lib/Alchemy/Phrasea/Command/CreateCollection.php b/lib/Alchemy/Phrasea/Command/CreateCollection.php
index 76533e12ff..b2d78c3f33 100644
--- a/lib/Alchemy/Phrasea/Command/CreateCollection.php
+++ b/lib/Alchemy/Phrasea/Command/CreateCollection.php
@@ -52,7 +52,7 @@ class CreateCollection extends Command
if ($new_collection && $input->getOption('base_id_rights')) {
$query = new \User_Query($this->container);
- $total = $query->on_base_ids(array($input->getOption('base_id_rights')))->get_total();
+ $total = $query->on_base_ids([$input->getOption('base_id_rights')])->get_total();
$n = 0;
while ($n < $total) {
diff --git a/lib/Alchemy/Phrasea/Command/Developer/AbstractRoutesDumper.php b/lib/Alchemy/Phrasea/Command/Developer/AbstractRoutesDumper.php
index a252d03c17..788bf40f94 100644
--- a/lib/Alchemy/Phrasea/Command/Developer/AbstractRoutesDumper.php
+++ b/lib/Alchemy/Phrasea/Command/Developer/AbstractRoutesDumper.php
@@ -25,7 +25,7 @@ abstract class AbstractRoutesDumper extends Command
$maxNameLength = 0;
$maxMethodsLength = 0;
- $data = array();
+ $data = [];
foreach ($routes as $name => $route) {
$methods = implode('|', $route->getMethods());
@@ -40,12 +40,12 @@ abstract class AbstractRoutesDumper extends Command
$warning = true;
}
- $data[] = array(
+ $data[] = [
'name' => $name,
'methods' => $methods ?: 'ALL',
'pattern' => $pattern,
'warning' => $warning
- );
+ ];
}
foreach ($data as $route) {
diff --git a/lib/Alchemy/Phrasea/Command/Developer/BowerInstall.php b/lib/Alchemy/Phrasea/Command/Developer/BowerInstall.php
index c684b1034d..95afa2df82 100644
--- a/lib/Alchemy/Phrasea/Command/Developer/BowerInstall.php
+++ b/lib/Alchemy/Phrasea/Command/Developer/BowerInstall.php
@@ -59,7 +59,7 @@ class BowerInstall extends Command
if ($input->getOption('clear-cache')) {
$output->write("Cleaning bower cache... ");
- $bower->command(array('cache', 'clean'));
+ $bower->command(['cache', 'clean']);
$output->writeln("
' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') . '
' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '
', 'titre' => _('publications::votre rss personnel') - ); + ]; return $app->json($output); })->bind('prod_feeds_subscribe_aggregated'); @@ -268,12 +268,12 @@ class Feed implements ControllerProviderInterface } $link = $app['feed.user-link-generator']->generate($feed, $app['authentication']->getUser(), FeedLinkGenerator::FORMAT_RSS, null, $renew); - $output = array( + $output = [ 'texte' => '' . _('publication::Voici votre fil RSS personnel. Il vous permettra d\'etre tenu au courrant des publications.') . '
' . _('publications::Ne le partagez pas, il est strictement confidentiel') . '
', 'titre' => _('publications::votre rss personnel') - ); + ]; return $app->json($output); }) diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Language.php b/lib/Alchemy/Phrasea/Controller/Prod/Language.php index ea50197e9d..5ff3b4d10f 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Language.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Language.php @@ -29,7 +29,7 @@ class Language implements ControllerProviderInterface $controller->get("/", function (Application $app) { - $out = array(); + $out = []; $out['thesaurusBasesChanged'] = _('prod::recherche: Attention : la liste des bases selectionnees pour la recherche a ete changee.'); $out['confirmDel'] = _('paniers::Vous etes sur le point de supprimer ce panier. Cette action est irreversible. Souhaitez-vous continuer ?'); $out['serverError'] = _('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique'); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php index b4bcf78643..2e44ab203d 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Lazaret.php @@ -87,7 +87,7 @@ class Lazaret implements ControllerProviderInterface */ public function listElement(Application $app, Request $request) { - $baseIds = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(array('canaddrecord'))); + $baseIds = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(['canaddrecord'])); $lazaretFiles = null; @@ -100,7 +100,7 @@ class Lazaret implements ControllerProviderInterface } return $app['twig']->render( - 'prod/upload/lazaret.html.twig', array('lazaretFiles' => $lazaretFiles) + 'prod/upload/lazaret.html.twig', ['lazaretFiles' => $lazaretFiles] ); } @@ -115,7 +115,7 @@ class Lazaret implements ControllerProviderInterface */ public function getElement(Application $app, Request $request, $file_id) { - $ret = array('success' => false, 'message' => '', 'result' => array()); + $ret = ['success' => false, 'message' => '', 'result' => []]; $lazaretFile = $app['EM']->find('Alchemy\Phrasea\Model\Entities\LazaretFile', $file_id); @@ -126,7 +126,7 @@ class Lazaret implements ControllerProviderInterface return $app->json($ret); } - $file = array( + $file = [ 'filename' => $lazaretFile->getOriginalName(), 'base_id' => $lazaretFile->getBaseId(), 'created' => $lazaretFile->getCreated()->format(\DateTime::ATOM), @@ -134,7 +134,7 @@ class Lazaret implements ControllerProviderInterface 'pathname' => $app['root.path'] . '/tmp/lazaret/' . $lazaretFile->getFilename(), 'sha256' => $lazaretFile->getSha256(), 'uuid' => $lazaretFile->getUuid(), - ); + ]; $ret['result'] = $file; $ret['success'] = true; @@ -157,11 +157,11 @@ class Lazaret implements ControllerProviderInterface */ public function addElement(Application $app, Request $request, $file_id) { - $ret = array('success' => false, 'message' => '', 'result' => array()); + $ret = ['success' => false, 'message' => '', 'result' => []]; //Optional parameter $keepAttributes = !!$request->request->get('keep_attributes', false); - $attributesToKeep = $request->request->get('attributes', array()); + $attributesToKeep = $request->request->get('attributes', []); //Mandatory parameter if (null === $request->request->get('bas_id')) { @@ -258,7 +258,7 @@ class Lazaret implements ControllerProviderInterface } try { - $app['filesystem']->remove(array($lazaretFileName, $lazaretThumbFileName)); + $app['filesystem']->remove([$lazaretFileName, $lazaretThumbFileName]); } catch (IOException $e) { } @@ -277,7 +277,7 @@ class Lazaret implements ControllerProviderInterface */ public function denyElement(Application $app, Request $request, $file_id) { - $ret = array('success' => false, 'message' => '', 'result' => array()); + $ret = ['success' => false, 'message' => '', 'result' => []]; $lazaretFile = $app['EM']->find('Alchemy\Phrasea\Model\Entities\LazaretFile', $file_id); /* @var $lazaretFile LazaretFile */ @@ -306,7 +306,7 @@ class Lazaret implements ControllerProviderInterface $app['EM']->flush(); try { - $app['filesystem']->remove(array($lazaretFileName, $lazaretThumbFileName)); + $app['filesystem']->remove([$lazaretFileName, $lazaretThumbFileName]); } catch (IOException $e) { } @@ -324,7 +324,7 @@ class Lazaret implements ControllerProviderInterface */ public function emptyLazaret(Application $app, Request $request) { - $ret = array('success' => false, 'message' => '', 'result' => array()); + $ret = ['success' => false, 'message' => '', 'result' => []]; $lazaretFiles = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\LazaretFile')->findAll(); @@ -355,7 +355,7 @@ class Lazaret implements ControllerProviderInterface */ public function acceptElement(Application $app, Request $request, $file_id) { - $ret = array('success' => false, 'message' => '', 'result' => array()); + $ret = ['success' => false, 'message' => '', 'result' => []]; //Mandatory parameter if (null === $recordId = $request->request->get('record_id')) { @@ -416,7 +416,7 @@ class Lazaret implements ControllerProviderInterface } try { - $app['filesystem']->remove(array($lazaretFileName, $lazaretThumbFileName)); + $app['filesystem']->remove([$lazaretFileName, $lazaretThumbFileName]); } catch (IOException $e) { } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php index 683fb75e92..507d125bc0 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/MoveCollection.php @@ -46,32 +46,32 @@ class MoveCollection implements ControllerProviderInterface public function displayForm(Application $app, Request $request) { - $records = RecordsRequest::fromRequest($app, $request, false, array('candeleterecord')); + $records = RecordsRequest::fromRequest($app, $request, false, ['candeleterecord']); $sbas_ids = array_map(function (\databox $databox) { return $databox->get_sbas_id(); }, $records->databoxes()); $collections = $app['acl']->get($app['authentication']->getUser()) - ->get_granted_base(array('canaddrecord'), $sbas_ids); + ->get_granted_base(['canaddrecord'], $sbas_ids); - $parameters = array( + $parameters = [ 'records' => $records, 'message' => '', 'collections' => $collections, - ); + ]; return $app['twig']->render('prod/actions/collection_default.html.twig', $parameters); } public function apply(Application $app, Request $request) { - $records = RecordsRequest::fromRequest($app, $request, false, array('candeleterecord')); + $records = RecordsRequest::fromRequest($app, $request, false, ['candeleterecord']); - $datas = array( + $datas = [ 'success' => false, 'message' => '', - ); + ]; try { if (null === $request->request->get('base_id')) { @@ -106,15 +106,15 @@ class MoveCollection implements ControllerProviderInterface } } - $ret = array( + $ret = [ 'success' => true, 'message' => _('Records have been successfuly moved'), - ); + ]; } catch (\Exception $e) { - $ret = array( + $ret = [ 'success' => false, 'message' => _('An error occured'), - ); + ]; } return $app->json($ret); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Order.php b/lib/Alchemy/Phrasea/Controller/Prod/Order.php index 917992ffc5..0ca4ef6fac 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Order.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Order.php @@ -91,10 +91,10 @@ class Order implements ControllerProviderInterface { $success = false; $collectionHasOrderAdmins = new ArrayCollection(); - $toRemove = array(); + $toRemove = []; - $records = RecordsRequest::fromRequest($app, $request, true, array('cancmd')); - $hasOneAdmin = array(); + $records = RecordsRequest::fromRequest($app, $request, true, ['cancmd']); + $hasOneAdmin = []; if (!$records->isEmpty()) { $order = new OrderEntity(); @@ -110,8 +110,8 @@ class Order implements ControllerProviderInterface if (!isset($hasOneAdmin[$record->get_base_id()])) { $query = new \User_Query($app); - $hasOneAdmin[$record->get_base_id()] = (Boolean) count($query->on_base_ids(array($record->get_base_id())) - ->who_have_right(array('order_master')) + $hasOneAdmin[$record->get_base_id()] = (Boolean) count($query->on_base_ids([$record->get_base_id()]) + ->who_have_right(['order_master']) ->execute()->get_results()); } @@ -146,10 +146,10 @@ class Order implements ControllerProviderInterface $order->setTodo($order->getElements()->count()); try { - $app['events-manager']->trigger('__NEW_ORDER__', array( + $app['events-manager']->trigger('__NEW_ORDER__', [ 'order_id' => $order->getId(), 'usr_id' => $order->getUsrId() - )); + ]); $success = true; $app['EM']->persist($order); @@ -168,16 +168,16 @@ class Order implements ControllerProviderInterface } if ('json' === $app['request']->getRequestFormat()) { - return $app->json(array( + return $app->json([ 'success' => $success, 'msg' => $msg, - )); + ]); } - return $app->redirectPath('prod_orders', array( + return $app->redirectPath('prod_orders', [ 'success' => (int) $success, 'action' => 'send' - )); + ]); } /** @@ -195,19 +195,19 @@ class Order implements ControllerProviderInterface $perPage = (int) $request->query->get('per-page', 10); $sort = $request->query->get('sort'); - $baseIds = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(array('order_master'))); + $baseIds = array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(['order_master'])); $ordersList = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Order')->listOrders($baseIds, $offsetStart, $perPage, $sort); $total = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Order')->countTotalOrders($baseIds); - return $app['twig']->render('prod/orders/order_box.html.twig', array( + return $app['twig']->render('prod/orders/order_box.html.twig', [ 'page' => $page, 'perPage' => $perPage, 'total' => $total, 'previousPage' => $page < 2 ? false : ($page - 1), 'nextPage' => $page >= ceil($total / $perPage) ? false : $page + 1, 'orders' => new ArrayCollection($ordersList) - )); + ]); } /** @@ -225,9 +225,9 @@ class Order implements ControllerProviderInterface throw new NotFoundHttpException('Order not found'); } - return $app['twig']->render('prod/orders/order_item.html.twig', array( + return $app['twig']->render('prod/orders/order_item.html.twig', [ 'order' => $order - )); + ]); } /** @@ -261,7 +261,7 @@ class Order implements ControllerProviderInterface } $n = 0; - $elements = $request->request->get('elements', array()); + $elements = $request->request->get('elements', []); foreach ($order->getElements() as $orderElement) { if (in_array($orderElement->getId(), $elements)) { $sbas_id = \phrasea::sbasFromBas($app, $orderElement->getBaseId()); @@ -286,12 +286,12 @@ class Order implements ControllerProviderInterface if ($n > 0) { $order->setTodo($order->getTodo() - $n); - $app['events-manager']->trigger('__ORDER_DELIVER__', array( + $app['events-manager']->trigger('__ORDER_DELIVER__', [ 'ssel_id' => $order->getBasket()->getId(), 'from' => $app['authentication']->getUser()->get_id(), 'to' => $dest_user->get_id(), 'n' => $n - )); + ]); } $success = true; @@ -304,17 +304,17 @@ class Order implements ControllerProviderInterface } if ('json' === $app['request']->getRequestFormat()) { - return $app->json(array( + return $app->json([ 'success' => $success, 'msg' => $success ? _('Order has been sent') : _('An error occured while sending, please retry or contact an admin if problem persists'), 'order_id' => $order_id - )); + ]); } - return $app->redirectPath('prod_orders', array( + return $app->redirectPath('prod_orders', [ 'success' => (int) $success, 'action' => 'send' - )); + ]); } /** @@ -334,7 +334,7 @@ class Order implements ControllerProviderInterface } $n = 0; - $elements = $request->request->get('elements', array()); + $elements = $request->request->get('elements', []); foreach ($order->getElements() as $orderElement) { if (in_array($orderElement->getId(),$elements)) { $orderElement->setOrderMasterId($app['authentication']->getUser()->get_id()); @@ -349,11 +349,11 @@ class Order implements ControllerProviderInterface if ($n > 0) { $order->setTodo($order->getTodo() - $n); - $app['events-manager']->trigger('__ORDER_NOT_DELIVERED__', array( + $app['events-manager']->trigger('__ORDER_NOT_DELIVERED__', [ 'from' => $app['authentication']->getUser()->get_id(), 'to' => $order->getUsrId(), 'n' => $n - )); + ]); } $success = true; @@ -364,16 +364,16 @@ class Order implements ControllerProviderInterface } if ('json' === $app['request']->getRequestFormat()) { - return $app->json(array( + return $app->json([ 'success' => $success, 'msg' => $success ? _('Order has been denied') : _('An error occured while denying, please retry or contact an admin if problem persists'), 'order_id' => $order_id - )); + ]); } - return $app->redirectPath('prod_orders', array( + return $app->redirectPath('prod_orders', [ 'success' => (int) $success, 'action' => 'send' - )); + ]); } } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Printer.php b/lib/Alchemy/Phrasea/Controller/Prod/Printer.php index c9f1e96213..269b2532b4 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Printer.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Printer.php @@ -33,7 +33,7 @@ class Printer implements ControllerProviderInterface $controllers->post('/', function (Application $app) { $printer = new RecordHelper\Printer($app, $app['request']); - return $app['twig']->render('prod/actions/printer_default.html.twig', array('printer' => $printer, 'message' => '')); + return $app['twig']->render('prod/actions/printer_default.html.twig', ['printer' => $printer, 'message' => '']); } ); @@ -50,7 +50,7 @@ class Printer implements ControllerProviderInterface } $PDF = new PDFExport($app, $printer->get_elements(), $layout); - $response = new Response($PDF->render(), 200, array('Content-Type' => 'application/pdf')); + $response = new Response($PDF->render(), 200, ['Content-Type' => 'application/pdf']); $response->headers->set('Pragma', 'public', true); $response->setMaxAge(0); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Property.php b/lib/Alchemy/Phrasea/Controller/Prod/Property.php index 96f581c5d8..bd0cb4419e 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Property.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Property.php @@ -61,16 +61,16 @@ class Property implements ControllerProviderInterface $app->abort(400); } - $records = RecordsRequest::fromRequest($app, $request, false, array('chgstatus')); + $records = RecordsRequest::fromRequest($app, $request, false, ['chgstatus']); $databoxStatus = \databox_status::getDisplayStatus($app); - $statusBit = $nRec = array(); + $statusBit = $nRec = []; foreach ($records as $record) { //perform logic $sbasId = $record->get_databox()->get_sbas_id(); if (!isset($nRec[$sbasId])) { - $nRec[$sbasId] = array('stories' => 0, 'records' => 0); + $nRec[$sbasId] = ['stories' => 0, 'records' => 0]; } $nRec[$sbasId]['records']++; @@ -80,7 +80,7 @@ class Property implements ControllerProviderInterface } if (!isset($statusBit[$sbasId])) { - $statusBit[$sbasId] = isset($databoxStatus[$sbasId]) ? $databoxStatus[$sbasId] : array(); + $statusBit[$sbasId] = isset($databoxStatus[$sbasId]) ? $databoxStatus[$sbasId] : []; foreach (array_keys($statusBit[$sbasId]) as $bit) { $statusBit[$sbasId][$bit]['nset'] = 0; @@ -101,11 +101,11 @@ class Property implements ControllerProviderInterface } } - return new Response($app['twig']->render('prod/actions/Property/index.html.twig', array( + return new Response($app['twig']->render('prod/actions/Property/index.html.twig', [ 'records' => $records, 'statusBit' => $statusBit, 'nRec' => $nRec - ))); + ])); } /** @@ -121,29 +121,29 @@ class Property implements ControllerProviderInterface $app->abort(400); } - $records = RecordsRequest::fromRequest($app, $request, false, array('canmodifrecord')); + $records = RecordsRequest::fromRequest($app, $request, false, ['canmodifrecord']); - $recordsType = array(); + $recordsType = []; foreach ($records as $record) { //perform logic $sbasId = $record->get_databox()->get_sbas_id(); if (!isset($recordsType[$sbasId])) { - $recordsType[$sbasId] = array(); + $recordsType[$sbasId] = []; } if (!isset($recordsType[$sbasId][$record->get_type()])) { - $recordsType[$sbasId][$record->get_type()] = array(); + $recordsType[$sbasId][$record->get_type()] = []; } $recordsType[$sbasId][$record->get_type()][] = $record; } - return new Response($app['twig']->render('prod/actions/Property/type.html.twig', array( + return new Response($app['twig']->render('prod/actions/Property/type.html.twig', [ 'records' => $records, 'recordsType' => $recordsType, - ))); + ])); } /** @@ -155,9 +155,9 @@ class Property implements ControllerProviderInterface */ public function changeStatus(Application $app, Request $request) { - $applyStatusToChildren = $request->request->get('apply_to_children', array()); - $records = RecordsRequest::fromRequest($app, $request, false, array('chgstatus')); - $updated = array(); + $applyStatusToChildren = $request->request->get('apply_to_children', []); + $records = RecordsRequest::fromRequest($app, $request, false, ['chgstatus']); + $updated = []; $postStatus = (array) $request->request->get('status'); foreach ($records as $record) { @@ -178,7 +178,7 @@ class Property implements ControllerProviderInterface } } - return $app->json(array('success' => true, 'updated' => $updated), 201); + return $app->json(['success' => true, 'updated' => $updated], 201); } /** @@ -190,10 +190,10 @@ class Property implements ControllerProviderInterface */ public function changeType(Application $app, Request $request) { - $typeLst = $request->request->get('types', array()); - $records = RecordsRequest::fromRequest($app, $request, false, array('canmodifrecord')); + $typeLst = $request->request->get('types', []); + $records = RecordsRequest::fromRequest($app, $request, false, ['canmodifrecord']); $forceType = $request->request->get('force_types', ''); - $updated = array(); + $updated = []; foreach ($records as $record) { try { @@ -208,7 +208,7 @@ class Property implements ControllerProviderInterface } } - return $app->json(array('success' => true, 'updated' => $updated), 201); + return $app->json(['success' => true, 'updated' => $updated], 201); } /** @@ -233,10 +233,10 @@ class Property implements ControllerProviderInterface $record->set_binary_status(strrev($newStatus)); - return array( + return [ 'current_status' => $currentStatus, 'new_status' => $newStatus - ); + ]; } return null; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Push.php b/lib/Alchemy/Phrasea/Controller/Prod/Push.php index bbc3690555..98ec635cc3 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Push.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Push.php @@ -36,9 +36,9 @@ class Push implements ControllerProviderInterface protected function getUserFormatter() { return function (\User_Adapter $user) { - $subtitle = array_filter(array($user->get_job(), $user->get_company())); + $subtitle = array_filter([$user->get_job(), $user->get_company()]); - return array( + return [ 'type' => 'USER' , 'usr_id' => $user->get_id() , 'firstname' => $user->get_firstname() @@ -46,7 +46,7 @@ class Push implements ControllerProviderInterface , 'email' => $user->get_email() , 'display_name' => $user->get_display_name() , 'subtitle' => implode(', ', $subtitle) - ); + ]; }; } @@ -55,23 +55,23 @@ class Push implements ControllerProviderInterface $userFormatter = $this->getUserFormatter(); return function (UsrList $List) use ($userFormatter, $app) { - $entries = array(); + $entries = []; foreach ($List->getEntries() as $entry) { /* @var $entry UsrListEntry */ - $entries[] = array( + $entries[] = [ 'Id' => $entry->getId(), 'User' => $userFormatter($entry->getUser($app)) - ); + ]; } - return array( + return [ 'type' => 'LIST' , 'list_id' => $List->getId() , 'name' => $List->getName() , 'length' => count($entries) , 'entries' => $entries - ); + ]; }; } @@ -125,13 +125,13 @@ class Push implements ControllerProviderInterface $RecommendedUsers = $userSelection($push->get_elements()); - $params = array( + $params = [ 'push' => $push, 'message' => '', 'lists' => $repository->findUserLists($app['authentication']->getUser()), 'context' => 'Push', 'RecommendedUsers' => $RecommendedUsers - ); + ]; return $app['twig']->render('prod/actions/Push.html.twig', $params); }); @@ -143,13 +143,13 @@ class Push implements ControllerProviderInterface $RecommendedUsers = $userSelection($push->get_elements()); - $params = array( + $params = [ 'push' => $push, 'message' => '', 'lists' => $repository->findUserLists($app['authentication']->getUser()), 'context' => 'Feedback', 'RecommendedUsers' => $RecommendedUsers - ); + ]; return $app['twig']->render('prod/actions/Push.html.twig', $params); }); @@ -157,10 +157,10 @@ class Push implements ControllerProviderInterface $controllers->post('/send/', function (Application $app) { $request = $app['request']; - $ret = array( + $ret = [ 'success' => false, 'message' => _('Unable to send the documents') - ); + ]; try { $pusher = new RecordHelper\Push($app, $app['request']); @@ -220,7 +220,7 @@ class Push implements ControllerProviderInterface $app['EM']->flush(); - $url = $app->url('lightbox_compare', array( + $url = $app->url('lightbox_compare', [ 'basket' => $Basket->getId(), 'LOG' => $app['tokens']->getUrlToken( \random::TYPE_VIEW, @@ -228,11 +228,11 @@ class Push implements ControllerProviderInterface null, $Basket->getId() ) - )); + ]); $receipt = $request->get('recept') ? $app['authentication']->getUser()->get_email() : ''; - $params = array( + $params = [ 'from' => $app['authentication']->getUser()->get_id() , 'from_email' => $app['authentication']->getUser()->get_email() , 'to' => $user_receiver->get_id() @@ -242,7 +242,7 @@ class Push implements ControllerProviderInterface , 'accuse' => $receipt , 'message' => $request->request->get('message') , 'ssel_id' => $Basket->getId() - ); + ]; $app['events-manager']->trigger('__PUSH_DATAS__', $params); } @@ -258,10 +258,10 @@ class Push implements ControllerProviderInterface , count($receivers) ); - $ret = array( + $ret = [ 'success' => true, 'message' => $message - ); + ]; } catch (ControllerException $e) { $ret['message'] = $e->getMessage() . $e->getFile() . $e->getLine(); } @@ -272,10 +272,10 @@ class Push implements ControllerProviderInterface $controllers->post('/validate/', function (Application $app) { $request = $app['request']; - $ret = array( + $ret = [ 'success' => false, 'message' => _('Unable to send the documents') - ); + ]; $app['EM']->beginTransaction(); @@ -349,16 +349,16 @@ class Push implements ControllerProviderInterface } if (!$found) { - $participants[$app['authentication']->getUser()->get_id()] = array( + $participants[$app['authentication']->getUser()->get_id()] = [ 'see_others' => 1, 'usr_id' => $app['authentication']->getUser()->get_id(), 'agree' => 0, 'HD' => 0 - ); + ]; } foreach ($participants as $key => $participant) { - foreach (array('see_others', 'usr_id', 'agree', 'HD') as $mandatoryparam) { + foreach (['see_others', 'usr_id', 'agree', 'HD'] as $mandatoryparam) { if (!array_key_exists($mandatoryparam, $participant)) throw new ControllerException(sprintf(_('Missing mandatory parameter %s'), $mandatoryparam)); } @@ -418,7 +418,7 @@ class Push implements ControllerProviderInterface $app['EM']->flush(); - $url = $app->url('lightbox_validation', array( + $url = $app->url('lightbox_validation', [ 'basket' => $Basket->getId(), 'LOG' => $app['tokens']->getUrlToken( \random::TYPE_VALIDATE, @@ -426,11 +426,11 @@ class Push implements ControllerProviderInterface null, $Basket->getId() ) - )); + ]); $receipt = $request->get('recept') ? $app['authentication']->getUser()->get_email() : ''; - $params = array( + $params = [ 'from' => $app['authentication']->getUser()->get_id(), 'from_email' => $app['authentication']->getUser()->get_email(), 'to' => $participant_user->get_id(), @@ -441,7 +441,7 @@ class Push implements ControllerProviderInterface 'message' => $request->request->get('message'), 'ssel_id' => $Basket->getId(), 'duration' => (int) $request->request->get('duration'), - ); + ]; $app['events-manager']->trigger('__PUSH_VALIDATION__', $params); } @@ -457,10 +457,10 @@ class Push implements ControllerProviderInterface , count($request->request->get('participants')) ); - $ret = array( + $ret = [ 'success' => true, 'message' => $message - ); + ]; $app['EM']->commit(); } catch (ControllerException $e) { @@ -478,9 +478,9 @@ class Push implements ControllerProviderInterface $query = new \User_Query($app); - $query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), array('canpush')); + $query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), ['canpush']); - $query->in(array($usr_id)); + $query->in([$usr_id]); $result = $query->include_phantoms() ->limit(0, 1) @@ -512,7 +512,7 @@ class Push implements ControllerProviderInterface ->assert('list_id', '\d+'); $controllers->post('/add-user/', function (Application $app, Request $request) use ($userFormatter) { - $result = array('success' => false, 'message' => '', 'user' => null); + $result = ['success' => false, 'message' => '', 'user' => null]; try { if (!$app['acl']->get($app['authentication']->getUser())->has_right('manageusers')) @@ -577,7 +577,7 @@ class Push implements ControllerProviderInterface })->bind('prod_push_do_add_user'); $controllers->get('/add-user/', function (Application $app, Request $request) { - $params = array('callback' => $request->query->get('callback')); + $params = ['callback' => $request->query->get('callback')]; return $app['twig']->render('prod/User/Add.html.twig', $params); })->bind('prod_push_add_user'); @@ -587,7 +587,7 @@ class Push implements ControllerProviderInterface $query = new \User_Query($app); - $query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), array('canpush')); + $query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), ['canpush']); $query->like(\User_Query::LIKE_FIRSTNAME, $request->query->get('query')) ->like(\User_Query::LIKE_LASTNAME, $request->query->get('query')) @@ -602,7 +602,7 @@ class Push implements ControllerProviderInterface $lists = $repository->findUserListLike($app['authentication']->getUser(), $request->query->get('query')); - $datas = array(); + $datas = []; if ($lists) { foreach ($lists as $list) { @@ -627,7 +627,7 @@ class Push implements ControllerProviderInterface $query = new \User_Query($app); - $query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), array('canpush')); + $query->on_bases_where_i_am($app['acl']->get($app['authentication']->getUser()), ['canpush']); if ($request->get('query')) { $query->like($request->get('like_field'), $request->get('query')) @@ -661,13 +661,13 @@ class Push implements ControllerProviderInterface ->limit($offset_start, $perPage) ->execute()->get_results(); - $params = array( + $params = [ 'query' => $query , 'results' => $results , 'list' => $list , 'sort' => $sort , 'ord' => $ord - ); + ]; if ($request->get('type') === 'fragment') { return new Response( diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Query.php b/lib/Alchemy/Phrasea/Controller/Prod/Query.php index 437e7efcd8..113f3036bd 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Query.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Query.php @@ -61,7 +61,7 @@ class Query implements ControllerProviderInterface $mod = $app['authentication']->getUser()->getPrefs('view'); - $json = array(); + $json = []; $options = SearchEngineOptions::fromRequest($app, $request); @@ -196,12 +196,12 @@ class Query implements ControllerProviderInterface } } - $json['results'] = $app['twig']->render($template, array( + $json['results'] = $app['twig']->render($template, [ 'results' => $result, 'highlight' => $result->getQuery(), 'searchEngine' => $app['phraseanet.SE'], 'suggestions' => $prop - ) + ] ); $json['query'] = $query; @@ -239,12 +239,12 @@ class Query implements ControllerProviderInterface $record = new \record_preview($app, 'RESULT', $pos, '', $app['phraseanet.SE'], $query); - return $app->json(array( - 'current' => $app['twig']->render('prod/preview/result_train.html.twig', array( + return $app->json([ + 'current' => $app['twig']->render('prod/preview/result_train.html.twig', [ 'records' => $record->get_train($pos, $query, $app['phraseanet.SE']), 'selected' => $pos - )) - )); + ]) + ]); } /** @@ -258,9 +258,9 @@ class Query implements ControllerProviderInterface { $record = new \record_preview($app, 'REG', $request->request->get('pos'), $request->request->get('cont')); - return new Response($app['twig']->render('prod/preview/reg_train.html.twig', array( + return new Response($app['twig']->render('prod/preview/reg_train.html.twig', [ 'container_records' => $record->get_container()->get_children(), 'record' => $record - ))); + ])); } } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Records.php b/lib/Alchemy/Phrasea/Controller/Prod/Records.php index 6a9551fb16..ce8309f590 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Records.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Records.php @@ -96,48 +96,48 @@ class Records implements ControllerProviderInterface if ($record->is_from_reg()) { $train = $app['twig']->render('prod/preview/reg_train.html.twig', - array('record' => $record) + ['record' => $record] ); } if ($record->is_from_basket() && $reloadTrain) { $train = $app['twig']->render('prod/preview/basket_train.html.twig', - array('record' => $record) + ['record' => $record] ); } if ($record->is_from_feed()) { $train = $app['twig']->render('prod/preview/feed_train.html.twig', - array('record' => $record) + ['record' => $record] ); } - return $app->json(array( - "desc" => $app['twig']->render('prod/preview/caption.html.twig', array( + return $app->json([ + "desc" => $app['twig']->render('prod/preview/caption.html.twig', [ 'record' => $record, 'highlight' => $query, 'searchEngine' => $searchEngine - )), - "html_preview" => $app['twig']->render('common/preview.html.twig', array( + ]), + "html_preview" => $app['twig']->render('common/preview.html.twig', [ 'record' => $record - )), - "others" => $app['twig']->render('prod/preview/appears_in.html.twig', array( + ]), + "others" => $app['twig']->render('prod/preview/appears_in.html.twig', [ 'parents' => $record->get_grouping_parents(), 'baskets' => $record->get_container_baskets($app['EM'], $app['authentication']->getUser()) - )), + ]), "current" => $train, - "history" => $app['twig']->render('prod/preview/short_history.html.twig', array( + "history" => $app['twig']->render('prod/preview/short_history.html.twig', [ 'record' => $record - )), - "popularity" => $app['twig']->render('prod/preview/popularity.html.twig', array( + ]), + "popularity" => $app['twig']->render('prod/preview/popularity.html.twig', [ 'record' => $record - )), - "tools" => $app['twig']->render('prod/preview/tools.html.twig', array( + ]), + "tools" => $app['twig']->render('prod/preview/tools.html.twig', [ 'record' => $record - )), + ]), "pos" => $record->get_number(), "title" => $record->get_title($query, $searchEngine) - )); + ]); } /** @@ -149,14 +149,14 @@ class Records implements ControllerProviderInterface */ public function doDeleteRecords(Application $app, Request $request) { - $records = RecordsRequest::fromRequest($app, $request, !!$request->request->get('del_children'), array( + $records = RecordsRequest::fromRequest($app, $request, !!$request->request->get('del_children'), [ 'candeleterecord' - )); + ]); $basketElementsRepository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\BasketElement'); $StoryWZRepository = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\StoryWZ'); - $deleted = array(); + $deleted = []; foreach ($records as $record) { try { @@ -194,13 +194,13 @@ class Records implements ControllerProviderInterface */ public function whatCanIDelete(Application $app, Request $request) { - $records = RecordsRequest::fromRequest($app, $request, !!$request->request->get('del_children'), array( + $records = RecordsRequest::fromRequest($app, $request, !!$request->request->get('del_children'), [ 'candeleterecord' - )); + ]); - return $app['twig']->render('prod/actions/delete_records_confirm.html.twig', array( + return $app['twig']->render('prod/actions/delete_records_confirm.html.twig', [ 'records' => $records - )); + ]); } /** @@ -215,7 +215,7 @@ class Records implements ControllerProviderInterface { $records = RecordsRequest::fromRequest($app, $request, !!$request->request->get('renew_children_url')); - $renewed = array(); + $renewed = []; foreach ($records as $record) { $renewed[$record->get_serialize_key()] = $record->get_preview()->renew_url(); }; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Root.php b/lib/Alchemy/Phrasea/Controller/Prod/Root.php index 512fe9018d..dd310cb6b3 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Root.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Root.php @@ -50,7 +50,7 @@ class Root implements ControllerProviderInterface $cssPath = $app['root.path'] . '/www/skins/prod/'; - $css = array(); + $css = []; $cssfile = false; $finder = new Finder(); @@ -87,25 +87,25 @@ class Root implements ControllerProviderInterface $queries_topics = \queries::tree_topics($app['locale.I18n']); } - $sbas = $bas2sbas = array(); + $sbas = $bas2sbas = []; foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) { $sbas_id = $databox->get_sbas_id(); - $sbas['s' + $sbas_id] = array( + $sbas['s' + $sbas_id] = [ 'sbid' => $sbas_id, - 'seeker' => null); + 'seeker' => null]; foreach ($databox->get_collections() as $coll) { - $bas2sbas['b' . $coll->get_base_id()] = array( + $bas2sbas['b' . $coll->get_base_id()] = [ 'sbid' => $sbas_id, - 'ckobj' => array('checked' => false), + 'ckobj' => ['checked' => false], 'waschecked' => false - ); + ]; } } - return $app['twig']->render('prod/index.html.twig', array( + return $app['twig']->render('prod/index.html.twig', [ 'module_name' => 'Production', 'WorkZone' => new Helper\WorkZone($app, $app['request']), 'module_prod' => new Helper\Prod($app, $app['request']), @@ -127,7 +127,7 @@ class Root implements ControllerProviderInterface 'thesau_json_sbas' => json_encode($sbas), 'thesau_json_bas2sbas' => json_encode($bas2sbas), 'thesau_languages' => $app['locales.available'], - )); + ]); })->bind('prod'); return $controllers; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Share.php b/lib/Alchemy/Phrasea/Controller/Prod/Share.php index 1748c10e97..1aa55942a6 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Share.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Share.php @@ -57,8 +57,8 @@ class Share implements ControllerProviderInterface $app->abort(403); } - return new Response($app['twig']->render('prod/Share/record.html.twig', array( + return new Response($app['twig']->render('prod/Share/record.html.twig', [ 'record' => $record, - ))); + ])); } } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Story.php b/lib/Alchemy/Phrasea/Controller/Prod/Story.php index 5d09f80222..c8215f74cb 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Story.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Story.php @@ -38,7 +38,7 @@ class Story implements ControllerProviderInterface }); $controllers->get('/create/', function (Application $app) { - return $app['twig']->render('prod/Story/Create.html.twig', array()); + return $app['twig']->render('prod/Story/Create.html.twig', []); })->bind('prod_stories_create'); $controllers->post('/', function (Application $app, Request $request) { @@ -61,7 +61,7 @@ class Story implements ControllerProviderInterface $Story->appendChild($record); } - $metadatas = array(); + $metadatas = []; foreach ($collection->get_databox()->get_meta_structure() as $meta) { if ($meta->get_thumbtitle()) { @@ -70,11 +70,11 @@ class Story implements ControllerProviderInterface continue; } - $metadatas[] = array( + $metadatas[] = [ 'meta_struct_id' => $meta->get_id() , 'meta_id' => null , 'value' => $value - ); + ]; break; } @@ -90,29 +90,29 @@ class Story implements ControllerProviderInterface $app['EM']->flush(); if ($request->getRequestFormat() == 'json') { - $data = array( + $data = [ 'success' => true , 'message' => _('Story created') , 'WorkZone' => $StoryWZ->getId() - , 'story' => array( + , 'story' => [ 'sbas_id' => $Story->get_sbas_id(), 'record_id' => $Story->get_record_id(), - ) - ); + ] + ]; return $app->json($data); } else { - return $app->redirectPath('prod_stories_story', array( + return $app->redirectPath('prod_stories_story', [ 'sbas_id' => $StoryWZ->getSbasId(), 'record_id' => $StoryWZ->getRecordId(), - )); + ]); } })->bind('prod_stories_do_create'); $controllers->get('/{sbas_id}/{record_id}/', function (Application $app, $sbas_id, $record_id) { $Story = new \record_adapter($app, $sbas_id, $record_id); - $html = $app['twig']->render('prod/WorkZone/Story.html.twig', array('Story' => $Story)); + $html = $app['twig']->render('prod/WorkZone/Story.html.twig', ['Story' => $Story]); return new Response($html); }) @@ -139,15 +139,15 @@ class Story implements ControllerProviderInterface $n++; } - $data = array( + $data = [ 'success' => true , 'message' => sprintf(_('%d records added'), $n) - ); + ]; if ($request->getRequestFormat() == 'json') { return $app->json($data); } else { - return $app->redirectPath('prod_stories_story', array('sbas_id' => $sbas_id,'record_id' => $record_id)); + return $app->redirectPath('prod_stories_story', ['sbas_id' => $sbas_id,'record_id' => $record_id]); } })->assert('sbas_id', '\d+')->assert('record_id', '\d+'); @@ -161,15 +161,15 @@ class Story implements ControllerProviderInterface $Story->removeChild($record); - $data = array( + $data = [ 'success' => true , 'message' => _('Record removed from story') - ); + ]; if ($request->getRequestFormat() == 'json') { return $app->json($data); } else { - return $app->redirectPath('prod_stories_story', array('sbas_id' => $sbas_id,'record_id' => $record_id)); + return $app->redirectPath('prod_stories_story', ['sbas_id' => $sbas_id,'record_id' => $record_id]); } }) ->bind('prod_stories_story_remove_element') @@ -191,7 +191,7 @@ class Story implements ControllerProviderInterface return new Response( $app['twig']->render( 'prod/Story/Reorder.html.twig' - , array('story' => $story) + , ['story' => $story] ) ); }) @@ -200,7 +200,7 @@ class Story implements ControllerProviderInterface ->assert('record_id', '\d+'); $controllers->post('/{sbas_id}/{record_id}/reorder/', function (Application $app, $sbas_id, $record_id) { - $ret = array('success' => false, 'message' => _('An error occured')); + $ret = ['success' => false, 'message' => _('An error occured')]; try { $story = new \record_adapter($app, $sbas_id, $record_id); @@ -218,19 +218,19 @@ class Story implements ControllerProviderInterface $stmt = $story->get_databox()->get_connection()->prepare($sql); foreach ($app['request']->request->get('element') as $record_id => $ord) { - $params = array( + $params = [ ':ord' => $ord, ':parent_id' => $story->get_record_id(), ':children_id' => $record_id - ); + ]; $stmt->execute($params); } $stmt->closeCursor(); - $ret = array('success' => true, 'message' => _('Story updated')); + $ret = ['success' => true, 'message' => _('Story updated')]; } catch (ControllerException $e) { - $ret = array('success' => false, 'message' => $e->getMessage()); + $ret = ['success' => false, 'message' => $e->getMessage()]; } catch (\Exception $e) { } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/TOU.php b/lib/Alchemy/Phrasea/Controller/Prod/TOU.php index 0a5ac013cb..1472b88f75 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/TOU.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/TOU.php @@ -52,13 +52,13 @@ class TOU implements ControllerProviderInterface */ public function denyTermsOfUse(Application $app, Request $request, $sbas_id) { - $ret = array('success' => false, 'message' => ''); + $ret = ['success' => false, 'message' => '']; try { $databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id); $app['acl']->get($app['authentication']->getUser())->revoke_access_from_bases( - array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base(array(), array($databox->get_sbas_id()))) + array_keys($app['acl']->get($app['authentication']->getUser())->get_granted_base([], [$databox->get_sbas_id()])) ); $app['acl']->get($app['authentication']->getUser())->revoke_unused_sbas_rights(); @@ -81,8 +81,8 @@ class TOU implements ControllerProviderInterface */ public function displayTermsOfUse(Application $app, Request $request) { - $toDisplay = $request->query->get('to_display', array()); - $data = array(); + $toDisplay = $request->query->get('to_display', []); + $data = []; foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) { if (count($toDisplay) > 0 && !in_array($databox->get_sbas_id(), $toDisplay)) { @@ -98,9 +98,9 @@ class TOU implements ControllerProviderInterface $data[$databox->get_label($app['locale.I18n'])] = $cgus[$app['locale']]['value']; } - return new Response($app['twig']->render('/prod/TOU.html.twig', array( + return new Response($app['twig']->render('/prod/TOU.html.twig', [ 'TOUs' => $data, 'local_title' => _('Terms of use') - ))); + ])); } } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php index 11c31b58c7..d5a87bc851 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Tools.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Tools.php @@ -59,21 +59,21 @@ class Tools implements ControllerProviderInterface } } - $var = array( + $var = [ 'records' => $records, 'record' => $record, 'metadatas' => $metadatas, - ); + ]; return $app['twig']->render('prod/actions/Tools/index.html.twig', $var); }); $controllers->post('/rotate/', function (Application $app, Request $request) { - $return = array('success' => true, 'errorMessage' => ''); + $return = ['success' => true, 'errorMessage' => '']; $records = RecordsRequest::fromRequest($app, $request, false); - $rotation = in_array($request->request->get('rotation'), array('-90', '90', '180')) ? $request->request->get('rotation', 90) : 90; + $rotation = in_array($request->request->get('rotation'), ['-90', '90', '180']) ? $request->request->get('rotation', 90) : 90; foreach ($records as $record) { foreach ($record->get_subdefs() as $name => $subdef) { @@ -92,9 +92,9 @@ class Tools implements ControllerProviderInterface })->bind('prod_tools_rotate'); $controllers->post('/image/', function (Application $app, Request $request) { - $return = array('success' => true); + $return = ['success' => true]; - $selection = RecordsRequest::fromRequest($app, $request, false, array('canmodifrecord')); + $selection = RecordsRequest::fromRequest($app, $request, false, ['canmodifrecord']); foreach ($selection as $record) { @@ -169,10 +169,10 @@ class Tools implements ControllerProviderInterface $app->abort(400, 'Missing file parameter'); } - return $app['twig']->render('prod/actions/Tools/iframeUpload.html.twig', array( + return $app['twig']->render('prod/actions/Tools/iframeUpload.html.twig', [ 'success' => $success, 'message' => $message, - )); + ]); })->bind('prod_tools_hd_substitution'); $controllers->post('/chgthumb/', function (Application $app, Request $request) { @@ -223,22 +223,22 @@ class Tools implements ControllerProviderInterface $app->abort(400, 'Missing file parameter'); } - return $app['twig']->render('prod/actions/Tools/iframeUpload.html.twig', array( + return $app['twig']->render('prod/actions/Tools/iframeUpload.html.twig', [ 'success' => $success, 'message' => $message, - )); + ]); })->bind('prod_tools_thumbnail_substitution'); $controllers->post('/thumb-extractor/confirm-box/', function (Application $app, Request $request) { - $return = array('error' => false, 'datas' => ''); + $return = ['error' => false, 'datas' => '']; $template = 'prod/actions/Tools/confirm.html.twig'; try { $record = new \record_adapter($app, $request->request->get('sbas_id'), $request->request->get('record_id')); - $var = array( + $var = [ 'video_title' => $record->get_title() , 'image' => $request->request->get('image', '') - ); + ]; $return['datas'] = $app['twig']->render($template, $var); } catch (\Exception $e) { $return['datas'] = _('an error occured'); @@ -249,7 +249,7 @@ class Tools implements ControllerProviderInterface }); $controllers->post('/thumb-extractor/apply/', function (Application $app, Request $request) { - $return = array('success' => false, 'message' => ''); + $return = ['success' => false, 'message' => '']; try { $record = new \record_adapter($app, $request->request->get('sbas_id'), $request->request->get('record_id')); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php b/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php index 9023a49905..ce41398736 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Tooltip.php @@ -84,14 +84,14 @@ class Tooltip implements ControllerProviderInterface public function displayBasket(Application $app, Basket $basket) { - return $app['twig']->render('prod/Tooltip/Basket.html.twig', array('basket' => $basket)); + return $app['twig']->render('prod/Tooltip/Basket.html.twig', ['basket' => $basket]); } public function displayStory(Application $app, $sbas_id, $record_id) { $Story = new \record_adapter($app, $sbas_id, $record_id); - return $app['twig']->render('prod/Tooltip/Story.html.twig', array('Story' => $Story)); + return $app['twig']->render('prod/Tooltip/Story.html.twig', ['Story' => $Story]); } public function displayUserBadge(Application $app, $usr_id) @@ -100,7 +100,7 @@ class Tooltip implements ControllerProviderInterface return $app['twig']->render( 'prod/Tooltip/User.html.twig' - , array('user' => $user) + , ['user' => $user] ); } @@ -110,7 +110,7 @@ class Tooltip implements ControllerProviderInterface return $app['twig']->render( 'prod/Tooltip/Preview.html.twig' - , array('record' => $record, 'not_wrapped' => true) + , ['record' => $record, 'not_wrapped' => true] ); } @@ -132,12 +132,12 @@ class Tooltip implements ControllerProviderInterface return $app['twig']->render( 'prod/Tooltip/Caption.html.twig' - , array( + , [ 'record' => $record, 'view' => $context, 'highlight' => $app['request']->request->get('query'), 'searchEngine' => $search_engine, - )); + ]); } public function displayTechnicalDatas(Application $app, $sbas_id, $record_id) @@ -152,7 +152,7 @@ class Tooltip implements ControllerProviderInterface return $app['twig']->render( 'prod/Tooltip/TechnicalDatas.html.twig' - , array('record' => $record, 'document' => $document) + , ['record' => $record, 'document' => $document] ); } @@ -163,7 +163,7 @@ class Tooltip implements ControllerProviderInterface return $app['twig']->render( 'prod/Tooltip/DataboxField.html.twig' - , array('field' => $field) + , ['field' => $field] ); } @@ -174,7 +174,7 @@ class Tooltip implements ControllerProviderInterface return $app['twig']->render( 'prod/Tooltip/DCESFieldInfo.html.twig' - , array('field' => $field) + , ['field' => $field] ); } @@ -185,7 +185,7 @@ class Tooltip implements ControllerProviderInterface return $app['twig']->render( 'prod/Tooltip/DataboxFieldRestrictions.html.twig' - , array('field' => $field) + , ['field' => $field] ); } } diff --git a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php index f2225fc90c..6e6b6ca2e0 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/Upload.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/Upload.php @@ -76,12 +76,12 @@ class Upload implements ControllerProviderInterface $maxFileSize = $this->getUploadMaxFileSize(); return $app['twig']->render( - 'prod/upload/upload-flash.html.twig', array( + 'prod/upload/upload-flash.html.twig', [ 'sessionId' => session_id(), 'collections' => $this->getGrantedCollections($app['acl']->get($app['authentication']->getUser())), 'maxFileSize' => $maxFileSize, 'maxFileSizeReadable' => \p4string::format_octets($maxFileSize) - )); + ]); } /** @@ -97,11 +97,11 @@ class Upload implements ControllerProviderInterface $maxFileSize = $this->getUploadMaxFileSize(); return $app['twig']->render( - 'prod/upload/upload.html.twig', array( + 'prod/upload/upload.html.twig', [ 'collections' => $this->getGrantedCollections($app['acl']->get($app['authentication']->getUser())), 'maxFileSize' => $maxFileSize, 'maxFileSizeReadable' => \p4string::format_octets($maxFileSize) - )); + ]); } /** @@ -121,14 +121,14 @@ class Upload implements ControllerProviderInterface */ public function upload(Application $app, Request $request) { - $datas = array( + $datas = [ 'success' => false, 'code' => null, 'message' => '', 'element' => '', - 'reasons' => array(), + 'reasons' => [], 'id' => '', - ); + ]; if (null === $request->files->get('files')) { throw new BadRequestHttpException('Missing file parameter'); @@ -185,7 +185,7 @@ class Upload implements ControllerProviderInterface $forceBehavior = $request->request->get('forceAction'); - $reasons = array(); + $reasons = []; $elementCreated = null; $callback = function ($element, $visa, $code) use (&$reasons, &$elementCreated) { @@ -205,7 +205,7 @@ class Upload implements ControllerProviderInterface $app['filesystem']->rename($renamedFilename, $uploadedFilename); if (!!$forceBehavior) { - $reasons = array(); + $reasons = []; } if ($elementCreated instanceof \record_adapter) { @@ -237,7 +237,7 @@ class Upload implements ControllerProviderInterface } } } else { - $params = array('lazaret_file' => $elementCreated); + $params = ['lazaret_file' => $elementCreated]; $app['events-manager']->trigger('__UPLOAD_QUARANTINE__', $params); @@ -246,14 +246,14 @@ class Upload implements ControllerProviderInterface $message = _('The file was moved to the quarantine'); } - $datas = array( + $datas = [ 'success' => true, 'code' => $code, 'message' => $message, 'element' => $element, 'reasons' => $reasons, 'id' => $id, - ); + ]; } catch (\Exception $e) { $datas['message'] = _('Unable to add file to Phraseanet'); } @@ -275,16 +275,16 @@ class Upload implements ControllerProviderInterface */ private function getGrantedCollections(\ACL $acl) { - $collections = array(); + $collections = []; - foreach ($acl->get_granted_base(array('canaddrecord')) as $collection) { + foreach ($acl->get_granted_base(['canaddrecord']) as $collection) { $databox = $collection->get_databox(); if ( ! isset($collections[$databox->get_sbas_id()])) { - $collections[$databox->get_sbas_id()] = array( + $collections[$databox->get_sbas_id()] = [ 'databox' => $databox, - 'databox_collections' => array() - ); + 'databox_collections' => [] + ]; } $collections[$databox->get_sbas_id()]['databox_collections'][] = $collection; diff --git a/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php b/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php index 62b5455ff0..2441726862 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/UsrLists.php @@ -78,11 +78,11 @@ class UsrLists implements ControllerProviderInterface public function getAll(Application $app, Request $request) { - $datas = array( + $datas = [ 'success' => false , 'message' => '' , 'result' => null - ); + ]; $lists = new ArrayCollection(); @@ -91,13 +91,13 @@ class UsrLists implements ControllerProviderInterface $lists = $repository->findUserLists($app['authentication']->getUser()); - $result = array(); + $result = []; foreach ($lists as $list) { - $owners = $entries = array(); + $owners = $entries = []; foreach ($list->getOwners() as $owner) { - $owners[] = array( + $owners[] = [ 'usr_id' => $owner->getUser($app)->get_id(), 'display_name' => $owner->getUser($app)->get_display_name(), 'position' => $owner->getUser($app)->get_position(), @@ -105,40 +105,40 @@ class UsrLists implements ControllerProviderInterface 'company' => $owner->getUser($app)->get_company(), 'email' => $owner->getUser($app)->get_email(), 'role' => $owner->getRole() - ); + ]; } foreach ($list->getEntries() as $entry) { - $entries[] = array( + $entries[] = [ 'usr_id' => $owner->getUser($app)->get_id(), 'display_name' => $owner->getUser($app)->get_display_name(), 'position' => $owner->getUser($app)->get_position(), 'job' => $owner->getUser($app)->get_job(), 'company' => $owner->getUser($app)->get_company(), 'email' => $owner->getUser($app)->get_email(), - ); + ]; } /* @var $list UsrList */ - $result[] = array( + $result[] = [ 'name' => $list->getName(), 'created' => $list->getCreated()->format(DATE_ATOM), 'updated' => $list->getUpdated()->format(DATE_ATOM), 'owners' => $owners, 'users' => $entries - ); + ]; } - $datas = array( + $datas = [ 'success' => true , 'message' => '' , 'result' => $result - ); + ]; } catch (ControllerException $e) { - $datas = array( + $datas = [ 'success' => false , 'message' => $e->getMessage() - ); + ]; } catch (\Exception $e) { } @@ -147,7 +147,7 @@ class UsrLists implements ControllerProviderInterface return $app->json($datas); } - return $app['twig']->render('prod/actions/Feedback/lists-all.html.twig', array('lists' => $lists)); + return $app['twig']->render('prod/actions/Feedback/lists-all.html.twig', ['lists' => $lists]); } public function createList(Application $app) @@ -156,11 +156,11 @@ class UsrLists implements ControllerProviderInterface $list_name = $request->request->get('name'); - $datas = array( + $datas = [ 'success' => false , 'message' => sprintf(_('Unable to create list %s'), $list_name) , 'list_id' => null - ); + ]; try { if (!$list_name) { @@ -181,16 +181,16 @@ class UsrLists implements ControllerProviderInterface $app['EM']->persist($List); $app['EM']->flush(); - $datas = array( + $datas = [ 'success' => true , 'message' => sprintf(_('List %s has been created'), $list_name) , 'list_id' => $List->getId() - ); + ]; } catch (ControllerException $e) { - $datas = array( + $datas = [ 'success' => false , 'message' => $e->getMessage() - ); + ]; } catch (\Exception $e) { } @@ -208,7 +208,7 @@ class UsrLists implements ControllerProviderInterface $owners = new ArrayCollection(); foreach ($list->getOwners() as $owner) { - $owners[] = array( + $owners[] = [ 'usr_id' => $owner->getUser($app)->get_id(), 'display_name' => $owner->getUser($app)->get_display_name(), 'position' => $owner->getUser($app)->get_position(), @@ -216,40 +216,40 @@ class UsrLists implements ControllerProviderInterface 'company' => $owner->getUser($app)->get_company(), 'email' => $owner->getUser($app)->get_email(), 'role' => $owner->getRole($app) - ); + ]; } foreach ($list->getEntries() as $entry) { - $entries[] = array( + $entries[] = [ 'usr_id' => $entry->getUser($app)->get_id(), 'display_name' => $entry->getUser($app)->get_display_name(), 'position' => $entry->getUser($app)->get_position(), 'job' => $entry->getUser($app)->get_job(), 'company' => $entry->getUser($app)->get_company(), 'email' => $entry->getUser($app)->get_email(), - ); + ]; } - return $app->json(array( - 'result' => array( + return $app->json([ + 'result' => [ 'id' => $list->getId(), 'name' => $list->getName(), 'created' => $list->getCreated()->format(DATE_ATOM), 'updated' => $list->getUpdated()->format(DATE_ATOM), 'owners' => $owners, 'users' => $entries - ) - )); + ] + ]); } public function updateList(Application $app, $list_id) { $request = $app['request']; - $datas = array( + $datas = [ 'success' => false , 'message' => _('Unable to update list') - ); + ]; try { $list_name = $request->request->get('name'); @@ -270,15 +270,15 @@ class UsrLists implements ControllerProviderInterface $app['EM']->flush(); - $datas = array( + $datas = [ 'success' => true , 'message' => _('List has been updated') - ); + ]; } catch (ControllerException $e) { - $datas = array( + $datas = [ 'success' => false , 'message' => $e->getMessage() - ); + ]; } catch (\Exception $e) { } @@ -300,21 +300,21 @@ class UsrLists implements ControllerProviderInterface $app['EM']->remove($list); $app['EM']->flush(); - $datas = array( + $datas = [ 'success' => true , 'message' => sprintf(_('List has been deleted')) - ); + ]; } catch (ControllerException $e) { - $datas = array( + $datas = [ 'success' => false , 'message' => $e->getMessage() - ); + ]; } catch (\Exception $e) { - $datas = array( + $datas = [ 'success' => false , 'message' => sprintf(_('Unable to delete list')) - ); + ]; } return $app->json($datas); @@ -339,21 +339,21 @@ class UsrLists implements ControllerProviderInterface $app['EM']->remove($user_entry); $app['EM']->flush(); - $datas = array( + $datas = [ 'success' => true , 'message' => _('Entry removed from list') - ); + ]; } catch (ControllerException $e) { - $datas = array( + $datas = [ 'success' => false , 'message' => $e->getMessage() - ); + ]; } catch (\Exception $e) { - $datas = array( + $datas = [ 'success' => false , 'message' => _('Unable to remove entry from list ' . $e->getMessage()) - ); + ]; } return $app->json($datas); @@ -375,7 +375,7 @@ class UsrLists implements ControllerProviderInterface throw new ControllerException(_('You are not authorized to do this')); } - $inserted_usr_ids = array(); + $inserted_usr_ids = []; foreach ($request->request->get('usr_ids') as $usr_id) { $user_entry = \User_Adapter::getInstance($usr_id, $app); @@ -397,29 +397,29 @@ class UsrLists implements ControllerProviderInterface $app['EM']->flush(); if (count($inserted_usr_ids) > 1) { - $datas = array( + $datas = [ 'success' => true , 'message' => sprintf(_('%d Users added to list'), count($inserted_usr_ids)) , 'result' => $inserted_usr_ids - ); + ]; } else { - $datas = array( + $datas = [ 'success' => true , 'message' => sprintf(_('%d User added to list'), count($inserted_usr_ids)) , 'result' => $inserted_usr_ids - ); + ]; } } catch (ControllerException $e) { - $datas = array( + $datas = [ 'success' => false , 'message' => $e->getMessage() - ); + ]; } catch (\Exception $e) { - $datas = array( + $datas = [ 'success' => false , 'message' => _('Unable to add usr to list') - ); + ]; } return $app->json($datas); @@ -443,16 +443,16 @@ class UsrLists implements ControllerProviderInterface } - return $app['twig']->render('prod/actions/Feedback/List-Share.html.twig', array('list' => $list)); + return $app['twig']->render('prod/actions/Feedback/List-Share.html.twig', ['list' => $list]); } public function shareWithUser(Application $app, $list_id, $usr_id) { - $availableRoles = array( + $availableRoles = [ UsrListOwner::ROLE_USER, UsrListOwner::ROLE_EDITOR, UsrListOwner::ROLE_ADMIN, - ); + ]; if (!$app['request']->request->get('role')) throw new BadRequestHttpException('Missing role parameter'); @@ -493,21 +493,21 @@ class UsrLists implements ControllerProviderInterface $app['EM']->flush(); - $datas = array( + $datas = [ 'success' => true , 'message' => _('List shared to user') - ); + ]; } catch (ControllerException $e) { - $datas = array( + $datas = [ 'success' => false , 'message' => $e->getMessage() - ); + ]; } catch (\Exception $e) { - $datas = array( + $datas = [ 'success' => false , 'message' => _('Unable to share the list with the usr') - ); + ]; } return $app->json($datas); @@ -532,20 +532,20 @@ class UsrLists implements ControllerProviderInterface $app['EM']->remove($owner); $app['EM']->flush(); - $datas = array( + $datas = [ 'success' => true , 'message' => _('Owner removed from list') - ); + ]; } catch (ControllerException $e) { - $datas = array( + $datas = [ 'success' => false , 'message' => $e->getMessage() - ); + ]; } catch (\Exception $e) { - $datas = array( + $datas = [ 'success' => false , 'message' => _('Unable to remove usr from list') - ); + ]; } return $app->json($datas); diff --git a/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php b/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php index 1a019f6d91..8014b40f47 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/WorkZone.php @@ -66,12 +66,12 @@ class WorkZone implements ControllerProviderInterface public function displayWorkzone(Application $app) { - $params = array( + $params = [ 'WorkZone' => new WorkzoneHelper($app, $app['request']) , 'selected_type' => $app['request']->query->get('type') , 'selected_id' => $app['request']->query->get('id') , 'srt' => $app['request']->query->get('sort') - ); + ]; return $app['twig']->render('prod/WorkZone/WorkZone.html.twig', $params); } @@ -104,7 +104,7 @@ class WorkZone implements ControllerProviderInterface $page = floor($offsetStart / $PerPage) + 1; $maxPage = floor(count($Baskets) / $PerPage) + 1; - $params = array( + $params = [ 'Baskets' => $Baskets , 'Page' => $page , 'MaxPage' => $maxPage @@ -112,14 +112,14 @@ class WorkZone implements ControllerProviderInterface , 'Query' => $request->query->get('Query') , 'Year' => $request->query->get('Year') , 'Type' => $request->query->get('Type') - ); + ]; return $app['twig']->render('prod/WorkZone/Browser/Results.html.twig', $params); } public function browseBasket(Application $app, Request $request, Basket $basket) { - return $app['twig']->render('prod/WorkZone/Browser/Basket.html.twig', array('Basket' => $basket)); + return $app['twig']->render('prod/WorkZone/Browser/Basket.html.twig', ['Basket' => $basket]); } public function attachStories(Application $app, Request $request) @@ -132,7 +132,7 @@ class WorkZone implements ControllerProviderInterface $alreadyFixed = $done = 0; - $stories = $request->request->get('stories', array()); + $stories = $request->request->get('stories', []); foreach ($stories as $element) { $element = explode('_', $element); @@ -190,10 +190,10 @@ class WorkZone implements ControllerProviderInterface } if ($request->getRequestFormat() == 'json') { - return $app->json(array( + return $app->json([ 'success' => true , 'message' => $message - )); + ]); } return $app->redirectPath('prod_workzone_show'); @@ -216,10 +216,10 @@ class WorkZone implements ControllerProviderInterface $app['EM']->flush(); if ($request->getRequestFormat() == 'json') { - return $app->json(array( + return $app->json([ 'success' => true , 'message' => _('Story detached from the WorkZone') - )); + ]); } return $app->redirectPath('prod_workzone_show'); diff --git a/lib/Alchemy/Phrasea/Controller/RecordsRequest.php b/lib/Alchemy/Phrasea/Controller/RecordsRequest.php index 08c8399db2..4ad903a04a 100644 --- a/lib/Alchemy/Phrasea/Controller/RecordsRequest.php +++ b/lib/Alchemy/Phrasea/Controller/RecordsRequest.php @@ -45,7 +45,7 @@ class RecordsRequest extends ArrayCollection $this->isSingleStory = ($flatten !== self::FLATTEN_YES && 1 === count($this) && $this->first()->is_grouping()); if (self::FLATTEN_NO !== $flatten) { - $to_remove = array(); + $to_remove = []; foreach ($this as $key => $record) { if ($record->is_grouping()) { if (self::FLATTEN_YES === $flatten) { @@ -77,7 +77,7 @@ class RecordsRequest extends ArrayCollection public function databoxes() { if (!$this->databoxes) { - $this->databoxes = array(); + $this->databoxes = []; foreach ($this as $record) { if (false === array_key_exists($record->get_databox()->get_sbas_id(), $this->databoxes)) { @@ -99,7 +99,7 @@ class RecordsRequest extends ArrayCollection public function collections() { if (!$this->collections) { - $this->collections = array(); + $this->collections = []; foreach ($this as $record) { if (false === array_key_exists($record->get_base_id(), $this->collections)) { @@ -182,7 +182,7 @@ class RecordsRequest extends ArrayCollection return $this->singleStory()->get_serialize_key(); } - $basrec = array(); + $basrec = []; foreach ($this as $record) { $basrec[] = $record->get_serialize_key(); } @@ -200,9 +200,9 @@ class RecordsRequest extends ArrayCollection * @param array $rightsDatabox * @return RecordsRequest */ - public static function fromRequest(Application $app, Request $request, $flattenStories = self::FLATTEN_NO, array $rightsColl = array(), array $rightsDatabox = array()) + public static function fromRequest(Application $app, Request $request, $flattenStories = self::FLATTEN_NO, array $rightsColl = [], array $rightsDatabox = []) { - $elements = $received = array(); + $elements = $received = []; $basket = null; if ($request->get('ssel')) { @@ -239,7 +239,7 @@ class RecordsRequest extends ArrayCollection $elements = $received; - $to_remove = array(); + $to_remove = []; foreach ($elements as $id => $record) { diff --git a/lib/Alchemy/Phrasea/Controller/Report/Activity.php b/lib/Alchemy/Phrasea/Controller/Report/Activity.php index 49c3e579b9..d6ba29bd16 100644 --- a/lib/Alchemy/Phrasea/Controller/Report/Activity.php +++ b/lib/Alchemy/Phrasea/Controller/Report/Activity.php @@ -105,22 +105,22 @@ class Activity implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } else { $report = $activity->getConnexionBase(false, $request->request->get('on', 'user')); - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => false, 'title' => false - )); + ]); } } @@ -133,13 +133,13 @@ class Activity implements ControllerProviderInterface */ public function doReportDownloadsByUsers(Application $app, Request $request) { - $conf = array( - 'user' => array(_('report:: utilisateur'), 0, 1, 0, 0), - 'nbdoc' => array(_('report:: nombre de documents'), 0, 0, 0, 0), - 'poiddoc' => array(_('report:: poids des documents'), 0, 0, 0, 0), - 'nbprev' => array(_('report:: nombre de preview'), 0, 0, 0, 0), - 'poidprev' => array(_('report:: poids des previews'), 0, 0, 0, 0) - ); + $conf = [ + 'user' => [_('report:: utilisateur'), 0, 1, 0, 0], + 'nbdoc' => [_('report:: nombre de documents'), 0, 0, 0, 0], + 'poiddoc' => [_('report:: poids des documents'), 0, 0, 0, 0], + 'nbprev' => [_('report:: nombre de preview'), 0, 0, 0, 0], + 'poidprev' => [_('report:: poids des previews'), 0, 0, 0, 0] + ]; $activity = new \module_report_activity( $app, @@ -171,20 +171,20 @@ class Activity implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } else { - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => false, 'title' => false - )); + ]); } } @@ -197,11 +197,11 @@ class Activity implements ControllerProviderInterface */ public function doReportBestOfQuestions(Application $app, Request $request) { - $conf = array( - 'search' => array(_('report:: question'), 0, 0, 0, 0), - 'nb' => array(_('report:: nombre'), 0, 0, 0, 0), - 'nb_rep' => array(_('report:: nombre de reponses'), 0, 0, 0, 0) - ); + $conf = [ + 'search' => [_('report:: question'), 0, 0, 0, 0], + 'nb' => [_('report:: nombre'), 0, 0, 0, 0], + 'nb_rep' => [_('report:: nombre de reponses'), 0, 0, 0, 0] + ]; $activity = new \module_report_activity( $app, @@ -227,22 +227,22 @@ class Activity implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } else { $report = $activity->getTopQuestion($conf); - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => false, 'title' => false - )); + ]); } } @@ -255,11 +255,11 @@ class Activity implements ControllerProviderInterface */ public function doReportNoBestOfQuestions(Application $app, Request $request) { - $conf = array( - 'search' => array(_('report:: question'), 0, 0, 0, 0), - 'nb' => array(_('report:: nombre'), 0, 0, 0, 0), - 'nb_rep' => array(_('report:: nombre de reponses'), 0, 0, 0, 0) - ); + $conf = [ + 'search' => [_('report:: question'), 0, 0, 0, 0], + 'nb' => [_('report:: nombre'), 0, 0, 0, 0], + 'nb_rep' => [_('report:: nombre de reponses'), 0, 0, 0, 0] + ]; $activity = new \module_report_activity( $app, @@ -292,22 +292,22 @@ class Activity implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } else { $report = $activity->getTopQuestion($conf, true); - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => false, 'title' => false - )); + ]); } } @@ -342,20 +342,20 @@ class Activity implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } else { - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => true, 'is_doc' => false - )), + ]), 'display_nav' => false, 'title' => false - )); + ]); } } @@ -368,12 +368,12 @@ class Activity implements ControllerProviderInterface */ public function doReportSiteActiviyPerDays(Application $app, Request $request) { - $conf = array( - 'ddate' => array(_('report:: jour'), 0, 0, 0, 0), - 'total' => array(_('report:: total des telechargements'), 0, 0, 0, 0), - 'preview' => array(_('report:: preview'), 0, 0, 0, 0), - 'document' => array(_('report:: document original'), 0, 0, 0, 0) - ); + $conf = [ + 'ddate' => [_('report:: jour'), 0, 0, 0, 0], + 'total' => [_('report:: total des telechargements'), 0, 0, 0, 0], + 'preview' => [_('report:: preview'), 0, 0, 0, 0], + 'document' => [_('report:: document original'), 0, 0, 0, 0] + ]; $activity = new \module_report_activity( $app, @@ -406,20 +406,20 @@ class Activity implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } else { - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => false, 'title' => false - )); + ]); } } @@ -432,14 +432,14 @@ class Activity implements ControllerProviderInterface */ public function doReportPushedDocuments(Application $app, Request $request) { - $conf = array( - 'user' => array('', 1, 0, 1, 1), - 'getter' => array("Destinataire", 1, 0, 1, 1), - 'date' => array('', 1, 0, 1, 1), - 'record_id' => array('', 1, 1, 1, 1), - 'file' => array('', 1, 0, 1, 1), - 'mime' => array('', 1, 0, 1, 1), - ); + $conf = [ + 'user' => ['', 1, 0, 1, 1], + 'getter' => ["Destinataire", 1, 0, 1, 1], + 'date' => ['', 1, 0, 1, 1], + 'record_id' => ['', 1, 1, 1, 1], + 'file' => ['', 1, 0, 1, 1], + 'mime' => ['', 1, 0, 1, 1], + ]; $activity = new \module_report_push( $app, @@ -461,7 +461,7 @@ class Activity implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } $report = $this->doReport($app, $request, $activity, $conf); @@ -470,15 +470,15 @@ class Activity implements ControllerProviderInterface return $report; } - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => $report['display_nav'], // do we display the prev and next button ? 'next' => $report['next_page'], //Number of the next page 'prev' => $report['previous_page'], //Number of the previoous page @@ -486,7 +486,7 @@ class Activity implements ControllerProviderInterface 'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters 'col' => $report['active_column'], //all the columns where a filter is applied 'limit' => $report['nb_record'] - )); + ]); } /** @@ -498,13 +498,13 @@ class Activity implements ControllerProviderInterface */ public function doReportAddedDocuments(Application $app, Request $request) { - $conf = array( - 'user' => array('', 1, 0, 1, 1), - 'date' => array('', 1, 0, 1, 1), - 'record_id' => array('', 1, 1, 1, 1), - 'file' => array('', 1, 0, 1, 1), - 'mime' => array('', 1, 0, 1, 1), - ); + $conf = [ + 'user' => ['', 1, 0, 1, 1], + 'date' => ['', 1, 0, 1, 1], + 'record_id' => ['', 1, 1, 1, 1], + 'file' => ['', 1, 0, 1, 1], + 'mime' => ['', 1, 0, 1, 1], + ]; $activity = new \module_report_add( $app, @@ -526,7 +526,7 @@ class Activity implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } $report = $this->doReport($app, $request, $activity, $conf); @@ -535,15 +535,15 @@ class Activity implements ControllerProviderInterface return $report; } - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => $report['display_nav'], // do we display the prev and next button ? 'next' => $report['next_page'], //Number of the next page 'prev' => $report['previous_page'], //Number of the previoous page @@ -551,7 +551,7 @@ class Activity implements ControllerProviderInterface 'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters 'col' => $report['active_column'], //all the columns where a filter is applied 'limit' => $report['nb_record'] - )); + ]); } /** @@ -563,13 +563,13 @@ class Activity implements ControllerProviderInterface */ public function doReportEditedDocuments(Application $app, Request $request) { - $conf = array( - 'user' => array('', 1, 0, 1, 1), - 'date' => array('', 1, 0, 1, 1), - 'record_id' => array('', 1, 1, 1, 1), - 'file' => array('', 1, 0, 1, 1), - 'mime' => array('', 1, 0, 1, 1), - ); + $conf = [ + 'user' => ['', 1, 0, 1, 1], + 'date' => ['', 1, 0, 1, 1], + 'record_id' => ['', 1, 1, 1, 1], + 'file' => ['', 1, 0, 1, 1], + 'mime' => ['', 1, 0, 1, 1], + ]; $activity = new \module_report_edit( $app, @@ -591,7 +591,7 @@ class Activity implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } $report = $this->doReport($app, $request, $activity, $conf); @@ -600,15 +600,15 @@ class Activity implements ControllerProviderInterface return $report; } - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => $report['display_nav'], // do we display the prev and next button ? 'next' => $report['next_page'], //Number of the next page 'prev' => $report['previous_page'], //Number of the previoous page @@ -616,7 +616,7 @@ class Activity implements ControllerProviderInterface 'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters 'col' => $report['active_column'], //all the columns where a filter is applied 'limit' => $report['nb_record'] - )); + ]); } /** @@ -628,14 +628,14 @@ class Activity implements ControllerProviderInterface */ public function doReportValidatedDocuments(Application $app, Request $request) { - $conf = array( - 'user' => array('', 1, 0, 1, 1), - 'getter' => array("Destinataire", 1, 0, 1, 1), - 'date' => array('', 1, 0, 1, 1), - 'record_id' => array('', 1, 1, 1, 1), - 'file' => array('', 1, 0, 1, 1), - 'mime' => array('', 1, 0, 1, 1), - ); + $conf = [ + 'user' => ['', 1, 0, 1, 1], + 'getter' => ["Destinataire", 1, 0, 1, 1], + 'date' => ['', 1, 0, 1, 1], + 'record_id' => ['', 1, 1, 1, 1], + 'file' => ['', 1, 0, 1, 1], + 'mime' => ['', 1, 0, 1, 1], + ]; $activity = new \module_report_validate( $app, @@ -657,7 +657,7 @@ class Activity implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } $report = $this->doReport($app, $request, $activity, $conf); @@ -666,15 +666,15 @@ class Activity implements ControllerProviderInterface return $report; } - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => $report['display_nav'], // do we display the prev and next button ? 'next' => $report['next_page'], //Number of the next page 'prev' => $report['previous_page'], //Number of the previoous page @@ -682,7 +682,7 @@ class Activity implements ControllerProviderInterface 'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters 'col' => $report['active_column'], //all the columns where a filter is applied 'limit' => $report['nb_record'] - )); + ]); } /** @@ -694,14 +694,14 @@ class Activity implements ControllerProviderInterface */ public function doReportSentDocuments(Application $app, Request $request) { - $conf = array( - 'user' => array('', 1, 0, 1, 1), - 'date' => array('', 1, 0, 1, 1), - 'record_id' => array('', 1, 1, 1, 1), - 'file' => array('', 1, 0, 1, 1), - 'mime' => array('', 1, 0, 1, 1), - 'comment' => array(_('Receiver'), 1, 0, 1, 1), - ); + $conf = [ + 'user' => ['', 1, 0, 1, 1], + 'date' => ['', 1, 0, 1, 1], + 'record_id' => ['', 1, 1, 1, 1], + 'file' => ['', 1, 0, 1, 1], + 'mime' => ['', 1, 0, 1, 1], + 'comment' => [_('Receiver'), 1, 0, 1, 1], + ]; $activity = new \module_report_sent( $app, @@ -723,7 +723,7 @@ class Activity implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } $report = $this->doReport($app, $request, $activity, $conf); @@ -732,15 +732,15 @@ class Activity implements ControllerProviderInterface return $report; } - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => $report['display_nav'], // do we display the prev and next button ? 'next' => $report['next_page'], //Number of the next page 'prev' => $report['previous_page'], //Number of the previoous page @@ -748,7 +748,7 @@ class Activity implements ControllerProviderInterface 'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters 'col' => $report['active_column'], //all the columns where a filter is applied 'limit' => $report['nb_record'] - )); + ]); } /** @@ -790,9 +790,9 @@ class Activity implements ControllerProviderInterface //display content of a table column when user click on it if ($request->request->get('conf') == 'on') { - return $app->json(array('liste' => $app['twig']->render('report/listColumn.html.twig', array( + return $app->json(['liste' => $app['twig']->render('report/listColumn.html.twig', [ 'conf' => $base_conf - )), "title" => _("configuration"))); + ]), "title" => _("configuration")]); } //set order @@ -803,7 +803,7 @@ class Activity implements ControllerProviderInterface //work on filters $mapColumnTitleToSqlField = $report->getTransQueryString(); - $currentfilter = array(); + $currentfilter = []; if ('' !== $serializedFilter = $request->request->get('liste_filter', '')) { $currentfilter = @unserialize(urldecode($serializedFilter)); @@ -816,10 +816,10 @@ class Activity implements ControllerProviderInterface $value = $request->request->get('filter_value', ''); if ($request->request->get('liste') == 'on') { - return $app->json(array('diag' => $app['twig']->render('report/colFilter.html.twig', array( + return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ 'result' => $report->colFilter($field), 'field' => $field - )), "title" => sprintf(_('filtrer les resultats sur la colonne %s'), $field))); + ]), "title" => sprintf(_('filtrer les resultats sur la colonne %s'), $field)]); } if ($field === $value) { @@ -854,18 +854,18 @@ class Activity implements ControllerProviderInterface $groupField = isset($conf[strtolower($groupby)]['title']) ? $conf[strtolower($groupby)]['title'] : ''; } - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => true, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => false, 'title' => _(sprintf('Groupement des resultats sur le champ %s', $groupField)) - )); + ]); } //set Limit diff --git a/lib/Alchemy/Phrasea/Controller/Report/Export.php b/lib/Alchemy/Phrasea/Controller/Report/Export.php index 38e8cec583..b0fc59b1e3 100644 --- a/lib/Alchemy/Phrasea/Controller/Report/Export.php +++ b/lib/Alchemy/Phrasea/Controller/Report/Export.php @@ -54,7 +54,7 @@ class Export implements ControllerProviderInterface $filename = mb_strtolower('report_' . $name . '_' . date('dmY') . '.csv'); $data = preg_replace('/[ \t\r\f]+/', '', $data); - $response = new Response($data, 200, array( + $response = new Response($data, 200, [ 'Expires' => 'Mon, 26 Jul 1997 05:00:00 GMT', 'Last-Modified' => gmdate('D, d M Y H:i:s'). ' GMT', 'Cache-Control' => 'no-store, no-cache, must-revalidate', @@ -64,7 +64,7 @@ class Export implements ControllerProviderInterface 'Content-Length' => strlen($data), 'Cache-Control' => 'max-age=3600, must-revalidate', 'Content-Disposition' => 'max-age=3600, must-revalidate', - )); + ]); $response->headers->set('Content-Disposition', $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $filename)); diff --git a/lib/Alchemy/Phrasea/Controller/Report/Informations.php b/lib/Alchemy/Phrasea/Controller/Report/Informations.php index 1fd2136673..9a68ac4fa9 100644 --- a/lib/Alchemy/Phrasea/Controller/Report/Informations.php +++ b/lib/Alchemy/Phrasea/Controller/Report/Informations.php @@ -50,38 +50,38 @@ class Informations implements ControllerProviderInterface */ public function doReportInformationsUser(Application $app, Request $request) { - $conf = array( - 'config' => array( - 'photo' => array(_('report:: document'), 0, 0, 0, 0), - 'record_id' => array(_('report:: record id'), 0, 0, 0, 0), - 'date' => array(_('report:: date'), 0, 0, 0, 0), - 'type' => array(_('phrseanet:: sous definition'), 0, 0, 0, 0), - 'titre' => array(_('report:: titre'), 0, 0, 0, 0), - 'taille' => array(_('report:: poids'), 0, 0, 0, 0) - ), - 'conf' => array( - 'identifiant' => array(_('report:: identifiant'), 0, 0, 0, 0), - 'nom' => array(_('report:: nom'), 0, 0, 0, 0), - 'mail' => array(_('report:: email'), 0, 0, 0, 0), - 'adresse' => array(_('report:: adresse'), 0, 0, 0, 0), - 'tel' => array(_('report:: telephone'), 0, 0, 0, 0) - ), - 'config_cnx' => array( - 'ddate' => array(_('report:: date'), 0, 0, 0, 0), - 'appli' => array(_('report:: modules'), 0, 0, 0, 0), - ), - 'config_dl' => array( - 'ddate' => array(_('report:: date'), 0, 0, 0, 0), - 'record_id' => array(_('report:: record id'), 0, 1, 0, 0), - 'final' => array(_('phrseanet:: sous definition'), 0, 0, 0, 0), - 'coll_id' => array(_('report:: collections'), 0, 0, 0, 0), - 'comment' => array(_('report:: commentaire'), 0, 0, 0, 0), - ), - 'config_ask' => array( - 'search' => array(_('report:: question'), 0, 0, 0, 0), - 'ddate' => array(_('report:: date'), 0, 0, 0, 0) - ) - ); + $conf = [ + 'config' => [ + 'photo' => [_('report:: document'), 0, 0, 0, 0], + 'record_id' => [_('report:: record id'), 0, 0, 0, 0], + 'date' => [_('report:: date'), 0, 0, 0, 0], + 'type' => [_('phrseanet:: sous definition'), 0, 0, 0, 0], + 'titre' => [_('report:: titre'), 0, 0, 0, 0], + 'taille' => [_('report:: poids'), 0, 0, 0, 0] + ], + 'conf' => [ + 'identifiant' => [_('report:: identifiant'), 0, 0, 0, 0], + 'nom' => [_('report:: nom'), 0, 0, 0, 0], + 'mail' => [_('report:: email'), 0, 0, 0, 0], + 'adresse' => [_('report:: adresse'), 0, 0, 0, 0], + 'tel' => [_('report:: telephone'), 0, 0, 0, 0] + ], + 'config_cnx' => [ + 'ddate' => [_('report:: date'), 0, 0, 0, 0], + 'appli' => [_('report:: modules'), 0, 0, 0, 0], + ], + 'config_dl' => [ + 'ddate' => [_('report:: date'), 0, 0, 0, 0], + 'record_id' => [_('report:: record id'), 0, 1, 0, 0], + 'final' => [_('phrseanet:: sous definition'), 0, 0, 0, 0], + 'coll_id' => [_('report:: collections'), 0, 0, 0, 0], + 'comment' => [_('report:: commentaire'), 0, 0, 0, 0], + ], + 'config_ask' => [ + 'search' => [_('report:: question'), 0, 0, 0, 0], + 'ddate' => [_('report:: date'), 0, 0, 0, 0] + ] + ]; $report = null; $html = $html_info = ''; @@ -94,10 +94,10 @@ class Informations implements ControllerProviderInterface } if ('' !== $on && $app['phraseanet.registry']->get('GV_anonymousReport') == true) { - $conf['conf'] = array( - $on => array($on, 0, 0, 0, 0), - 'nb' => array(_('report:: nombre'), 0, 0, 0, 0) - ); + $conf['conf'] = [ + $on => [$on, 0, 0, 0, 0], + 'nb' => [_('report:: nombre'), 0, 0, 0, 0] + ]; } if ($from == 'CNXU' || $from == 'CNX') { @@ -135,7 +135,7 @@ class Informations implements ControllerProviderInterface if ($report) { $mapColumnTitleToSqlField = $report->getTransQueryString(); - $currentfilter = array(); + $currentfilter = []; if ('' !== $serializedFilter = $request->request->get('liste_filter', '')) { $currentfilter = @unserialize(urldecode($serializedFilter)); @@ -148,10 +148,10 @@ class Informations implements ControllerProviderInterface $value = $request->request->get('filter_value', ''); if ($request->request->get('liste') == 'on') { - return $app->json(array('diag' => $app['twig']->render('report/colFilter.html.twig', array( + return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ 'result' => $report->colFilter($field), 'field' => $field - )), 'title' => sprintf(_('filtrer les resultats sur la colonne %s'), $field))); + ]), 'title' => sprintf(_('filtrer les resultats sur la colonne %s'), $field)]); } if ($field === $value) { @@ -188,17 +188,17 @@ class Informations implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } - $html = $app['twig']->render('report/ajax_data_content.html.twig', array( + $html = $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'is_infouser' => $report instanceof \module_report_download, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )); + ]); } $info = new \module_report_nav( @@ -214,32 +214,32 @@ class Informations implements ControllerProviderInterface $infoArray = $info->buildTabGrpInfo( null !== $report ? $report->getReq() : '', - null !== $report ? $report->getParams() : array(), + null !== $report ? $report->getParams() : [], $selectValue, $conf['conf'], $on ); if (false == $app['phraseanet.registry']->get('GV_anonymousReport')) { - $html_info = $app['twig']->render('report/ajax_data_content.html.twig', array( + $html_info = $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($infoArray['report']) ? $infoArray['report'] : $infoArray, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )); + ]); $title = ('' === $on && isset($infoArray['result'])) ? $infoArray['result'][0]['identifiant'] : $selectValue; } else { $title = $selectValue; } - return $app->json(array( + return $app->json([ 'rs' => sprintf('%s%s', $html_info, $html), 'display_nav' => false, 'title' => $title - )); + ]); } /** @@ -251,10 +251,10 @@ class Informations implements ControllerProviderInterface */ public function doReportinformationsBrowser(Application $app, Request $request) { - $conf = array( - 'version' => array(_('report::version '), 0, 0, 0, 0), - 'nb' => array(_('report:: nombre'), 0, 0, 0, 0) - ); + $conf = [ + 'version' => [_('report::version '), 0, 0, 0, 0], + 'nb' => [_('report:: nombre'), 0, 0, 0, 0] + ]; $info = new \module_report_nav( $app, @@ -273,18 +273,18 @@ class Informations implements ControllerProviderInterface $reportArray = $info->buildTabInfoNav($conf, $browser); - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => false, 'title' => $browser - )); + ]); } /** @@ -296,26 +296,26 @@ class Informations implements ControllerProviderInterface */ public function doReportInformationsDocument(Application $app, Request $request) { - $config = array( - 'photo' => array(_('report:: document'), 0, 0, 0, 0), - 'record_id' => array(_('report:: record id'), 0, 0, 0, 0), - 'date' => array(_('report:: date'), 0, 0, 0, 0), - 'type' => array(_('phrseanet:: sous definition'), 0, 0, 0, 0), - 'titre' => array(_('report:: titre'), 0, 0, 0, 0), - 'taille' => array(_('report:: poids'), 0, 0, 0, 0) - ); + $config = [ + 'photo' => [_('report:: document'), 0, 0, 0, 0], + 'record_id' => [_('report:: record id'), 0, 0, 0, 0], + 'date' => [_('report:: date'), 0, 0, 0, 0], + 'type' => [_('phrseanet:: sous definition'), 0, 0, 0, 0], + 'titre' => [_('report:: titre'), 0, 0, 0, 0], + 'taille' => [_('report:: poids'), 0, 0, 0, 0] + ]; - $config_dl = array( - 'ddate' => array(_('report:: date'), 0, 0, 0, 0), - 'user' => array(_('report:: utilisateurs'), 0, 0, 0, 0), - 'final' => array(_('phrseanet:: sous definition'), 0, 0, 0, 0), - 'coll_id' => array(_('report:: collections'), 0, 0, 0, 0), - 'comment' => array(_('report:: commentaire'), 0, 0, 0, 0), - 'fonction' => array(_('report:: fonction'), 0, 0, 0, 0), - 'activite' => array(_('report:: activite'), 0, 0, 0, 0), - 'pays' => array(_('report:: pays'), 0, 0, 0, 0), - 'societe' => array(_('report:: societe'), 0, 0, 0, 0) - ); + $config_dl = [ + 'ddate' => [_('report:: date'), 0, 0, 0, 0], + 'user' => [_('report:: utilisateurs'), 0, 0, 0, 0], + 'final' => [_('phrseanet:: sous definition'), 0, 0, 0, 0], + 'coll_id' => [_('report:: collections'), 0, 0, 0, 0], + 'comment' => [_('report:: commentaire'), 0, 0, 0, 0], + 'fonction' => [_('report:: fonction'), 0, 0, 0, 0], + 'activite' => [_('report:: activite'), 0, 0, 0, 0], + 'pays' => [_('report:: pays'), 0, 0, 0, 0], + 'societe' => [_('report:: societe'), 0, 0, 0, 0] + ]; //format conf according user preferences if ('' !== $columnsList = $request->request->get('list_column', '')) { @@ -361,25 +361,25 @@ class Informations implements ControllerProviderInterface $title = $what->getTitle(); - $html = $app['twig']->render('report/ajax_data_content.html.twig', array( + $html = $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )); + ]); $from = $request->request->get('from', ''); if ('TOOL' === $from) { $what->setTitle(''); - return $app->json(array( + return $app->json([ 'rs' => $html, 'display_nav' => false, 'title' => $title - )); + ]); } if ('DASH' !== $from && 'PUSHDOC' !== $from) { @@ -393,7 +393,7 @@ class Informations implements ControllerProviderInterface $mapColumnTitleToSqlField = $download->getTransQueryString(); - $currentfilter = array(); + $currentfilter = []; if ('' !== $serializedFilter = $request->request->get('liste_filter', '')) { $currentfilter = @unserialize(urldecode($serializedFilter)); @@ -406,10 +406,10 @@ class Informations implements ControllerProviderInterface $value = $request->request->get('filter_value', ''); if ($request->request->get('liste') == 'on') { - return $app->json(array('diag' => $app['twig']->render('report/colFilter.html.twig', array( + return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ 'result' => $download->colFilter($field), 'field' => $field - )), 'title' => sprintf(_('filtrer les resultats sur la colonne %s'), $field))); + ]), 'title' => sprintf(_('filtrer les resultats sur la colonne %s'), $field)]); } if ($field === $value) { @@ -437,33 +437,33 @@ class Informations implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } - $html .= $app['twig']->render('report/ajax_data_content.html.twig', array( + $html .= $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )); + ]); - return $app->json(array( + return $app->json([ 'rs' => $html, 'display_nav' => false, 'title' => $title - )); + ]); } if ($app['phraseanet.registry']->get('GV_anonymousReport') == false && $from !== 'DOC' && $from !== 'DASH' && $from !== 'GEN' && $from !== 'PUSHDOC') { - $conf = array( - 'identifiant' => array(_('report:: identifiant'), 0, 0, 0, 0), - 'nom' => array(_('report:: nom'), 0, 0, 0, 0), - 'mail' => array(_('report:: email'), 0, 0, 0, 0), - 'adresse' => array(_('report:: adresse'), 0, 0, 0, 0), - 'tel' => array(_('report:: telephone'), 0, 0, 0, 0) - ); + $conf = [ + 'identifiant' => [_('report:: identifiant'), 0, 0, 0, 0], + 'nom' => [_('report:: nom'), 0, 0, 0, 0], + 'mail' => [_('report:: email'), 0, 0, 0, 0], + 'adresse' => [_('report:: adresse'), 0, 0, 0, 0], + 'tel' => [_('report:: telephone'), 0, 0, 0, 0] + ]; $info = new \module_report_nav( $app, @@ -477,7 +477,7 @@ class Informations implements ControllerProviderInterface $info->setConfig(false); $info->setTitle(_('report:: utilisateur')); - $reportArray = $info->buildTabGrpInfo(false, array(), $request->request->get('user'), $conf, false); + $reportArray = $info->buildTabGrpInfo(false, [], $request->request->get('user'), $conf, false); if ($request->request->get('printcsv') == 'on') { $download->setPrettyString(false); @@ -488,29 +488,29 @@ class Informations implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } - $html .= $app['twig']->render('report/ajax_data_content.html.twig', array( + $html .= $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )); + ]); - return $app->json(array( + return $app->json([ 'rs' => $html, 'display_nav' => false, 'title' => $title - )); + ]); } - return $app->json(array( + return $app->json([ 'rs' => $html, 'display_nav' => false, 'title' => $title - )); + ]); } } diff --git a/lib/Alchemy/Phrasea/Controller/Report/Root.php b/lib/Alchemy/Phrasea/Controller/Report/Root.php index 1d0959dc88..8f3f818307 100644 --- a/lib/Alchemy/Phrasea/Controller/Report/Root.php +++ b/lib/Alchemy/Phrasea/Controller/Report/Root.php @@ -74,7 +74,7 @@ class Root implements ControllerProviderInterface $dashboard->execute(); - return $app['twig']->render('report/report_layout_child.html.twig', array( + return $app['twig']->render('report/report_layout_child.html.twig', [ 'ajax_dash' => true, 'dashboard' => $dashboard, 'home_title' => $app['phraseanet.registry']->get('GV_homeTitle'), @@ -84,7 +84,7 @@ class Root implements ControllerProviderInterface 'g_anal' => $app['phraseanet.registry']->get('GV_googleAnalytics'), 'ajax' => false, 'ajax_chart' => false - )); + ]); } $dmin = $request->request->get('dmin'); @@ -96,9 +96,9 @@ class Root implements ControllerProviderInterface $dashboard->execute(); - return $app->json(array('html' => $app['twig']->render('report/ajax_dashboard_content_child.html.twig', array( + return $app->json(['html' => $app['twig']->render('report/ajax_dashboard_content_child.html.twig', [ 'dashboard' => $dashboard - )))); + ])]); } /** @@ -111,7 +111,7 @@ class Root implements ControllerProviderInterface */ public function initReport(Application $app, Request $request) { - $popbases = $request->request->get('popbases', array()); + $popbases = $request->request->get('popbases', []); if ('' === $dmin = $request->request->get('dmin', '')) { $dmin = '01-' . date('m') . '-' . date('Y'); @@ -125,7 +125,7 @@ class Root implements ControllerProviderInterface $dmax = \DateTime::createFromFormat('d-m-Y H:i:s', sprintf('%s 23:59:59', $dmax)); //get user's sbas & collections selection from popbases - $selection = array(); + $selection = []; $liste = $id_sbas = ''; $i = 0; foreach (array_fill_keys($popbases, 0) as $key => $val) { @@ -142,13 +142,13 @@ class Root implements ControllerProviderInterface //fill the last entry $selection[$id_sbas]['liste'] = $liste; - return $app['twig']->render('report/ajax_report_content.html.twig', array( + return $app['twig']->render('report/ajax_report_content.html.twig', [ 'selection' => $selection, 'anonymous' => $app['phraseanet.registry']->get('GV_anonymousReport'), 'ajax' => true, 'dmin' => $dmin->format('Y-m-d H:i:s'), 'dmax' => $dmax->format('Y-m-d H:i:s'), - )); + ]); } /** @@ -168,16 +168,16 @@ class Root implements ControllerProviderInterface $request->request->get('collection') ); - $conf = array( - 'user' => array(_('phraseanet::utilisateurs'), 1, 1, 1, 1), - 'ddate' => array(_('report:: date'), 1, 0, 1, 1), - 'ip' => array(_('report:: IP'), 1, 0, 0, 0), - 'appli' => array(_('report:: modules'), 1, 0, 0, 0), - 'fonction' => array(_('report::fonction'), 1, 1, 1, 1), - 'activite' => array(_('report::activite'), 1, 1, 1, 1), - 'pays' => array(_('report::pays'), 1, 1, 1, 1), - 'societe' => array(_('report::societe'), 1, 1, 1, 1) - ); + $conf = [ + 'user' => [_('phraseanet::utilisateurs'), 1, 1, 1, 1], + 'ddate' => [_('report:: date'), 1, 0, 1, 1], + 'ip' => [_('report:: IP'), 1, 0, 0, 0], + 'appli' => [_('report:: modules'), 1, 0, 0, 0], + 'fonction' => [_('report::fonction'), 1, 1, 1, 1], + 'activite' => [_('report::activite'), 1, 1, 1, 1], + 'pays' => [_('report::pays'), 1, 1, 1, 1], + 'societe' => [_('report::societe'), 1, 1, 1, 1] + ]; if ($request->request->get('printcsv') == 'on') { $cnx->setHasLimit(false); @@ -189,7 +189,7 @@ class Root implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } $report = $this->doReport($app, $request, $cnx, $conf); @@ -198,15 +198,15 @@ class Root implements ControllerProviderInterface return $report; } - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => $report['display_nav'], // do we display the prev and next button ? 'next' => $report['next_page'], //Number of the next page 'prev' => $report['previous_page'], //Number of the previoous page @@ -214,7 +214,7 @@ class Root implements ControllerProviderInterface 'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters 'col' => $report['active_column'], //all the columns where a filter is applied 'limit' => $report['nb_record'] - )); + ]); } /** @@ -234,15 +234,15 @@ class Root implements ControllerProviderInterface $request->request->get('collection') ); - $conf = array( - 'user' => array(_('report:: utilisateur'), 1, 1, 1, 1), - 'search' => array(_('report:: question'), 1, 0, 1, 1), - 'ddate' => array(_('report:: date'), 1, 0, 1, 1), - 'fonction' => array(_('report:: fonction'), 1, 1, 1, 1), - 'activite' => array(_('report:: activite'), 1, 1, 1, 1), - 'pays' => array(_('report:: pays'), 1, 1, 1, 1), - 'societe' => array(_('report:: societe'), 1, 1, 1, 1) - ); + $conf = [ + 'user' => [_('report:: utilisateur'), 1, 1, 1, 1], + 'search' => [_('report:: question'), 1, 0, 1, 1], + 'ddate' => [_('report:: date'), 1, 0, 1, 1], + 'fonction' => [_('report:: fonction'), 1, 1, 1, 1], + 'activite' => [_('report:: activite'), 1, 1, 1, 1], + 'pays' => [_('report:: pays'), 1, 1, 1, 1], + 'societe' => [_('report:: societe'), 1, 1, 1, 1] + ]; if ($request->request->get('printcsv') == 'on') { $questions->setHasLimit(false); @@ -254,7 +254,7 @@ class Root implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } $report = $this->doReport($app, $request, $questions, $conf); @@ -263,15 +263,15 @@ class Root implements ControllerProviderInterface return $report; } - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => $report['display_nav'], // do we display the prev and next button ? 'next' => $report['next_page'], //Number of the next page 'prev' => $report['previous_page'], //Number of the previoous page @@ -279,7 +279,7 @@ class Root implements ControllerProviderInterface 'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters 'col' => $report['active_column'], //all the columns where a filter is applied 'limit' => $report['nb_record'] - )); + ]); } /** @@ -299,24 +299,24 @@ class Root implements ControllerProviderInterface $request->request->get('collection') ); - $conf_pref = array(); + $conf_pref = []; foreach (\module_report::getPreff($app, $request->request->get('sbasid')) as $field) { - $conf_pref[strtolower($field)] = array($field, 0, 0, 0, 0); + $conf_pref[strtolower($field)] = [$field, 0, 0, 0, 0]; } - $conf = array_merge(array( - 'user' => array(_('report:: utilisateurs'), 1, 1, 1, 1), - 'ddate' => array(_('report:: date'), 1, 0, 1, 1), - 'record_id' => array(_('report:: record id'), 1, 1, 1, 1), - 'final' => array(_('phrseanet:: sous definition'), 1, 0, 1, 1), - 'coll_id' => array(_('report:: collections'), 1, 0, 1, 1), - 'comment' => array(_('report:: commentaire'), 1, 0, 0, 0), - 'fonction' => array(_('report:: fonction'), 1, 1, 1, 1), - 'activite' => array(_('report:: activite'), 1, 1, 1, 1), - 'pays' => array(_('report:: pays'), 1, 1, 1, 1), - 'societe' => array(_('report:: societe'), 1, 1, 1, 1) - ), $conf_pref); + $conf = array_merge([ + 'user' => [_('report:: utilisateurs'), 1, 1, 1, 1], + 'ddate' => [_('report:: date'), 1, 0, 1, 1], + 'record_id' => [_('report:: record id'), 1, 1, 1, 1], + 'final' => [_('phrseanet:: sous definition'), 1, 0, 1, 1], + 'coll_id' => [_('report:: collections'), 1, 0, 1, 1], + 'comment' => [_('report:: commentaire'), 1, 0, 0, 0], + 'fonction' => [_('report:: fonction'), 1, 1, 1, 1], + 'activite' => [_('report:: activite'), 1, 1, 1, 1], + 'pays' => [_('report:: pays'), 1, 1, 1, 1], + 'societe' => [_('report:: societe'), 1, 1, 1, 1] + ], $conf_pref); if ($request->request->get('printcsv') == 'on') { $download->setHasLimit(false); @@ -328,7 +328,7 @@ class Root implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } $report = $this->doReport($app, $request, $download, $conf); @@ -337,15 +337,15 @@ class Root implements ControllerProviderInterface return $report; } - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => $report['display_nav'], // do we display the prev and next button ? 'next' => $report['next_page'], //Number of the next page 'prev' => $report['previous_page'], //Number of the previoous page @@ -353,7 +353,7 @@ class Root implements ControllerProviderInterface 'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters 'col' => $report['active_column'], //all the columns where a filter is applied 'limit' => $report['nb_record'] - )); + ]); } /** @@ -373,20 +373,20 @@ class Root implements ControllerProviderInterface $request->request->get('collection') ); - $conf_pref = array(); + $conf_pref = []; foreach (\module_report::getPreff($app, $request->request->get('sbasid')) as $field) { - $conf_pref[strtolower($field)] = array($field, 0, 0, 0, 0); + $conf_pref[strtolower($field)] = [$field, 0, 0, 0, 0]; } - $conf = array_merge(array( - 'telechargement' => array(_('report:: telechargements'), 1, 0, 0, 0), - 'record_id' => array(_('report:: record id'), 1, 1, 1, 0), - 'final' => array(_('phraseanet:: sous definition'), 1, 0, 1, 1), - 'file' => array(_('report:: fichier'), 1, 0, 0, 1), - 'mime' => array(_('report:: type'), 1, 0, 1, 1), - 'size' => array(_('report:: taille'), 1, 0, 1, 1) - ), $conf_pref); + $conf = array_merge([ + 'telechargement' => [_('report:: telechargements'), 1, 0, 0, 0], + 'record_id' => [_('report:: record id'), 1, 1, 1, 0], + 'final' => [_('phraseanet:: sous definition'), 1, 0, 1, 1], + 'file' => [_('report:: fichier'), 1, 0, 0, 1], + 'mime' => [_('report:: type'), 1, 0, 1, 1], + 'size' => [_('report:: taille'), 1, 0, 1, 1] + ], $conf_pref); if ($request->request->get('printcsv') == 'on') { $document->setHasLimit(false); @@ -398,7 +398,7 @@ class Root implements ControllerProviderInterface $csv = ''; } - return $app->json(array('rs' => $csv)); + return $app->json(['rs' => $csv]); } $report = $this->doReport($app, $request, $document, $conf, 'record_id'); @@ -407,15 +407,15 @@ class Root implements ControllerProviderInterface return $report; } - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => true - )), + ]), 'display_nav' => $report['display_nav'], // do we display the prev and next button ? 'next' => $report['next_page'], //Number of the next page 'prev' => $report['previous_page'], //Number of the previoous page @@ -423,7 +423,7 @@ class Root implements ControllerProviderInterface 'filter' => ((sizeof($report['filter']) > 0) ? serialize($report['filter']) : ''), //the serialized filters 'col' => $report['active_column'], //all the columns where a filter is applied 'limit' => $report['nb_record'] - )); + ]); } /** @@ -443,63 +443,63 @@ class Root implements ControllerProviderInterface $request->request->get('collection') ); - $conf_nav = array( - 'nav' => array(_('report:: navigateur'), 0, 1, 0, 0), - 'nb' => array(_('report:: nombre'), 0, 0, 0, 0), - 'pourcent' => array(_('report:: pourcentage'), 0, 0, 0, 0) - ); + $conf_nav = [ + 'nav' => [_('report:: navigateur'), 0, 1, 0, 0], + 'nb' => [_('report:: nombre'), 0, 0, 0, 0], + 'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0] + ]; - $conf_combo = array( - 'combo' => array(_('report:: navigateurs et plateforme'), 0, 0, 0, 0), - 'nb' => array(_('report:: nombre'), 0, 0, 0, 0), - 'pourcent' => array(_('report:: pourcentage'), 0, 0, 0, 0) - ); - $conf_os = array( - 'os' => array(_('report:: plateforme'), 0, 0, 0, 0), - 'nb' => array(_('report:: nombre'), 0, 0, 0, 0), - 'pourcent' => array(_('report:: pourcentage'), 0, 0, 0, 0) - ); - $conf_res = array( - 'res' => array(_('report:: resolution'), 0, 0, 0, 0), - 'nb' => array(_('report:: nombre'), 0, 0, 0, 0), - 'pourcent' => array(_('report:: pourcentage'), 0, 0, 0, 0) - ); - $conf_mod = array( - 'appli' => array(_('report:: module'), 0, 0, 0, 0), - 'nb' => array(_('report:: nombre'), 0, 0, 0, 0), - 'pourcent' => array(_('report:: pourcentage'), 0, 0, 0, 0) - ); + $conf_combo = [ + 'combo' => [_('report:: navigateurs et plateforme'), 0, 0, 0, 0], + 'nb' => [_('report:: nombre'), 0, 0, 0, 0], + 'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0] + ]; + $conf_os = [ + 'os' => [_('report:: plateforme'), 0, 0, 0, 0], + 'nb' => [_('report:: nombre'), 0, 0, 0, 0], + 'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0] + ]; + $conf_res = [ + 'res' => [_('report:: resolution'), 0, 0, 0, 0], + 'nb' => [_('report:: nombre'), 0, 0, 0, 0], + 'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0] + ]; + $conf_mod = [ + 'appli' => [_('report:: module'), 0, 0, 0, 0], + 'nb' => [_('report:: nombre'), 0, 0, 0, 0], + 'pourcent' => [_('report:: pourcentage'), 0, 0, 0, 0] + ]; - $report = array( + $report = [ 'nav' => $nav->buildTabNav($conf_nav), 'os' => $nav->buildTabOs($conf_os), 'res' => $nav->buildTabRes($conf_res), 'mod' => $nav->buildTabModule($conf_mod), 'combo' => $nav->buildTabCombo($conf_combo) - ); + ]; if ($request->request->get('printcsv') == 'on') { - return $app->json(array( + return $app->json([ 'nav' => \format::arr_to_csv($report['nav']['result'], $conf_nav), 'os' => \format::arr_to_csv($report['os']['result'], $conf_os), 'res' => \format::arr_to_csv($report['res']['result'], $conf_res), 'mod' => \format::arr_to_csv($report['mod']['result'], $conf_mod), 'combo' => \format::arr_to_csv($report['combo']['result'], $conf_combo) - )); + ]); } - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($report['report']) ? $report['report'] : $report, 'is_infouser' => false, 'is_nav' => true, 'is_groupby' => false, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => false, 'title' => false - )); + ]); } /** @@ -541,9 +541,9 @@ class Root implements ControllerProviderInterface //display content of a table column when user click on it if ($request->request->get('conf') == 'on') { - return $app->json(array('liste' => $app['twig']->render('report/listColumn.html.twig', array( + return $app->json(['liste' => $app['twig']->render('report/listColumn.html.twig', [ 'conf' => $base_conf - )), 'title' => _('configuration'))); + ]), 'title' => _('configuration')]); } //set order @@ -554,7 +554,7 @@ class Root implements ControllerProviderInterface //work on filters $mapColumnTitleToSqlField = $report->getTransQueryString(); - $currentfilter = array(); + $currentfilter = []; if ('' !== $serializedFilter = $request->request->get('liste_filter', '')) { $currentfilter = @unserialize(urldecode($serializedFilter)); @@ -567,10 +567,10 @@ class Root implements ControllerProviderInterface $value = $request->request->get('filter_value', ''); if ($request->request->get('liste') == 'on') { - return $app->json(array('diag' => $app['twig']->render('report/colFilter.html.twig', array( + return $app->json(['diag' => $app['twig']->render('report/colFilter.html.twig', [ 'result' => $report->colFilter($field), 'field' => $field - )), 'title' => sprintf(_('filtrer les resultats sur la colonne %s'), $field))); + ]), 'title' => sprintf(_('filtrer les resultats sur la colonne %s'), $field)]); } if ($field === $value) { @@ -605,18 +605,18 @@ class Root implements ControllerProviderInterface $groupField = isset($conf[strtolower($groupby)]['title']) ? $conf[strtolower($groupby)]['title'] : ''; } - return $app->json(array( - 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', array( + return $app->json([ + 'rs' => $app['twig']->render('report/ajax_data_content.html.twig', [ 'result' => isset($reportArray['report']) ? $reportArray['report'] : $reportArray, 'is_infouser' => false, 'is_nav' => false, 'is_groupby' => true, 'is_plot' => false, 'is_doc' => false - )), + ]), 'display_nav' => false, 'title' => _(sprintf('Groupement des resultats sur le champ %s', $groupField)) - )); + ]); } //set Limit diff --git a/lib/Alchemy/Phrasea/Controller/Root/Account.php b/lib/Alchemy/Phrasea/Controller/Root/Account.php index 6c6a20c6a6..492eeeab5a 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Account.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Account.php @@ -108,7 +108,7 @@ class Account implements ControllerProviderInterface return $app['twig']->render('account/change-password.html.twig', array_merge( Login::getDefaultTemplateVariables($app), - array('form' => $form->createView()) + ['form' => $form->createView()] )); } @@ -148,7 +148,7 @@ class Account implements ControllerProviderInterface $date = new \DateTime('1 day'); $token = $app['tokens']->getUrlToken(\random::TYPE_EMAIL, $app['authentication']->getUser()->get_id(), $date, $app['authentication']->getUser()->get_email()); - $url = $app->url('account_reset_email', array('token' => $token)); + $url = $app->url('account_reset_email', ['token' => $token]); try { $receiver = Receiver::fromUser($app['authentication']->getUser()); @@ -227,7 +227,7 @@ class Account implements ControllerProviderInterface $error = true; } - return $app->json(array('success' => !$error)); + return $app->json(['success' => !$error]); } /** @@ -241,9 +241,9 @@ class Account implements ControllerProviderInterface { require_once $app['root.path'] . '/lib/classes/deprecated/inscript.api.php'; - return $app['twig']->render('account/access.html.twig', array( + return $app['twig']->render('account/access.html.twig', [ 'inscriptions' => giveMeBases($app, $app['authentication']->getUser()->get_id()) - )); + ]); } /** @@ -255,9 +255,9 @@ class Account implements ControllerProviderInterface */ public function accountAuthorizedApps(Application $app, Request $request) { - return $app['twig']->render('account/authorized_apps.html.twig', array( + return $app['twig']->render('account/authorized_apps.html.twig', [ "applications" => \API_OAuth2_Application::load_app_by_user($app, $app['authentication']->getUser()), - )); + ]); } /** @@ -274,10 +274,10 @@ class Account implements ControllerProviderInterface ORDER BY s.created DESC'; $query = $app['EM']->createQuery($dql); - $query->setParameters(array('usr_id' => $app['session']->get('usr_id'))); + $query->setParameters(['usr_id' => $app['session']->get('usr_id')]); $sessions = $query->getResult(); - $result = array(); + $result = []; foreach ($sessions as $session) { $info = ''; try { @@ -302,13 +302,13 @@ class Account implements ControllerProviderInterface } - $result[] = array( + $result[] = [ 'session' => $session, 'info' => $info, - ); + ]; } - return $app['twig']->render('account/sessions.html.twig', array('sessions' => $result)); + return $app['twig']->render('account/sessions.html.twig', ['sessions' => $result]); } /** @@ -320,11 +320,11 @@ class Account implements ControllerProviderInterface */ public function displayAccount(Application $app, Request $request) { - return $app['twig']->render('account/account.html.twig', array( + return $app['twig']->render('account/account.html.twig', [ 'user' => $app['authentication']->getUser(), 'evt_mngr' => $app['events-manager'], 'notifications' => $app['events-manager']->list_notifications_available($app['authentication']->getUser()->get_id()), - )); + ]); } /** @@ -336,7 +336,7 @@ class Account implements ControllerProviderInterface */ public function updateAccount(PhraseaApplication $app, Request $request) { - $demands = (array) $request->request->get('demand', array()); + $demands = (array) $request->request->get('demand', []); if (0 !== count($demands)) { $register = new \appbox_register($app['phraseanet.appbox']); @@ -351,7 +351,7 @@ class Account implements ControllerProviderInterface } } - $accountFields = array( + $accountFields = [ 'form_gender', 'form_firstname', 'form_lastname', @@ -369,7 +369,7 @@ class Account implements ControllerProviderInterface 'form_destFTP', 'form_prefixFTPfolder', 'form_retryFTP' - ); + ]; if (0 === count(array_diff($accountFields, array_keys($request->request->all())))) { @@ -410,7 +410,7 @@ class Account implements ControllerProviderInterface } } - $requestedNotifications = (array) $request->request->get('notifications', array()); + $requestedNotifications = (array) $request->request->get('notifications', []); foreach ($app['events-manager']->list_notifications_available($app['authentication']->getUser()->get_id()) as $notifications) { foreach ($notifications as $notification) { diff --git a/lib/Alchemy/Phrasea/Controller/Root/Developers.php b/lib/Alchemy/Phrasea/Controller/Root/Developers.php index 79a925fe83..a17e2ef8d7 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Developers.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Developers.php @@ -90,7 +90,7 @@ class Developers implements ControllerProviderInterface $error = true; } - return $app->json(array('success' => !$error)); + return $app->json(['success' => !$error]); } /** @@ -121,7 +121,7 @@ class Developers implements ControllerProviderInterface $error = true; } - return $app->json(array('success' => !$error)); + return $app->json(['success' => !$error]); } /** @@ -158,7 +158,7 @@ class Developers implements ControllerProviderInterface $error = true; } - return $app->json(array('success' => !$error, 'token' => $accessToken)); + return $app->json(['success' => !$error, 'token' => $accessToken]); } /** @@ -184,7 +184,7 @@ class Developers implements ControllerProviderInterface $error = true; } - return $app->json(array('success' => !$error)); + return $app->json(['success' => !$error]); } /** @@ -212,13 +212,13 @@ class Developers implements ControllerProviderInterface ->set_type($form->getType()) ->set_website($form->getSchemeWebsite() . $form->getWebsite()); - return $app->redirectPath('developers_application', array('id' => $application->get_id())); + return $app->redirectPath('developers_application', ['id' => $application->get_id()]); } - $var = array( + $var = [ "violations" => $violations, "form" => $form - ); + ]; return $app['twig']->render('/developers/application_form.html.twig', $var); } @@ -232,9 +232,9 @@ class Developers implements ControllerProviderInterface */ public function listApps(Application $app, Request $request) { - return $app['twig']->render('developers/applications.html.twig', array( + return $app['twig']->render('developers/applications.html.twig', [ "applications" => \API_OAuth2_Application::load_dev_app_by_user($app, $app['authentication']->getUser()) - )); + ]); } /** @@ -246,11 +246,11 @@ class Developers implements ControllerProviderInterface */ public function displayFormApp(Application $app, Request $request) { - return $app['twig']->render('developers/application_form.html.twig', array( + return $app['twig']->render('developers/application_form.html.twig', [ "violations" => null, 'form' => null, 'request' => $request - )); + ]); } /** @@ -271,10 +271,10 @@ class Developers implements ControllerProviderInterface $token = $client->get_user_account($app['authentication']->getUser())->get_token()->get_value(); - return $app['twig']->render('developers/application.html.twig', array( + return $app['twig']->render('developers/application.html.twig', [ "application" => $client, "user" => $app['authentication']->getUser(), "token" => $token - )); + ]); } } diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php index 67a6065e4a..2cfb59c44f 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Login.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php @@ -50,21 +50,21 @@ class Login implements ControllerProviderInterface { public static function getDefaultTemplateVariables(Application $app) { - $items = array(); + $items = []; foreach ($app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedItem')->loadLatest($app, 20) as $item) { $record = $item->getRecord($app); $preview = $record->get_subdef('preview'); $permalink = $preview->get_permalink(); - $items[] = array( + $items[] = [ 'record' => $record, 'preview' => $preview, 'permalink' => $permalink - ); + ]; } - return array( + return [ 'last_publication_items' => $items, 'instance_title' => $app['phraseanet.registry']->get('GV_homeTitle'), 'has_terms_of_use' => $app->hasTermsOfUse(), @@ -84,7 +84,7 @@ class Login implements ControllerProviderInterface 'authentication_providers' => $app['authentication.providers'], 'registration_fields' => $app['registration.fields'], 'registration_optional_fields' => $app['registration.optional-fields'] - ); + ]; } public function connect(Application $app) @@ -110,10 +110,10 @@ class Login implements ControllerProviderInterface // then post login operation like getting baskets from an invit session // could be done by Session_handler authentication process - $params = array(); + $params = []; if (null !== $redirect = $request->query->get('redirect')) { - $params = array('redirect' => ltrim($redirect, '/')); + $params = ['redirect' => ltrim($redirect, '/')]; } $response = $app->redirectPath('logout', $params); @@ -203,7 +203,7 @@ class Login implements ControllerProviderInterface // Displays Terms of use $controllers->get('/cgus', function (PhraseaApplication $app, Request $request) { return $app['twig']->render('login/cgus.html.twig', array_merge( - array('cgus' => \databox_cgu::getHome($app)), + ['cgus' => \databox_cgu::getHome($app)], self::getDefaultTemplateVariables($app) )); })->bind('login_cgus'); @@ -216,7 +216,7 @@ class Login implements ControllerProviderInterface public function getLanguage(Application $app, Request $request) { - $response = $app->json(array( + $response = $app->json([ 'validation_blank' => _('Please provide a value.'), 'validation_choice_min' => _('Please select at least %s choice.'), 'validation_email' => _('Please provide a valid email address.'), @@ -234,7 +234,7 @@ class Login implements ControllerProviderInterface 'ordinary' => _('Ordinary'), 'good' => _('Good'), 'great' => _('Great'), - )); + ]); $response->setExpires(new \DateTime('+1 day')); @@ -314,7 +314,7 @@ class Login implements ControllerProviderInterface $selected = isset($data['collections']) ? $data['collections'] : null; } $inscriptions = giveMeBases($app); - $inscOK = array(); + $inscOK = []; foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) { @@ -342,7 +342,7 @@ class Login implements ControllerProviderInterface $user = \User_Adapter::create($app, $data['login'], $data['password'], $data['email'], false); - foreach (array( + foreach ([ 'gender' => 'set_gender', 'firstname' => 'set_firstname', 'lastname' => 'set_lastname', @@ -354,9 +354,9 @@ class Login implements ControllerProviderInterface 'company' => 'set_company', 'position' => 'set_position', 'geonameid' => 'set_geonameid', - ) as $property => $method) { + ] as $property => $method) { if (isset($data[$property])) { - call_user_func(array($user, $method), $data[$property]); + call_user_func([$user, $method], $data[$property]); } } @@ -365,7 +365,7 @@ class Login implements ControllerProviderInterface $app['EM']->flush(); } - $demandOK = array(); + $demandOK = []; if ($app['phraseanet.registry']->get('GV_autoregister')) { @@ -373,7 +373,7 @@ class Login implements ControllerProviderInterface $template_user = \User_Adapter::getInstance($template_user_id, $app); - $base_ids = array(); + $base_ids = []; foreach (array_keys($inscOK) as $base_id) { $base_ids[] = $base_id; @@ -395,11 +395,11 @@ class Login implements ControllerProviderInterface $demandOK[$base_id] = true; } - $params = array( + $params = [ 'demand' => $demandOK, 'autoregister' => $autoReg, 'usr_id' => $user->get_id() - ); + ]; $app['events-manager']->trigger('__REGISTER_AUTOREGISTER__', $params); $app['events-manager']->trigger('__REGISTER_APPROVAL__', $params); @@ -423,21 +423,21 @@ class Login implements ControllerProviderInterface $provider = $this->findProvider($app, $request->query->get('providerId')); $identity = $provider->getIdentity(); - $form->setData(array_filter(array( + $form->setData(array_filter([ 'email' => $identity->getEmail(), 'firstname' => $identity->getFirstname(), 'lastname' => $identity->getLastname(), 'company' => $identity->getCompany(), 'provider-id' => $provider->getId(), - ))); + ])); } return $app['twig']->render('login/register-classic.html.twig', array_merge( self::getDefaultTemplateVariables($app), - array( + [ 'geonames_server_uri' => str_replace(sprintf('%s:', parse_url($app['geonames.server-uri'], PHP_URL_SCHEME)), '', $app['geonames.server-uri']), 'form' => $form->createView() - ))); + ])); } private function attachProviderToUser(EntityManager $em, ProviderInterface $provider, \User_Adapter $user) @@ -505,7 +505,7 @@ class Login implements ControllerProviderInterface $token = $app['tokens']->getUrlToken(\random::TYPE_PASSWORD, $user->get_id(), $expire, $user->get_email()); $mail = MailRequestEmailConfirmation::create($app, $receiver); - $mail->setButtonUrl($app->url('login_register_confirm', array('code' => $token))); + $mail->setButtonUrl($app->url('login_register_confirm', ['code' => $token])); $mail->setExpiration($expire); $app['notification.deliverer']->deliver($mail); @@ -589,7 +589,7 @@ class Login implements ControllerProviderInterface } $form = $app->form(new PhraseaRecoverPasswordForm($app)); - $form->setData(array('token' => $token)); + $form->setData(['token' => $token]); if ('POST' === $request->getMethod()) { $form->bind($request); @@ -615,7 +615,7 @@ class Login implements ControllerProviderInterface return $app['twig']->render('login/renew-password.html.twig', array_merge( self::getDefaultTemplateVariables($app), - array('form' => $form->createView()) + ['form' => $form->createView()] )); } @@ -655,7 +655,7 @@ class Login implements ControllerProviderInterface return $app->abort(500, 'Unable to generate a token'); } - $url = $app->url('login_renew_password', array('token' => $token), true); + $url = $app->url('login_renew_password', ['token' => $token], true); $mail = MailRequestPasswordUpdate::create($app, $receiver); $mail->setLogin($user->get_login()); @@ -673,9 +673,9 @@ class Login implements ControllerProviderInterface return $app['twig']->render('login/forgot-password.html.twig', array_merge( self::getDefaultTemplateVariables($app), - array( + [ 'form' => $form->createView(), - ))); + ])); } /** @@ -712,9 +712,9 @@ class Login implements ControllerProviderInterface $app->addFlash('info', _('Vous etes maintenant deconnecte. A bientot.')); - $response = $app->redirectPath('homepage', array( + $response = $app->redirectPath('homepage', [ 'redirect' => $request->query->get("redirect") - )); + ]); $response->headers->clearCookie('persistent'); $response->headers->clearCookie('last_act'); @@ -740,19 +740,19 @@ class Login implements ControllerProviderInterface $app->addFlash('error', _('login::erreur: No available connection - Please contact sys-admin')); } - $feeds = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->findBy(array('public' => true), array('updatedOn' => 'DESC')); + $feeds = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->findBy(['public' => true], ['updatedOn' => 'DESC']); $form = $app->form(new PhraseaAuthenticationForm()); - $form->setData(array( + $form->setData([ 'redirect' => $request->query->get('redirect') - )); + ]); return $app['twig']->render('login/index.html.twig', array_merge( self::getDefaultTemplateVariables($app), - array( + [ 'feeds' => $feeds, 'form' => $form->createView(), - ))); + ])); } /** @@ -765,7 +765,7 @@ class Login implements ControllerProviderInterface public function authenticate(PhraseaApplication $app, Request $request) { $form = $app->form(new PhraseaAuthenticationForm()); - $redirector = function (array $params = array()) use ($app) { + $redirector = function (array $params = []) use ($app) { return $app->redirectPath('homepage', $params); }; @@ -847,13 +847,13 @@ class Login implements ControllerProviderInterface continue; } - $app['events-manager']->trigger('__VALIDATION_REMINDER__', array( + $app['events-manager']->trigger('__VALIDATION_REMINDER__', [ 'to' => $participantId, 'ssel_id' => $basketId, 'from' => $validationSession->getInitiatorId(), 'validate_id' => $validationSession->getId(), - 'url' => $app->url('lightbox_validation', array('basket' => $basketId, 'LOG' => $token)), - )); + 'url' => $app->url('lightbox_validation', ['basket' => $basketId, 'LOG' => $token]), + ]); $participant->setReminded(new \DateTime('now')); $app['EM']->persist($participant); @@ -959,7 +959,7 @@ class Login implements ControllerProviderInterface return $app->redirect($redirection); } elseif ($app['registration.enabled']) { - return $app->redirectPath('login_register_classic', array('providerId' => $providerId)); + return $app->redirectPath('login_register_classic', ['providerId' => $providerId]); } $app->addFlash('error', _('Your identity is not recognized.')); @@ -999,7 +999,7 @@ class Login implements ControllerProviderInterface throw new AuthenticationException(call_user_func($redirector)); } - $params = array(); + $params = []; if (null !== $redirect = $request->get('redirect')) { $params['redirect'] = ltrim($redirect, '/'); @@ -1039,7 +1039,7 @@ class Login implements ControllerProviderInterface if ($user->get_id() != $inviteUsrId = $request->cookies->get('invite-usr_id')) { $repo = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Basket'); - $baskets = $repo->findBy(array('usr_id' => $inviteUsrId)); + $baskets = $repo->findBy(['usr_id' => $inviteUsrId]); foreach ($baskets as $basket) { $basket->setUsrId($user->get_id()); diff --git a/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php b/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php index ab3f646e66..cbe408bc7a 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php +++ b/lib/Alchemy/Phrasea/Controller/Root/RSSFeeds.php @@ -67,7 +67,7 @@ class RSSFeeds implements ControllerProviderInterface ->assert('format', '(rss|atom)'); $controllers->get('/userfeed/aggregated/{token}/{format}/', function (Application $app, $token, $format) { - $token = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\AggregateToken')->findOneBy(array("value" => $token)); + $token = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\AggregateToken')->findOneBy(["value" => $token]); $user = \User_Adapter::getInstance($token->getUsrId(), $app); diff --git a/lib/Alchemy/Phrasea/Controller/Root/Root.php b/lib/Alchemy/Phrasea/Controller/Root/Root.php index 703e2e2b28..41147d861c 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Root.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Root.php @@ -52,7 +52,7 @@ class Root implements ControllerProviderInterface $buffer = "User-Agent: *\n" . "Disallow: /\n"; } - return new Response($buffer, 200, array('Content-Type' => 'text/plain')); + return new Response($buffer, 200, ['Content-Type' => 'text/plain']); } public function getRoot(Application $app, Request $request) diff --git a/lib/Alchemy/Phrasea/Controller/Root/Session.php b/lib/Alchemy/Phrasea/Controller/Root/Session.php index 7548beb04b..063db799f2 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Session.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Session.php @@ -50,12 +50,12 @@ class Session implements ControllerProviderInterface $app->abort(400); } - $ret = array( + $ret = [ 'status' => 'unknown', 'message' => '', 'notifications' => false, - 'changed' => array() - ); + 'changed' => [] + ]; if ($app['authentication']->isAuthenticated()) { $usr_id = $app['authentication']->getUser()->get_id(); @@ -99,9 +99,9 @@ class Session implements ControllerProviderInterface $ret['status'] = 'ok'; - $ret['notifications'] = $app['twig']->render('prod/notifications.html.twig', array( + $ret['notifications'] = $app['twig']->render('prod/notifications.html.twig', [ 'notifications' => $app['events-manager']->get_notifications() - )); + ]); $baskets = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Basket')->findUnreadActiveByUser($app['authentication']->getUser()); @@ -109,7 +109,7 @@ class Session implements ControllerProviderInterface $ret['changed'][] = $basket->getId(); } - if (in_array($app['session']->get('phraseanet.message'), array('1', null))) { + if (in_array($app['session']->get('phraseanet.message'), ['1', null])) { if ($app['configuration']['main']['maintenance']) { $ret['message'] .= _('The application is going down for maintenance, please logout.'); } @@ -147,10 +147,10 @@ class Session implements ControllerProviderInterface $app['EM']->flush(); if ($app['request']->isXmlHttpRequest()) { - return $app->json(array( + return $app->json([ 'success' => true, 'session_id' => $id - )); + ]); } return $app->redirectPath('account_sessions'); diff --git a/lib/Alchemy/Phrasea/Controller/Setup.php b/lib/Alchemy/Phrasea/Controller/Setup.php index 4b75ae0071..c86ea983d3 100644 --- a/lib/Alchemy/Phrasea/Controller/Setup.php +++ b/lib/Alchemy/Phrasea/Controller/Setup.php @@ -53,37 +53,37 @@ class Setup implements ControllerProviderInterface { $requirementsCollection = $this->getRequirementsCollection(); - return $app['twig']->render('/setup/index.html.twig', array( + return $app['twig']->render('/setup/index.html.twig', [ 'locale' => $app['locale'], 'available_locales' => Application::getAvailableLanguages(), 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/', 'requirementsCollection' => $requirementsCollection, - )); + ]); } private function getRequirementsCollection() { - return array( + return [ new BinariesRequirements(), new FilesystemRequirements(), new LocalesRequirements(), new PhpRequirements(), new PhraseaRequirements(), new SystemRequirements(), - ); + ]; } public function displayUpgradeInstructions(Application $app, Request $request) { - return $app['twig']->render('/setup/upgrade-instructions.html.twig', array( + return $app['twig']->render('/setup/upgrade-instructions.html.twig', [ 'locale' => $app['locale'], 'available_locales' => Application::getAvailableLanguages(), - )); + ]); } public function getInstallForm(Application $app, Request $request) { - $warnings = array(); + $warnings = []; $requirementsCollection = $this->getRequirementsCollection(); @@ -99,16 +99,16 @@ class Setup implements ControllerProviderInterface $warnings[] = _('It is not recommended to install Phraseanet without HTTPS support'); } - return $app['twig']->render('/setup/step2.html.twig', array( + return $app['twig']->render('/setup/step2.html.twig', [ 'locale' => $app['locale'], 'available_locales' => Application::getAvailableLanguages(), - 'available_templates' => array('en', 'fr'), + 'available_templates' => ['en', 'fr'], 'warnings' => $warnings, 'error' => $request->query->get('error'), 'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/', 'discovered_binaries' => \setup::discover_binaries(), 'rootpath' => realpath(__DIR__ . '/../../../../'), - )); + ]); } public function doInstall(Application $app, Request $request) @@ -128,21 +128,21 @@ class Setup implements ControllerProviderInterface $databox_name = $request->request->get('db_name'); try { - $abConn = new \connection_pdo('appbox', $hostname, $port, $user_ab, $ab_password, $appbox_name, array(), $app['debug']); + $abConn = new \connection_pdo('appbox', $hostname, $port, $user_ab, $ab_password, $appbox_name, [], $app['debug']); } catch (\Exception $e) { - return $app->redirectPath('install_step2', array( + return $app->redirectPath('install_step2', [ 'error' => _('Appbox is unreachable'), - )); + ]); } try { if ($databox_name) { - $dbConn = new \connection_pdo('databox', $hostname, $port, $user_ab, $ab_password, $databox_name, array(), $app['debug']); + $dbConn = new \connection_pdo('databox', $hostname, $port, $user_ab, $ab_password, $databox_name, [], $app['debug']); } } catch (\Exception $e) { - return $app->redirectPath('install_step2', array( + return $app->redirectPath('install_step2', [ 'error' => _('Databox is unreachable'), - )); + ]); } $email = $request->request->get('email'); @@ -154,8 +154,8 @@ class Setup implements ControllerProviderInterface $installer = $app['phraseanet.installer']; $installer->setPhraseaIndexerPath($request->request->get('binary_phraseanet_indexer')); - $binaryData = array(); - foreach (array( + $binaryData = []; + foreach ([ 'php_binary' => $request->request->get('binary_php'), 'phraseanet_indexer' => $request->request->get('binary_phraseanet_indexer'), 'swf_extract_binary' => $request->request->get('binary_swfextract'), @@ -166,7 +166,7 @@ class Setup implements ControllerProviderInterface 'mp4box_binary' => $request->request->get('binary_MP4Box'), 'pdftotext_binary' => $request->request->get('binary_xpdf'), 'recess_binary' => $request->request->get('binary_recess'), - ) as $key => $path) { + ] as $key => $path) { $binaryData[$key] = $path; } @@ -174,14 +174,14 @@ class Setup implements ControllerProviderInterface $app['authentication']->openAccount($user); - return $app->redirectPath('admin', array( + return $app->redirectPath('admin', [ 'section' => 'taskmanager', 'notice' => 'install_success', - )); + ]); } catch (\Exception $e) { - return $app->redirectPath('install_step2', array( + return $app->redirectPath('install_step2', [ 'error' => sprintf(_('an error occured : %s'), $e->getMessage()), - )); + ]); } } } diff --git a/lib/Alchemy/Phrasea/Controller/Thesaurus/Thesaurus.php b/lib/Alchemy/Phrasea/Controller/Thesaurus/Thesaurus.php index a8e0296653..7479f580b2 100644 --- a/lib/Alchemy/Phrasea/Controller/Thesaurus/Thesaurus.php +++ b/lib/Alchemy/Phrasea/Controller/Thesaurus/Thesaurus.php @@ -104,7 +104,7 @@ class Thesaurus implements ControllerProviderInterface } } - return $app['twig']->render('thesaurus/accept.html.twig', array( + return $app['twig']->render('thesaurus/accept.html.twig', [ 'dlg' => $request->get('dlg'), 'bid' => $request->get('bid'), 'piv' => $request->get('piv'), @@ -117,12 +117,12 @@ class Thesaurus implements ControllerProviderInterface 'fullpath_tgt' => $fullpath_tgt, 'fullpath_src' => $fullpath_src, 'acceptable' => $acceptable, - )); + ]); } public function exportText(Application $app, Request $request) { - $thits = $tnodes = array(); + $thits = $tnodes = []; $output = ''; if (null === $bid = $request->get("bid")) { @@ -167,10 +167,10 @@ class Thesaurus implements ControllerProviderInterface } } - return $app['twig']->render('thesaurus/export-text.html.twig', array( + return $app['twig']->render('thesaurus/export-text.html.twig', [ 'output' => $output, 'smp' => $request->get('smp'), - )); + ]); } private function printTNodes(&$output, &$tnodes, $iln, $hit, $ilg, $osl) @@ -272,29 +272,29 @@ class Thesaurus implements ControllerProviderInterface { if ($node->nodeType == XML_ELEMENT_NODE) { if (($nname = $node->nodeName) == "thesaurus" || $nname == "cterms") { - $tnodes[] = array( + $tnodes[] = [ "type" => "ROOT", "depth" => $depth, "name" => $nname, "cdate" => $node->getAttribute("creation_date"), "mdate" => $node->getAttribute("modification_date") - ); + ]; } elseif (($fld = $node->getAttribute("field"))) { if ($node->getAttribute("delbranch")) { - $tnodes[] = array( + $tnodes[] = [ "type" => "TRASH", "depth" => $depth, "name" => $fld - ); + ]; } else { - $tnodes[] = array( + $tnodes[] = [ "type" => "FIELD", "depth" => $depth, "name" => $fld - ); + ]; } } else { - $tsy = array(); + $tsy = []; for ($n = $node->firstChild; $n; $n = $n->nextSibling) { if ($n->nodeName == "sy") { $id = $n->getAttribute("id"); @@ -304,21 +304,21 @@ class Thesaurus implements ControllerProviderInterface $hits = 0; } - $tsy[] = array( + $tsy[] = [ "v" => $n->getAttribute("v"), "lng" => $n->getAttribute("lng"), "hits" => $hits - ); + ]; } } - $tnodes[] = array("type" => "TERM", "depth" => $depth, "syns" => $tsy); + $tnodes[] = ["type" => "TERM", "depth" => $depth, "syns" => $tsy]; } } } private function export0($znode, &$tnodes, &$thits, &$output, $iln, $hit, $ilg, $osl) { - $nodes = array(); + $nodes = []; $depth = 0; for ($node = $znode->parentNode; $node; $node = $node->parentNode) { @@ -349,13 +349,13 @@ class Thesaurus implements ControllerProviderInterface public function exportTextDialog(Application $app, Request $request) { - return $app['twig']->render('thesaurus/export-text-dialog.html.twig', array( + return $app['twig']->render('thesaurus/export-text-dialog.html.twig', [ 'dlg' => $request->get('dlg'), 'bid' => $request->get('bid'), 'typ' => $request->get('typ'), 'piv' => $request->get('piv'), 'id' => $request->get('id'), - )); + ]); } public function exportTopics(Application $app, Request $request) @@ -363,7 +363,7 @@ class Thesaurus implements ControllerProviderInterface $lng = $app['locale']; $obr = explode(';', $request->get('obr')); - $t_lng = array(); + $t_lng = []; if ($request->get('ofm') == 'tofiles') { $t_lng = array_map(function ($code) { @@ -399,7 +399,7 @@ class Thesaurus implements ControllerProviderInterface } $now = date('YmdHis'); - $lngs = array(); + $lngs = []; try { $databox = $app['phraseanet.appbox']->get_databox((int) $request->get("bid")); if ($request->get("typ") == "TH") { @@ -438,7 +438,7 @@ class Thesaurus implements ControllerProviderInterface $this->export0Topics($xpathth->query($q)->item(0), $dom, $root, $lng, $request->get("srt"), $request->get("sth"), $request->get("sand"), $opened_display, $obr); if ($request->get("ofm") == 'toscreen') { - $lngs[$lng] = str_replace(array('&', '<', '>'), array('&', '<', '>'), $dom->saveXML()); + $lngs[$lng] = str_replace(['&', '<', '>'], ['&', '<', '>'], $dom->saveXML()); } elseif ($request->get("ofm") == 'tofiles') { $fname = 'topics_' . $lng . '.xml'; @@ -456,10 +456,10 @@ class Thesaurus implements ControllerProviderInterface } - return $app['twig']->render('thesaurus/export-topics.html.twig', array( + return $app['twig']->render('thesaurus/export-topics.html.twig', [ 'lngs' => $lngs, 'ofm' => $request->get('ofm'), - )); + ]); } private function export0Topics($znode, \DOMDocument $dom, \DOMNode $root, $lng, $srt, $sth, $sand, $opened_display, $obr) @@ -472,8 +472,8 @@ class Thesaurus implements ControllerProviderInterface { $ntopics = 0; if ($node->nodeType == XML_ELEMENT_NODE) { - $t_node = array(); - $t_sort = array(); + $t_node = []; + $t_sort = []; $i = 0; for ($n = $node->firstChild; $n; $n = $n->nextSibling) { if ($n->nodeName == "te") { @@ -506,7 +506,7 @@ class Thesaurus implements ControllerProviderInterface } $t_sort[$i] = $query; // tri sur w - $t_node[$i] = array('label' => $label, 'node' => $n); + $t_node[$i] = ['label' => $label, 'node' => $n]; $i ++; } @@ -550,14 +550,14 @@ class Thesaurus implements ControllerProviderInterface public function exportTopicsDialog(Application $app, Request $request) { - return $app['twig']->render('thesaurus/export-topics-dialog.html.twig', array( + return $app['twig']->render('thesaurus/export-topics-dialog.html.twig', [ 'bid' => $request->get('bid'), 'piv' => $request->get('piv'), 'typ' => $request->get('typ'), 'dlg' => $request->get('dlg'), 'id' => $request->get('id'), 'obr' => $request->get('obr'), - )); + ]); } public function import(Application $app, Request $request) @@ -584,8 +584,8 @@ class Thesaurus implements ControllerProviderInterface $node->removeChild($node->firstChild); } - $cbad = array(); - $cok = array(); + $cbad = []; + $cok = []; for ($i = 0; $i < 32; $i ++) { $cbad[] = chr($i); $cok[] = '_'; @@ -732,7 +732,7 @@ class Thesaurus implements ControllerProviderInterface } - return $app['twig']->render('thesaurus/import.html.twig', array('err' => $err)); + return $app['twig']->render('thesaurus/import.html.twig', ['err' => $err]); } private function checkEncoding($string, $string_encoding) @@ -745,12 +745,12 @@ class Thesaurus implements ControllerProviderInterface public function importDialog(Application $app, Request $request) { - return $app['twig']->render('thesaurus/import-dialog.html.twig', array( + return $app['twig']->render('thesaurus/import-dialog.html.twig', [ 'dlg' => $request->get('dlg'), 'bid' => $request->get('bid'), 'id' => $request->get('id'), 'piv' => $request->get('piv'), - )); + ]); } public function indexThesaurus(Application $app, Request $request) @@ -770,10 +770,10 @@ class Thesaurus implements ControllerProviderInterface HAVING bas_edit_thesaurus > 0 ORDER BY sbas.ord"; - $bases = $languages = array(); + $bases = $languages = []; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute(array(':usr_id' => $app['authentication']->getUser()->get_id())); + $stmt->execute([':usr_id' => $app['authentication']->getUser()->get_id()]); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -791,10 +791,10 @@ class Thesaurus implements ControllerProviderInterface $languages[$lng_code[0]] = $lng; } - return $app['twig']->render('thesaurus/index.html.twig', array( + return $app['twig']->render('thesaurus/index.html.twig', [ 'languages' => $languages, 'bases' => $bases, - )); + ]); } public function linkFieldStep1(Application $app, Request $request) @@ -830,7 +830,7 @@ class Thesaurus implements ControllerProviderInterface $fullBranch = " / " . $sy . $fullBranch; } } - $fieldnames = array(); + $fieldnames = []; $nodes = $xpathstruct->query("/record/description/*"); for ($i = 0; $i < $nodes->length; $i ++) { $fieldname = $nodes->item($i)->nodeName; @@ -852,13 +852,13 @@ class Thesaurus implements ControllerProviderInterface } - return $app['twig']->render('thesaurus/link-field-step1.html.twig', array( + return $app['twig']->render('thesaurus/link-field-step1.html.twig', [ 'piv' => $request->get('piv'), 'bid' => $request->get('bid'), 'tid' => $request->get('tid'), 'fullBranch' => $fullBranch, 'fieldnames' => $fieldnames - )); + ]); } public function linkFieldStep2(Application $app, Request $request) @@ -867,7 +867,7 @@ class Thesaurus implements ControllerProviderInterface return new Response('Missing bid parameter', 400); } - $oldlinks = array(); + $oldlinks = []; $needreindex = false; try { @@ -884,7 +884,7 @@ class Thesaurus implements ControllerProviderInterface $fieldname = $nodes->item($i)->nodeName; $oldbranch = $nodes->item($i)->getAttribute("tbranch"); $ck = false; - $tids = array(); // les ids de branches liees e ce champ + $tids = []; // les ids de branches liees e ce champ if ($oldbranch) { // ce champ a deje un tbranch, on balaye les branches auxquelles il est lie $thnodes = $xpathth->query($oldbranch); @@ -900,7 +900,7 @@ class Thesaurus implements ControllerProviderInterface } } - if (in_array($fieldname, $request->get('field', array())) != $ck) { + if (in_array($fieldname, $request->get('field', [])) != $ck) { if ($ck) { // print("il etait lie a la branche, il ne l'est plus' . $fn . ': ' . str_replace(array('&', '<', '>'), array('&', '<', '>'), $fv) . '
' . "\n"; + $desc .= '' . $fn . ': ' . str_replace(['&', '<', '>'], ['&', '<', '>'], $fv) . '
' . "\n"; } ob_start(); @@ -505,10 +505,10 @@ class Xmlhttp implements ControllerProviderInterface $ret->standalone = true; $ret->preserveWhiteSpace = false; $root = $ret->appendChild($ret->createElement("result")); - $root->appendChild($ret->createCDATASection(var_export(array( + $root->appendChild($ret->createCDATASection(var_export([ 'bid' => $request->get('bid'), 'id' => $request->get('id'), - ), true))); + ], true))); if (null !== $request->get('bid')) { @@ -527,7 +527,7 @@ class Xmlhttp implements ControllerProviderInterface } } - return new Response($ret->saveXML(), 200, array('Content-Type' => 'text/xml')); + return new Response($ret->saveXML(), 200, ['Content-Type' => 'text/xml']); } public function GetTermHtml(Application $app, Request $request) @@ -560,14 +560,14 @@ class Xmlhttp implements ControllerProviderInterface $nodes = $xpath->query($q); if ($nodes->length > 0) { $nts = 0; - $tts = array(); + $tts = []; // on dresse la liste des termes specifiques avec comme cle le synonyme // dans la langue pivot for ($n = $nodes->item(0)->firstChild; $n; $n = $n->nextSibling) { if ($n->nodeName == "te") { $nts++; $allsy = ""; - $tsy = array(); + $tsy = []; $firstksy = null; $ksy = $realksy = null; // on liste les sy pour fabriquer la cle @@ -587,16 +587,16 @@ class Xmlhttp implements ControllerProviderInterface $realksy = $ksy; $allsy = $t . ($allsy ? " ; " : "") . $allsy; - array_push($tsy, array( + array_push($tsy, [ "id" => $n2->getAttribute("id"), "sy" => $t - )); + ]); } else { $allsy .= ( $allsy ? " ; " : "") . $t; - array_push($tsy, array( + array_push($tsy, [ "id" => $n2->getAttribute("id"), "sy" => $t - )); + ]); } } } @@ -609,19 +609,19 @@ class Xmlhttp implements ControllerProviderInterface break; } } - $tts[$realksy . "_" . $uniq] = array( + $tts[$realksy . "_" . $uniq] = [ "id" => $n->getAttribute("id"), "allsy" => $allsy, "nchild" => $xpath->query("te", $n)->length, "tsy" => $tsy - ); + ]; } else { - $tts[] = array( + $tts[] = [ "id" => $n->getAttribute("id"), "allsy" => $allsy, "nchild" => $xpath->query("te", $n)->length, "tsy" => $tsy - ); + ]; } } elseif ($n->nodeName == "sy") { @@ -671,12 +671,12 @@ class Xmlhttp implements ControllerProviderInterface $ret->standalone = true; $ret->preserveWhiteSpace = false; $root = $ret->appendChild($ret->createElement("result")); - $root->appendChild($ret->createCDATASection(var_export(array( + $root->appendChild($ret->createCDATASection(var_export([ "bid" => $request->get('bid'), "id" => $request->get('id'), "sortsy" => $request->get('sortsy'), "debug" => $request->get('debug'), - ), true))); + ], true))); $html = $root->appendChild($ret->createElement("html")); @@ -705,14 +705,14 @@ class Xmlhttp implements ControllerProviderInterface $nodes = $xpath->query($q); if ($nodes->length > 0) { $nts = 0; - $tts = array(); + $tts = []; // on dresse la liste des termes specifiques avec comme cle le synonyme // dans la langue pivot for ($n = $nodes->item(0)->firstChild; $n; $n = $n->nextSibling) { if ($n->nodeName == "te") { $nts++; $allsy = ""; - $tsy = array(); + $tsy = []; $firstksy = null; $ksy = $realksy = null; // on liste les sy pour fabriquer la cle @@ -733,16 +733,16 @@ class Xmlhttp implements ControllerProviderInterface $realksy = $ksy; $allsy = $t . ($allsy ? " ; " : "") . $allsy; - array_push($tsy, array( + array_push($tsy, [ "id" => $n2->getAttribute("id"), "sy" => $t - )); + ]); } else { $allsy .= ( $allsy ? " ; " : "") . $t; - array_push($tsy, array( + array_push($tsy, [ "id" => $n2->getAttribute("id"), "sy" => $t - )); + ]); } } } @@ -755,19 +755,19 @@ class Xmlhttp implements ControllerProviderInterface break; } } - $tts[$realksy . "_" . $uniq] = array( + $tts[$realksy . "_" . $uniq] = [ "id" => $n->getAttribute("id"), "allsy" => $allsy, "nchild" => $xpath->query("te", $n)->length, "tsy" => $tsy - ); + ]; } else { - $tts[] = array( + $tts[] = [ "id" => $n->getAttribute("id"), "allsy" => $allsy, "nchild" => $xpath->query("te", $n)->length, "tsy" => $tsy - ); + ]; } } elseif ($n->nodeName == "sy") { @@ -810,7 +810,7 @@ class Xmlhttp implements ControllerProviderInterface $html->appendChild($ret->createTextNode($zhtml)); } - return new Response($ret->saveXML(), 200, array('Content-Type' => 'text/xml')); + return new Response($ret->saveXML(), 200, ['Content-Type' => 'text/xml']); } public function OpenBranchJson(Application $app, Request $request) @@ -833,7 +833,7 @@ class Xmlhttp implements ControllerProviderInterface $connbas = \connection::getPDOConnection($app, $sbid); $dbname = \phrasea::sbas_labels($sbid, $app); - $t_nrec = array(); + $t_nrec = []; $lthid = strlen($thid); // count occurences @@ -844,7 +844,7 @@ class Xmlhttp implements ControllerProviderInterface FROM thit WHERE value LIKE :like '; $stmt = $connbas->prepare($sql); - $stmt->execute(array(':like' => $dthid . '%')); + $stmt->execute([':like' => $dthid . '%']); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -860,7 +860,7 @@ class Xmlhttp implements ControllerProviderInterface GROUP BY k'; $stmt = $connbas->prepare($sql); - $stmt->execute(array(':like' => $dthid . '%')); + $stmt->execute([':like' => $dthid . '%']); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -877,7 +877,7 @@ class Xmlhttp implements ControllerProviderInterface GROUP BY k'; $stmt = $connbas->prepare($sql); - $stmt->execute(array(':like' => $dthid . '%')); + $stmt->execute([':like' => $dthid . '%']); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -893,7 +893,7 @@ class Xmlhttp implements ControllerProviderInterface GROUP BY k'; $stmt = $connbas->prepare($sql); - $stmt->execute(array(':like' => $dthid . '%')); + $stmt->execute([':like' => $dthid . '%']); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -948,7 +948,7 @@ class Xmlhttp implements ControllerProviderInterface // on dresse la liste des termes specifiques avec comme cle le synonyme dans la langue pivot $nts = 0; - $tts = array(); + $tts = []; for ($n = $node0->firstChild; $n; $n = $n->nextSibling) { if ($n->nodeName == 'te' && !$n->getAttribute('delbranch') && substr($n->getAttribute('id'), 0, 1) != 'R') { $nts++; @@ -963,11 +963,11 @@ class Xmlhttp implements ControllerProviderInterface break; } } - $tts[$key0 . '_' . $uniq] = array( + $tts[$key0 . '_' . $uniq] = [ 'label' => $label, 'nts' => $nts0, 'n' => $n - ); + ]; } } @@ -1027,7 +1027,7 @@ class Xmlhttp implements ControllerProviderInterface } - return $app->json(array('parm' => array( + return $app->json(['parm' => [ 'sbid' => $request->get('sbid'), 'type' => $request->get('type'), 'id' => $request->get('id'), @@ -1036,7 +1036,7 @@ class Xmlhttp implements ControllerProviderInterface 'debug' => $request->get('debug'), 'root' => $request->get('root'), 'last' => $request->get('last'), - ), 'html' => $html)); + ], 'html' => $html]); } private function buildBranchLabel($dbname, $language, $n, &$key0, &$nts0) @@ -1165,7 +1165,7 @@ class Xmlhttp implements ControllerProviderInterface } } - return array($term, $context); + return [$term, $context]; } private function getBranchesHTML($bid, $srcnode, &$html, $depth) @@ -1230,12 +1230,12 @@ class Xmlhttp implements ControllerProviderInterface $ret->standalone = true; $ret->preserveWhiteSpace = false; $root = $ret->appendChild($ret->createElement('result')); - $root->appendChild($ret->createCDATASection(var_export(array( + $root->appendChild($ret->createCDATASection(var_export([ 'bid' => $request->get('bid'), 't' => $request->get('t'), 'mod' => $request->get('mod'), 'debug' => $request->get('debug'), - ), true))); + ], true))); $html = $root->appendChild($ret->createElement('html')); @@ -1288,7 +1288,7 @@ class Xmlhttp implements ControllerProviderInterface $html->appendChild($ret->createTextNode($zhtml)); } - return new Response($zhtml, 200, array('Content-Type' => 'text/xml')); + return new Response($zhtml, 200, ['Content-Type' => 'text/xml']); } private function getBrancheXML($bid, $srcnode, &$html, $depth) @@ -1344,28 +1344,28 @@ class Xmlhttp implements ControllerProviderInterface public function ReplaceCandidateJson(Application $app, Request $request) { - $tsbas = array(); + $tsbas = []; - $ret = array( - 'ctermsDeleted' => array(), + $ret = [ + 'ctermsDeleted' => [], 'maxRecsUpdatable' => self::SEARCH_REPLACE_MAXREC, 'nRecsToUpdate' => 0, 'nRecsUpdated' => 0, 'msg' => '' - ); + ]; foreach ($request->get('id') as $id) { $id = explode('.', $id); $sbas_id = array_shift($id); if (!array_key_exists('b' . $sbas_id, $tsbas)) { - $tsbas['b' . $sbas_id] = array( + $tsbas['b' . $sbas_id] = [ 'sbas_id' => (int) $sbas_id, - 'tids' => array(), + 'tids' => [], 'domct' => null, - 'tvals' => array(), + 'tvals' => [], 'lid' => '', - 'trids' => array() - ); + 'trids' => [] + ]; } $tsbas['b' . $sbas_id]['tids'][] = implode('.', $id); } @@ -1402,7 +1402,7 @@ class Xmlhttp implements ControllerProviderInterface $field = $sy->parentNode->parentNode->getAttribute('field'); if (!array_key_exists($field, $tsbas[$ksbas]['tvals'])) { - $tsbas[$ksbas]['tvals'][$field] = array(); + $tsbas[$ksbas]['tvals'][$field] = []; } $tsbas[$ksbas]['tvals'][$field][] = $sy; } @@ -1443,8 +1443,8 @@ class Xmlhttp implements ControllerProviderInterface try { $record = $databox->get_record($rid); - $metadatask = array(); // datas to keep - $metadatasd = array(); // datas to delete + $metadatask = []; // datas to keep + $metadatasd = []; // datas to delete /* @var $field caption_field */ foreach ($record->get_caption()->get_fields(null, true) as $field) { @@ -1453,11 +1453,11 @@ class Xmlhttp implements ControllerProviderInterface $fname = $field->get_name(); if (!array_key_exists($fname, $sbas['tvals'])) { foreach ($field->get_values() as $v) { - $metadatask[] = array( + $metadatask[] = [ 'meta_struct_id' => $meta_struct_id, 'meta_id' => $v->getId(), 'value' => $v->getValue() - ); + ]; } } else { foreach ($field->get_values() as $v) { @@ -1470,17 +1470,17 @@ class Xmlhttp implements ControllerProviderInterface } if ($keep) { - $metadatask[] = array( + $metadatask[] = [ 'meta_struct_id' => $meta_struct_id, 'meta_id' => $v->getId(), 'value' => $v->getValue() - ); + ]; } else { - $metadatasd[] = array( + $metadatasd[] = [ 'meta_struct_id' => $meta_struct_id, 'meta_id' => $v->getId(), 'value' => $request->get('t') ? $request->get('t') : '' - ); + ]; } } } @@ -1590,13 +1590,13 @@ class Xmlhttp implements ControllerProviderInterface } - return $app->json(array('parm' => array( + return $app->json(['parm' => [ 'sbid' => $request->get('sbid'), 't' => $request->get('t'), 'field' => $request->get('field'), 'lng' => $request->get('lng'), 'debug' => $request->get('debug'), - ), 'html' => $html)); + ], 'html' => $html]); } private function buildTermLabel($language, $n, &$key0, &$nts0) @@ -1648,7 +1648,7 @@ class Xmlhttp implements ControllerProviderInterface // let's work on each 'te' (=ts) subnode $nts = 0; $ntsopened = 0; - $tts = array(); + $tts = []; for ($n = $srcnode->firstChild; $n; $n = $n->nextSibling) { if ($n->nodeName == 'te') { if ($n->getAttribute('open')) { @@ -1661,7 +1661,7 @@ class Xmlhttp implements ControllerProviderInterface if (!isset($tts[$key0 . '_' . $uniq])) break; } - $tts[$key0 . '_' . $uniq] = array('label' => $label, 'nts' => $nts0, 'n' => $n); + $tts[$key0 . '_' . $uniq] = ['label' => $label, 'nts' => $nts0, 'n' => $n]; $ntsopened++; } $nts++; diff --git a/lib/Alchemy/Phrasea/Controller/User/Notifications.php b/lib/Alchemy/Phrasea/Controller/User/Notifications.php index 77081a2238..ad9e441fa8 100644 --- a/lib/Alchemy/Phrasea/Controller/User/Notifications.php +++ b/lib/Alchemy/Phrasea/Controller/User/Notifications.php @@ -60,9 +60,9 @@ class Notifications implements ControllerProviderInterface $app['authentication']->getUser()->get_id() ); - return $app->json(array('success' => true, 'message' => '')); + return $app->json(['success' => true, 'message' => '']); } catch (\Exception $e) { - return $app->json(array('success' => false, 'message' => $e->getMessage())); + return $app->json(['success' => false, 'message' => $e->getMessage()]); } } diff --git a/lib/Alchemy/Phrasea/Controller/User/Preferences.php b/lib/Alchemy/Phrasea/Controller/User/Preferences.php index 318cb2bcf5..fa2b4f86b2 100644 --- a/lib/Alchemy/Phrasea/Controller/User/Preferences.php +++ b/lib/Alchemy/Phrasea/Controller/User/Preferences.php @@ -65,7 +65,7 @@ class Preferences implements ControllerProviderInterface $msg = _('Preference saved !'); } - return new JsonResponse(array('success' => $success, 'message' => $msg)); + return new JsonResponse(['success' => $success, 'message' => $msg]); } /** @@ -92,6 +92,6 @@ class Preferences implements ControllerProviderInterface $msg = _('Preference saved !'); } - return new JsonResponse(array('success' => $success, 'message' => $msg)); + return new JsonResponse(['success' => $success, 'message' => $msg]); } } diff --git a/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php b/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php index 7296201b8e..63d0bcd42b 100644 --- a/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php +++ b/lib/Alchemy/Phrasea/Controller/Utils/ConnectionTest.php @@ -42,7 +42,7 @@ class ConnectionTest implements ControllerProviderInterface $connection_ok = $db_ok = $is_databox = $is_appbox = $empty = false; try { - $conn = new \connection_pdo('test', $hostname, $port, $user, $password, null, array(), false); + $conn = new \connection_pdo('test', $hostname, $port, $user, $password, null, [], false); $connection_ok = true; } catch (\Exception $e) { @@ -50,7 +50,7 @@ class ConnectionTest implements ControllerProviderInterface if ($dbname && $connection_ok === true) { try { - $conn = new \connection_pdo('test', $hostname, $port, $user, $password, $dbname, array(), false); + $conn = new \connection_pdo('test', $hostname, $port, $user, $password, $dbname, [], false); $db_ok = true; $sql = "SHOW TABLE STATUS"; @@ -75,13 +75,13 @@ class ConnectionTest implements ControllerProviderInterface } } - $datas = array( + $datas = [ 'connection' => $connection_ok , 'database' => $db_ok , 'is_empty' => $empty , 'is_appbox' => $is_appbox , 'is_databox' => $is_databox - ); + ]; return $app->json($datas); }); diff --git a/lib/Alchemy/Phrasea/Controller/Utils/PathFileTest.php b/lib/Alchemy/Phrasea/Controller/Utils/PathFileTest.php index 469772431c..410d063e30 100644 --- a/lib/Alchemy/Phrasea/Controller/Utils/PathFileTest.php +++ b/lib/Alchemy/Phrasea/Controller/Utils/PathFileTest.php @@ -32,18 +32,18 @@ class PathFileTest implements ControllerProviderInterface * @todo : check this as it would lead to a security issue */ $controllers->get('/path/', function (Application $app, Request $request) { - return $app->json(array( + return $app->json([ 'exists' => file_exists($request->query->get('path')) , 'file' => is_file($request->query->get('path')) , 'dir' => is_dir($request->query->get('path')) , 'readable' => is_readable($request->query->get('path')) , 'writeable' => is_writable($request->query->get('path')) , 'executable' => is_executable($request->query->get('path')) - )); + ]); }); $controllers->get('/url/', function (Application $app, Request $request) { - return $app->json(array('code' => \http_query::getHttpCodeFromUrl($request->query->get('url')))); + return $app->json(['code' => \http_query::getHttpCodeFromUrl($request->query->get('url'))]); }); return $controllers; diff --git a/lib/Alchemy/Phrasea/Core/CLIProvider/CLIDriversServiceProvider.php b/lib/Alchemy/Phrasea/Core/CLIProvider/CLIDriversServiceProvider.php index f2a41879f1..1bf4aee688 100644 --- a/lib/Alchemy/Phrasea/Core/CLIProvider/CLIDriversServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/CLIProvider/CLIDriversServiceProvider.php @@ -30,7 +30,7 @@ class CLIDriversServiceProvider implements ServiceProviderInterface }); $app['driver.binary-finder'] = $app->protect(function ($name, $configName) use ($app) { - $extraDirs = array(); + $extraDirs = []; if (is_dir($app['root.path'] . '/node_modules')) { $extraDirs[] = $app['root.path'] . '/node_modules/.bin'; @@ -54,7 +54,7 @@ class CLIDriversServiceProvider implements ServiceProviderInterface throw new RuntimeException('Unable to find bower executable.'); } - return BowerDriver::create(array('bower.binaries' => $bowerBinary, 'timeout' => 300), $app['monolog']); + return BowerDriver::create(['bower.binaries' => $bowerBinary, 'timeout' => 300], $app['monolog']); }); $app['driver.recess'] = $app->share(function (Application $app) { @@ -64,7 +64,7 @@ class CLIDriversServiceProvider implements ServiceProviderInterface throw new RuntimeException('Unable to find recess executable.'); } - return RecessDriver::create(array('recess.binaries' => $recessBinary), $app['monolog']); + return RecessDriver::create(['recess.binaries' => $recessBinary], $app['monolog']); }); $app['driver.composer'] = $app->share(function (Application $app) { @@ -74,7 +74,7 @@ class CLIDriversServiceProvider implements ServiceProviderInterface throw new RuntimeException('Unable to find composer executable.'); } - return ComposerDriver::create(array('composer.binaries' => $composerBinary, 'timeout' => 300), $app['monolog']); + return ComposerDriver::create(['composer.binaries' => $composerBinary, 'timeout' => 300], $app['monolog']); }); $app['driver.uglifyjs'] = $app->share(function (Application $app) { @@ -84,7 +84,7 @@ class CLIDriversServiceProvider implements ServiceProviderInterface throw new RuntimeException('Unable to find uglifyJs executable.'); } - return UglifyJsDriver::create(array('uglifyjs.binaries' => $uglifyJsBinary), $app['monolog']); + return UglifyJsDriver::create(['uglifyjs.binaries' => $uglifyJsBinary], $app['monolog']); }); $app['driver.grunt'] = $app->share(function (Application $app) { @@ -94,7 +94,7 @@ class CLIDriversServiceProvider implements ServiceProviderInterface throw new RuntimeException('Unable to find grunt executable.'); } - return GruntDriver::create(array('grunt.binaries' => $gruntBinary), $app['monolog']); + return GruntDriver::create(['grunt.binaries' => $gruntBinary], $app['monolog']); }); } diff --git a/lib/Alchemy/Phrasea/Core/CLIProvider/LessBuilderServiceProvider.php b/lib/Alchemy/Phrasea/Core/CLIProvider/LessBuilderServiceProvider.php index 5c2158e056..c5d0f2132b 100644 --- a/lib/Alchemy/Phrasea/Core/CLIProvider/LessBuilderServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/CLIProvider/LessBuilderServiceProvider.php @@ -21,21 +21,21 @@ class LessBuilderServiceProvider implements ServiceProviderInterface public function register(Application $app) { $app['phraseanet.less-assets'] = $app->share(function ($app) { - return array( + return [ $app['root.path'] . '/www/assets/bootstrap/img/glyphicons-halflings-white.png' => $app['root.path'] . '/www/skins/build/bootstrap/img/glyphicons-halflings-white.png', $app['root.path'] . '/www/assets/bootstrap/img/glyphicons-halflings.png' => $app['root.path'] . '/www/skins/build/bootstrap/img/glyphicons-halflings.png', - ); + ]; }); $app['phraseanet.less-mapping.base'] = $app->share(function ($app) { - return array(); + return []; }); $app['phraseanet.less-mapping.customizable'] = $app->share(function ($app) { - return array( + return [ $app['root.path'] . '/www/skins/login/less/login.less' => $app['root.path'] . '/www/assets/build/login.css', $app['root.path'] . '/www/skins/account/account.less' => $app['root.path'] . '/www/assets/build/account.css', - ); + ]; }); $app['phraseanet.less-mapping'] = $app->share(function ($app) { diff --git a/lib/Alchemy/Phrasea/Core/CLIProvider/PluginServiceProvider.php b/lib/Alchemy/Phrasea/Core/CLIProvider/PluginServiceProvider.php index f0d656ca90..c85c11d036 100644 --- a/lib/Alchemy/Phrasea/Core/CLIProvider/PluginServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/CLIProvider/PluginServiceProvider.php @@ -71,9 +71,9 @@ class PluginServiceProvider implements ServiceProviderInterface }); $app['plugins.importer'] = $app->share(function (Application $app) { - return new Importer($app['plugins.import-strategy'], array( + return new Importer($app['plugins.import-strategy'], [ 'plugins.importer.folder-importer' => $app['plugins.importer.folder-importer'], - )); + ]); }); $app['plugins.importer.folder-importer'] = $app->share(function (Application $app) { diff --git a/lib/Alchemy/Phrasea/Core/CLIProvider/TaskManagerServiceProvider.php b/lib/Alchemy/Phrasea/Core/CLIProvider/TaskManagerServiceProvider.php index c8b27ef3af..973e683b24 100644 --- a/lib/Alchemy/Phrasea/Core/CLIProvider/TaskManagerServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/CLIProvider/TaskManagerServiceProvider.php @@ -37,11 +37,11 @@ class TaskManagerServiceProvider implements ServiceProviderInterface $app['dispatcher'], $app['task-manager.logger'], $app['task-manager.task-list'], - array( + [ 'listener_protocol' => $options['protocol'], 'listener_host' => $options['host'], 'listener_port' => $options['port'], - ) + ] ); }); diff --git a/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php b/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php index cf625fd8e2..9601fc2caa 100644 --- a/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php +++ b/lib/Alchemy/Phrasea/Core/Configuration/Configuration.php @@ -162,10 +162,10 @@ class Configuration implements ConfigurationInterface public function delete() { $this->cache = null; - foreach (array( + foreach ([ $this->config, $this->compiled, - ) as $file) { + ] as $file) { $this->eraseFile($file); } } @@ -196,11 +196,11 @@ class Configuration implements ConfigurationInterface public function getTestConnectionParameters() { - return array( + return [ 'driver' => 'pdo_sqlite', 'path' => '/tmp/db.sqlite', 'charset' => 'UTF8', - ); + ]; } private function loadDefaultConfiguration() diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/ApiExceptionHandlerSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/ApiExceptionHandlerSubscriber.php index ecac06bd66..416aa292be 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/ApiExceptionHandlerSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/ApiExceptionHandlerSubscriber.php @@ -33,14 +33,14 @@ class ApiExceptionHandlerSubscriber implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::EXCEPTION => array('onSilexError', 0), - ); + return [ + KernelEvents::EXCEPTION => ['onSilexError', 0], + ]; } public function onSilexError(GetResponseForExceptionEvent $event) { - $headers = array(); + $headers = []; $e = $event->getException(); if ($e instanceof \API_V1_exception_methodnotallowed) { diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/ApiOauth2ErrorsSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/ApiOauth2ErrorsSubscriber.php index f0ea27a88e..b4a837ad29 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/ApiOauth2ErrorsSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/ApiOauth2ErrorsSubscriber.php @@ -29,9 +29,9 @@ class ApiOauth2ErrorsSubscriber implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::EXCEPTION => array('onSilexError', 20), - ); + return [ + KernelEvents::EXCEPTION => ['onSilexError', 20], + ]; } public function onSilexError(GetResponseForExceptionEvent $event) @@ -46,7 +46,7 @@ class ApiOauth2ErrorsSubscriber implements EventSubscriberInterface $code = 500; $msg = _('Whoops, looks like something went wrong.'); - $headers = array(); + $headers = []; if ($e instanceof HttpExceptionInterface) { $headers = $e->getHeaders(); @@ -55,7 +55,7 @@ class ApiOauth2ErrorsSubscriber implements EventSubscriberInterface } if (isset($headers['content-type']) && $headers['content-type'] == 'application/json') { - $msg = json_encode(array('msg' => $msg, 'code' => $code)); + $msg = json_encode(['msg' => $msg, 'code' => $code]); $event->setResponse(new Response($msg, $code, $headers)); } else { $event->setResponse($this->handler->createResponseBasedOnRequest($event->getRequest(), $event->getException())); diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/BridgeExceptionSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/BridgeExceptionSubscriber.php index b0ceeb3d09..77c6b8362d 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/BridgeExceptionSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/BridgeExceptionSubscriber.php @@ -35,9 +35,9 @@ class BridgeExceptionSubscriber implements EventSubscriberInterface $e = $event->getException(); $request = $event->getRequest(); - $params = array( + $params = [ 'account' => null, - 'elements' => array(), + 'elements' => [], 'message' => $e->getMessage(), 'error_message' => null, 'notice_message' => null, @@ -45,23 +45,23 @@ class BridgeExceptionSubscriber implements EventSubscriberInterface 'line' => $e->getLine(), 'r_method' => $request->getMethod(), 'r_action' => $request->getRequestUri(), - 'r_parameters' => ($request->getMethod() == 'GET' ? array() : $request->request->all()), - ); + 'r_parameters' => ($request->getMethod() == 'GET' ? [] : $request->request->all()), + ]; if ($e instanceof \Bridge_Exception_ApiConnectorNotConfigured) { - $params = array_replace($params, array('account' => $this->app['bridge.account'])); - $response = new Response($this->app['twig']->render('/prod/actions/Bridge/notconfigured.html.twig', $params), 200, array('X-Status-Code' => 200)); + $params = array_replace($params, ['account' => $this->app['bridge.account']]); + $response = new Response($this->app['twig']->render('/prod/actions/Bridge/notconfigured.html.twig', $params), 200, ['X-Status-Code' => 200]); } elseif ($e instanceof \Bridge_Exception_ApiConnectorNotConnected) { - $params = array_replace($params, array('account' => $this->app['bridge.account'])); - $response = new Response($this->app['twig']->render('/prod/actions/Bridge/disconnected.html.twig', $params), 200, array('X-Status-Code' => 200)); + $params = array_replace($params, ['account' => $this->app['bridge.account']]); + $response = new Response($this->app['twig']->render('/prod/actions/Bridge/disconnected.html.twig', $params), 200, ['X-Status-Code' => 200]); } elseif ($e instanceof \Bridge_Exception_ApiConnectorAccessTokenFailed) { - $params = array_replace($params, array('account' => $this->app['bridge.account'])); - $response = new Response($this->app['twig']->render('/prod/actions/Bridge/disconnected.html.twig', $params), 200, array('X-Status-Code' => 200)); + $params = array_replace($params, ['account' => $this->app['bridge.account']]); + $response = new Response($this->app['twig']->render('/prod/actions/Bridge/disconnected.html.twig', $params), 200, ['X-Status-Code' => 200]); } elseif ($e instanceof \Bridge_Exception_ApiDisabled) { - $params = array_replace($params, array('api' => $e->get_api())); - $response = new Response($this->app['twig']->render('/prod/actions/Bridge/deactivated.html.twig', $params), 200, array('X-Status-Code' => 200)); + $params = array_replace($params, ['api' => $e->get_api()]); + $response = new Response($this->app['twig']->render('/prod/actions/Bridge/deactivated.html.twig', $params), 200, ['X-Status-Code' => 200]); } else { - $response = new Response($this->app['twig']->render('/prod/actions/Bridge/error.html.twig', $params), 200, array('X-Status-Code' => 200)); + $response = new Response($this->app['twig']->render('/prod/actions/Bridge/error.html.twig', $params), 200, ['X-Status-Code' => 200]); } $response->headers->set('Phrasea-StatusCode', 200); @@ -74,6 +74,6 @@ class BridgeExceptionSubscriber implements EventSubscriberInterface */ public static function getSubscribedEvents() { - return array(KernelEvents::EXCEPTION => array('onSilexError', 20)); + return [KernelEvents::EXCEPTION => ['onSilexError', 20]]; } } diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/CookiesDisablerSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/CookiesDisablerSubscriber.php index b7b5f9a763..a8b3205ea2 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/CookiesDisablerSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/CookiesDisablerSubscriber.php @@ -32,10 +32,10 @@ class CookiesDisablerSubscriber implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array('checkRoutePattern', 512), - KernelEvents::RESPONSE => array('removeCookies', -512), - ); + return [ + KernelEvents::REQUEST => ['checkRoutePattern', 512], + KernelEvents::RESPONSE => ['removeCookies', -512], + ]; } public function checkRoutePattern(GetResponseEvent $event) diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/DebuggerSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/DebuggerSubscriber.php index 23d24061ce..657c8d7db6 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/DebuggerSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/DebuggerSubscriber.php @@ -28,11 +28,11 @@ class DebuggerSubscriber implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array( - array('checkIp', 255), - ), - ); + return [ + KernelEvents::REQUEST => [ + ['checkIp', 255], + ], + ]; } public function checkIp(GetResponseEvent $event) @@ -46,12 +46,12 @@ class DebuggerSubscriber implements EventSubscriberInterface && isset($this->app['configuration']['debugger']['allowed-ips'])) { $allowedIps = $this->app['configuration']['debugger']['allowed-ips']; - $allowedIps = is_array($allowedIps) ? $allowedIps : array($allowedIps); + $allowedIps = is_array($allowedIps) ? $allowedIps : [$allowedIps]; } else { - $allowedIps = array(); + $allowedIps = []; } - $ips = array_merge(array('127.0.0.1', 'fe80::1', '::1'), $allowedIps); + $ips = array_merge(['127.0.0.1', 'fe80::1', '::1'], $allowedIps); if (!in_array($event->getRequest()->getClientIp(), $ips)) { throw new AccessDeniedHttpException('You are not allowed to access this file. Check index_dev.php for more information.'); diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/FirewallSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/FirewallSubscriber.php index f28c2662a9..6e58beb1a7 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/FirewallSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/FirewallSubscriber.php @@ -22,10 +22,10 @@ class FirewallSubscriber implements EventSubscriberInterface { public static function getSubscribedEvents() { - return array( - KernelEvents::RESPONSE => array('onKernelResponse', 0), - KernelEvents::EXCEPTION => array('onSilexError', 20), - ); + return [ + KernelEvents::RESPONSE => ['onKernelResponse', 0], + KernelEvents::EXCEPTION => ['onSilexError', 20], + ]; } public function onKernelResponse(FilterResponseEvent $event) @@ -43,7 +43,7 @@ class FirewallSubscriber implements EventSubscriberInterface $headers = $e->getHeaders(); if (isset($headers['X-Phraseanet-Redirect'])) { - $event->setResponse(new RedirectResponse($headers['X-Phraseanet-Redirect'], 302, array('X-Status-Code' => 302))); + $event->setResponse(new RedirectResponse($headers['X-Phraseanet-Redirect'], 302, ['X-Status-Code' => 302])); } } } diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/JsonRequestSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/JsonRequestSubscriber.php index d21e902e69..da7774bed5 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/JsonRequestSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/JsonRequestSubscriber.php @@ -27,12 +27,12 @@ class JsonRequestSubscriber implements EventSubscriberInterface || 0 === strpos($request->getPathInfo(), '/admin/collection/') || 0 === strpos($request->getPathInfo(), '/admin/databox/')) && $request->getRequestFormat() == 'json') { - $datas = array( + $datas = [ 'success' => false, 'message' => $exception->getMessage(), - ); + ]; - $event->setResponse(new JsonResponse($datas, 200, array('X-Status-Code' => 200))); + $event->setResponse(new JsonResponse($datas, 200, ['X-Status-Code' => 200])); } } @@ -41,6 +41,6 @@ class JsonRequestSubscriber implements EventSubscriberInterface */ public static function getSubscribedEvents() { - return array(KernelEvents::EXCEPTION => array('onSilexError', 10)); + return [KernelEvents::EXCEPTION => ['onSilexError', 10]]; } } diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/LogoutSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/LogoutSubscriber.php index 74c4372ff0..ad11289532 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/LogoutSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/LogoutSubscriber.php @@ -25,8 +25,8 @@ class LogoutSubscriber implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( + return [ PhraseaEvents::LOGOUT => 'onLogout', - ); + ]; } } diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/MaintenanceSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/MaintenanceSubscriber.php index f5c17feebe..e28a4ec374 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/MaintenanceSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/MaintenanceSubscriber.php @@ -27,15 +27,15 @@ class MaintenanceSubscriber implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array('checkForMaintenance', 0), - ); + return [ + KernelEvents::REQUEST => ['checkForMaintenance', 0], + ]; } public function checkForMaintenance(GetResponseEvent $event) { if ($this->app['configuration']->isSetup() && $this->app['configuration']['main']['maintenance']) { - $this->app->abort(503, 'Service Temporarily Unavailable', array('Retry-After' => 3600)); + $this->app->abort(503, 'Service Temporarily Unavailable', ['Retry-After' => 3600]); } } } diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/PersistentCookieSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/PersistentCookieSubscriber.php index 0f0a675fcc..205a4fb3a8 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/PersistentCookieSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/PersistentCookieSubscriber.php @@ -27,9 +27,9 @@ class PersistentCookieSubscriber implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array('checkPersistentCookie', 128), - ); + return [ + KernelEvents::REQUEST => ['checkPersistentCookie', 128], + ]; } public function checkPersistentCookie(GetResponseEvent $event) diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/PhraseaExceptionHandlerSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/PhraseaExceptionHandlerSubscriber.php index 24973b0a73..b6ccd33eb5 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/PhraseaExceptionHandlerSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/PhraseaExceptionHandlerSubscriber.php @@ -46,6 +46,6 @@ class PhraseaExceptionHandlerSubscriber implements EventSubscriberInterface */ public static function getSubscribedEvents() { - return array(KernelEvents::EXCEPTION => array('onSilexError', 0)); + return [KernelEvents::EXCEPTION => ['onSilexError', 0]]; } } diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/PhraseaLocaleSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/PhraseaLocaleSubscriber.php index ef908ba83a..8ffa88edca 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/PhraseaLocaleSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/PhraseaLocaleSubscriber.php @@ -30,20 +30,20 @@ class PhraseaLocaleSubscriber implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array( - array('addLocale', 255), + return [ + KernelEvents::REQUEST => [ + ['addLocale', 255], // symfony locale is set on 16 priority, let's override it - array('addLocale', 17), - array('addLocale', 15), - ), - KernelEvents::RESPONSE => array( - array('addLocaleCookie', 8), - ), - KernelEvents::FINISH_REQUEST => array( - array('unsetLocale', -255), - ) - ); + ['addLocale', 17], + ['addLocale', 15], + ], + KernelEvents::RESPONSE => [ + ['addLocaleCookie', 8], + ], + KernelEvents::FINISH_REQUEST => [ + ['unsetLocale', -255], + ] + ]; } public function unsetLocale() diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/TrustedProxySubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/TrustedProxySubscriber.php index 8be4c78530..f9aa1516db 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/TrustedProxySubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/TrustedProxySubscriber.php @@ -28,9 +28,9 @@ class TrustedProxySubscriber implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array('setProxyConf', 0), - ); + return [ + KernelEvents::REQUEST => ['setProxyConf', 0], + ]; } public function setProxyConf(GetResponseEvent $event) @@ -39,7 +39,7 @@ class TrustedProxySubscriber implements EventSubscriberInterface return; } - $proxies = isset($this->configuration['trusted-proxies']) ? $this->configuration['trusted-proxies'] : array(); + $proxies = isset($this->configuration['trusted-proxies']) ? $this->configuration['trusted-proxies'] : []; Request::setTrustedProxies($proxies); } } diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/XSendFileSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/XSendFileSubscriber.php index 72199b06ab..cdddd7c97e 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/XSendFileSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/XSendFileSubscriber.php @@ -28,9 +28,9 @@ class XSendFileSubscriber implements EventSubscriberInterface public static function getSubscribedEvents() { - return array( - KernelEvents::REQUEST => array('applyHeaders', 0), - ); + return [ + KernelEvents::REQUEST => ['applyHeaders', 0], + ]; } public function applyHeaders(GetResponseEvent $event) diff --git a/lib/Alchemy/Phrasea/Core/Provider/BorderManagerServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/BorderManagerServiceProvider.php index 3d074bb047..0fc372fb1f 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/BorderManagerServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/BorderManagerServiceProvider.php @@ -32,7 +32,7 @@ class BorderManagerServiceProvider implements ServiceProviderInterface $options = $app['configuration']['border-manager']; - $registeredCheckers = array(); + $registeredCheckers = []; if ($options['enabled']) { foreach ($options['checkers'] as $checker) { @@ -50,7 +50,7 @@ class BorderManagerServiceProvider implements ServiceProviderInterface continue; } - $options = array(); + $options = []; if (isset($checker['options']) && is_array($checker['options'])) { $options = $checker['options']; @@ -60,7 +60,7 @@ class BorderManagerServiceProvider implements ServiceProviderInterface $checkerObj = new $className($app, $options); if (isset($checker['databoxes'])) { - $databoxes = array(); + $databoxes = []; foreach ($checker['databoxes'] as $sbas_id) { try { $databoxes[] = $app['phraseanet.appbox']->get_databox($sbas_id); @@ -73,7 +73,7 @@ class BorderManagerServiceProvider implements ServiceProviderInterface } if (isset($checker['collections'])) { - $collections = array(); + $collections = []; foreach ($checker['collections'] as $base_id) { try { $collections[] = \collection::get_from_base_id($app, $base_id); diff --git a/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php index 19ad24b047..41c8611e4b 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/LocaleServiceProvider.php @@ -68,7 +68,7 @@ class LocaleServiceProvider implements ServiceProviderInterface }); $app['locales.mapping'] = $app->share(function (Application $app) { - $codes = array(); + $codes = []; foreach ($app['locales.available'] as $code => $language) { $data = explode('_', $code); $codes[$data[0]] = $code; @@ -78,7 +78,7 @@ class LocaleServiceProvider implements ServiceProviderInterface }); $app['locales.I18n.available'] = $app->share(function (Application $app) { - $locales = array(); + $locales = []; foreach ($app['locales.available'] as $code => $language) { $data = explode('_', $code); diff --git a/lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php index 3231c022c4..a7ca7478f0 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/ORMServiceProvider.php @@ -63,7 +63,7 @@ class ORMServiceProvider implements ServiceProviderInterface $annotationDriver = new AnnotationDriver( $annotationReader, - array($app['root.path'].'/lib/Alchemy/Phrasea/Model/Entities') + [$app['root.path'].'/lib/Alchemy/Phrasea/Model/Entities'] ); $driverChain->addDriver($annotationDriver, 'Alchemy\Phrasea\Model\Entities'); @@ -136,13 +136,13 @@ class ORMServiceProvider implements ServiceProviderInterface $platform = $em->getConnection()->getDatabasePlatform(); - $types = array( + $types = [ 'blob' => 'Alchemy\Phrasea\Model\Types\Blob', 'enum' => 'Alchemy\Phrasea\Model\Types\Blob', 'longblob' => 'Alchemy\Phrasea\Model\Types\LongBlob', 'varbinary' => 'Alchemy\Phrasea\Model\Types\VarBinary', 'binary' => 'Alchemy\Phrasea\Model\Types\Binary', - ); + ]; foreach ($types as $type => $class) { if (!Type::hasType($type)) { diff --git a/lib/Alchemy/Phrasea/Core/Provider/PluginServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/PluginServiceProvider.php index 4f1deeee40..b838772e92 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/PluginServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/PluginServiceProvider.php @@ -24,7 +24,7 @@ class PluginServiceProvider implements ServiceProviderInterface { $app['twig'] = $app->share( $app->extend('twig', function ($twig, Application $app) { - $function = new \Twig_SimpleFunction('plugin_asset', array('Alchemy\Phrasea\Plugin\Management\AssetsManager', 'twigPluginAsset')); + $function = new \Twig_SimpleFunction('plugin_asset', ['Alchemy\Phrasea\Plugin\Management\AssetsManager', 'twigPluginAsset']); $twig->addFunction($function); return $twig; diff --git a/lib/Alchemy/Phrasea/Core/Provider/RegistrationServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/RegistrationServiceProvider.php index f5a0408d48..f5115839c2 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/RegistrationServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/RegistrationServiceProvider.php @@ -21,7 +21,7 @@ class RegistrationServiceProvider implements ServiceProviderInterface public function register(Application $app) { $app['registration.fields'] = $app->share(function (Application $app) { - return isset($app['configuration']['registration-fields']) ? $app['configuration']['registration-fields'] : array(); + return isset($app['configuration']['registration-fields']) ? $app['configuration']['registration-fields'] : []; }); $app['registration.enabled'] = $app->share(function (Application $app) { @@ -41,97 +41,97 @@ class RegistrationServiceProvider implements ServiceProviderInterface }); $app['registration.optional-fields'] = $app->share(function (Application $app) { - return array( - 'login'=> array( + return [ + 'login'=> [ 'label' => _('admin::compte-utilisateur identifiant'), 'type' => 'text', - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), new NewLogin($app), - ) - ), - 'gender' => array( + ] + ], + 'gender' => [ 'label' => _('admin::compte-utilisateur sexe'), 'type' => 'choice', 'multiple' => false, 'expanded' => false, - 'choices' => array( + 'choices' => [ '0' => _('admin::compte-utilisateur:sexe: mademoiselle'), '1' => _('admin::compte-utilisateur:sexe: madame'), '2' => _('admin::compte-utilisateur:sexe: monsieur'), - ) - ), - 'firstname' => array( + ] + ], + 'firstname' => [ 'label' => _('admin::compte-utilisateur prenom'), 'type' => 'text', - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - ) - ), - 'lastname' => array( + ] + ], + 'lastname' => [ 'label' => _('admin::compte-utilisateur nom'), 'type' => 'text', - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - ) - ), - 'address' => array( + ] + ], + 'address' => [ 'label' => _('admin::compte-utilisateur adresse'), 'type' => 'textarea', - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - ) - ), - 'zipcode' => array( + ] + ], + 'zipcode' => [ 'label' => _('admin::compte-utilisateur code postal'), 'type' => 'text', - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - ) - ), - 'geonameid' => array( + ] + ], + 'geonameid' => [ 'label' => _('admin::compte-utilisateur ville'), 'type' => new \Alchemy\Phrasea\Form\Type\GeonameType(), - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - ) - ), - 'position' => array( + ] + ], + 'position' => [ 'label' => _('admin::compte-utilisateur poste'), 'type' => 'text', - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - ) - ), - 'company' => array( + ] + ], + 'company' => [ 'label' => _('admin::compte-utilisateur societe'), 'type' => 'text', - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - ) - ), - 'job' => array( + ] + ], + 'job' => [ 'label' => _('admin::compte-utilisateur activite'), 'type' => 'text', - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - ) - ), - 'tel' => array( + ] + ], + 'tel' => [ 'label' => _('admin::compte-utilisateur tel'), 'type' => 'text', - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - ) - ), - 'fax' => array( + ] + ], + 'fax' => [ 'label' => _('admin::compte-utilisateur fax'), 'type' => 'text', - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - ) - ), - ); + ] + ], + ]; }); } diff --git a/lib/Alchemy/Phrasea/Core/Provider/TasksServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/TasksServiceProvider.php index 2ee275b615..470b1b2974 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/TasksServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/TasksServiceProvider.php @@ -39,15 +39,15 @@ class TasksServiceProvider implements ServiceProviderInterface if (isset($app['configuration']['task-manager']) && isset($app['configuration']['task-manager']['listener'])) { $listenerConf = $app['configuration']['task-manager']['listener']; } else { - $listenerConf = array(); + $listenerConf = []; } - return array_replace(array( + return array_replace([ 'protocol' => 'tcp', 'host' => '127.0.0.1', 'port' => 6660, 'linger' => 500, - ), $listenerConf); + ], $listenerConf); }); $app['task-manager.job-factory'] = $app->share(function (Application $app) { @@ -71,7 +71,7 @@ class TasksServiceProvider implements ServiceProviderInterface }); $app['task-manager.available-jobs'] = $app->share(function (Application $app) { - return array( + return [ new FtpJob(), new ArchiveJob(), new BridgeJob(), @@ -80,7 +80,7 @@ class TasksServiceProvider implements ServiceProviderInterface new RecordMoverJob(), new SubdefsJob(), new WriteMetadataJob(), - ); + ]; }); } diff --git a/lib/Alchemy/Phrasea/Feed/Aggregate.php b/lib/Alchemy/Phrasea/Feed/Aggregate.php index a7b2d062fb..31b6aca024 100644 --- a/lib/Alchemy/Phrasea/Feed/Aggregate.php +++ b/lib/Alchemy/Phrasea/Feed/Aggregate.php @@ -54,7 +54,7 @@ class Aggregate implements FeedInterface $this->updatedOn = new \DateTime(); $this->em = $em; - $tmp_feeds = array(); + $tmp_feeds = []; foreach ($feeds as $feed) { $tmp_feeds[$feed->getId()] = $feed; @@ -77,7 +77,7 @@ class Aggregate implements FeedInterface public static function createFromUser(Application $app, \User_Adapter $user) { $feeds = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->getAllForUser($app['acl']->get($user)); - $token = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\AggregateToken')->findOneBy(array('usrId' => $user->get_id())); + $token = $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\AggregateToken')->findOneBy(['usrId' => $user->get_id()]); return new static($app['EM'], $feeds, $token); } @@ -114,7 +114,7 @@ class Aggregate implements FeedInterface return null; } - $feedIds = array(); + $feedIds = []; foreach ($this->feeds as $feed) { $feedIds[] = $feed->getId(); } @@ -200,7 +200,7 @@ class Aggregate implements FeedInterface public function getCountTotalEntries() { if (count($this->feeds) > 0) { - $feedIds = array(); + $feedIds = []; foreach ($this->feeds as $feed) { $feedIds[] = $feed->getId(); } @@ -237,6 +237,6 @@ class Aggregate implements FeedInterface */ public static function getPublic(Application $app) { - return new static($app['EM'], $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->findBy(array('public' => true), array('updatedOn' => 'DESC'))); + return new static($app['EM'], $app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Feed')->findBy(['public' => true], ['updatedOn' => 'DESC'])); } } diff --git a/lib/Alchemy/Phrasea/Feed/Formatter/AtomFormatter.php b/lib/Alchemy/Phrasea/Feed/Formatter/AtomFormatter.php index bce5da422a..759cd44e02 100644 --- a/lib/Alchemy/Phrasea/Feed/Formatter/AtomFormatter.php +++ b/lib/Alchemy/Phrasea/Feed/Formatter/AtomFormatter.php @@ -36,7 +36,7 @@ class AtomFormatter extends FeedFormatterAbstract implements FeedFormatterInterf public function createResponse(FeedInterface $feed, $page, \User_Adapter $user = null, $generator = 'Phraseanet', Application $app = null) { $content = $this->format($feed, $page, $user, $generator, $app); - $response = new Response($content, 200, array('Content-Type' => 'application/atom+xml')); + $response = new Response($content, 200, ['Content-Type' => 'application/atom+xml']); return $response; } diff --git a/lib/Alchemy/Phrasea/Feed/Formatter/CoolirisFormatter.php b/lib/Alchemy/Phrasea/Feed/Formatter/CoolirisFormatter.php index 0e9d91af41..6dc48f7607 100644 --- a/lib/Alchemy/Phrasea/Feed/Formatter/CoolirisFormatter.php +++ b/lib/Alchemy/Phrasea/Feed/Formatter/CoolirisFormatter.php @@ -37,7 +37,7 @@ class CoolirisFormatter extends FeedFormatterAbstract implements FeedFormatterIn public function createResponse(FeedInterface $feed, $page, \User_Adapter $user = null, $generator = 'Phraseanet', Application $app = null) { $content = $this->format($feed, $page, $user, $generator, $app); - $response = new Response($content, 200, array('Content-Type' => 'application/rss+xml')); + $response = new Response($content, 200, ['Content-Type' => 'application/rss+xml']); return $response; } @@ -188,7 +188,7 @@ class CoolirisFormatter extends FeedFormatterAbstract implements FeedFormatterIn $medium = strtolower($content->getRecord($app)->get_type()); - if ( ! in_array($medium, array('image', 'audio', 'video'))) { + if ( ! in_array($medium, ['image', 'audio', 'video'])) { return $this; } diff --git a/lib/Alchemy/Phrasea/Feed/Formatter/FeedFormatterAbstract.php b/lib/Alchemy/Phrasea/Feed/Formatter/FeedFormatterAbstract.php index 0a77fe9b51..8a9379f595 100644 --- a/lib/Alchemy/Phrasea/Feed/Formatter/FeedFormatterAbstract.php +++ b/lib/Alchemy/Phrasea/Feed/Formatter/FeedFormatterAbstract.php @@ -53,7 +53,7 @@ abstract class FeedFormatterAbstract $medium = strtolower($content->getRecord($app)->get_type()); - if ( ! in_array($medium, array('image', 'audio', 'video'))) { + if ( ! in_array($medium, ['image', 'audio', 'video'])) { return $this; } diff --git a/lib/Alchemy/Phrasea/Feed/Formatter/RssFormatter.php b/lib/Alchemy/Phrasea/Feed/Formatter/RssFormatter.php index 754f5d3ce6..381f4ffe93 100644 --- a/lib/Alchemy/Phrasea/Feed/Formatter/RssFormatter.php +++ b/lib/Alchemy/Phrasea/Feed/Formatter/RssFormatter.php @@ -38,7 +38,7 @@ class RssFormatter extends FeedFormatterAbstract implements FeedFormatterInterfa public function createResponse(FeedInterface $feed, $page, \User_Adapter $user = null, $generator = 'Phraseanet', Application $app = null) { $content = $this->format($feed, $page, $user, $generator, $app); - $response = new Response($content, 200, array('Content-Type' => 'application/rss+xml')); + $response = new Response($content, 200, ['Content-Type' => 'application/rss+xml']); return $response; } diff --git a/lib/Alchemy/Phrasea/Feed/Link/AggregateLinkGenerator.php b/lib/Alchemy/Phrasea/Feed/Link/AggregateLinkGenerator.php index 851121d921..a58d80705c 100644 --- a/lib/Alchemy/Phrasea/Feed/Link/AggregateLinkGenerator.php +++ b/lib/Alchemy/Phrasea/Feed/Link/AggregateLinkGenerator.php @@ -42,10 +42,10 @@ class AggregateLinkGenerator implements LinkGeneratorInterface switch ($format) { case self::FORMAT_ATOM: - $params = array( + $params = [ 'token' => $this->getAggregateToken($user, $renew)->getValue(), 'format' => 'atom' - ); + ]; if (null !== $page) { $params['page'] = $page; } @@ -56,10 +56,10 @@ class AggregateLinkGenerator implements LinkGeneratorInterface 'application/atom+xml' ); case self::FORMAT_RSS: - $params = array( + $params = [ 'token' => $this->getAggregateToken($user, $renew)->getValue(), 'format' => 'rss' - ); + ]; if (null !== $page) { $params['page'] = $page; } @@ -93,7 +93,7 @@ class AggregateLinkGenerator implements LinkGeneratorInterface switch ($format) { case self::FORMAT_ATOM: - $params = array('format' => 'atom'); + $params = ['format' => 'atom']; if (null !== $page) { $params['page'] = $page; } @@ -104,7 +104,7 @@ class AggregateLinkGenerator implements LinkGeneratorInterface 'application/atom+xml' ); case self::FORMAT_RSS: - $params = array('format' => 'rss'); + $params = ['format' => 'rss']; if (null !== $page) { $params['page'] = $page; } @@ -123,7 +123,7 @@ class AggregateLinkGenerator implements LinkGeneratorInterface { $token = $this->em ->getRepository('Alchemy\Phrasea\Model\Entities\AggregateToken') - ->findOneBy(array('usrId' => $user->get_id())); + ->findOneBy(['usrId' => $user->get_id()]); if (null === $token || true === $renew) { if (null === $token) { diff --git a/lib/Alchemy/Phrasea/Feed/Link/FeedLinkGenerator.php b/lib/Alchemy/Phrasea/Feed/Link/FeedLinkGenerator.php index 001465813f..7a892f5bae 100644 --- a/lib/Alchemy/Phrasea/Feed/Link/FeedLinkGenerator.php +++ b/lib/Alchemy/Phrasea/Feed/Link/FeedLinkGenerator.php @@ -50,11 +50,11 @@ class FeedLinkGenerator implements LinkGeneratorInterface switch ($format) { case self::FORMAT_ATOM: - $params = array( + $params = [ 'token' => $this->getFeedToken($feed, $user, $renew)->getValue(), 'id' => $feed->getId(), 'format' => 'atom' - ); + ]; if (null !== $page) { $params['page'] = $page; } @@ -65,11 +65,11 @@ class FeedLinkGenerator implements LinkGeneratorInterface 'application/atom+xml' ); case self::FORMAT_RSS: - $params = array( + $params = [ 'token' => $this->getFeedToken($feed, $user, $renew)->getValue(), 'id' => $feed->getId(), 'format' => 'rss' - ); + ]; if (null !== $page) { $params['page'] = $page; } @@ -103,10 +103,10 @@ class FeedLinkGenerator implements LinkGeneratorInterface switch ($format) { case self::FORMAT_ATOM: - $params = array( + $params = [ 'id' => $feed->getId(), 'format' => 'atom' - ); + ]; if (null !== $page) { $params['page'] = $page; } @@ -117,10 +117,10 @@ class FeedLinkGenerator implements LinkGeneratorInterface 'application/atom+xml' ); case self::FORMAT_RSS: - $params = array( + $params = [ 'id' => $feed->getId(), 'format' => 'rss' - ); + ]; if (null !== $page) { $params['page'] = $page; } @@ -139,7 +139,7 @@ class FeedLinkGenerator implements LinkGeneratorInterface { $token = $this->em ->getRepository('Alchemy\Phrasea\Model\Entities\FeedToken') - ->findOneBy(array('usrId' => $user->get_id(), 'feed' => $feed->getId())); + ->findOneBy(['usrId' => $user->get_id(), 'feed' => $feed->getId()]); if (null === $token || true === $renew) { if (null === $token) { diff --git a/lib/Alchemy/Phrasea/Feed/Link/LinkGeneratorCollection.php b/lib/Alchemy/Phrasea/Feed/Link/LinkGeneratorCollection.php index 81a9089898..571ff56819 100644 --- a/lib/Alchemy/Phrasea/Feed/Link/LinkGeneratorCollection.php +++ b/lib/Alchemy/Phrasea/Feed/Link/LinkGeneratorCollection.php @@ -7,7 +7,7 @@ use Alchemy\Phrasea\Exception\InvalidArgumentException; class LinkGeneratorCollection implements LinkGeneratorInterface { - private $generators = array(); + private $generators = []; /** * Adds a LinkGeneratorInterface to the internal array. diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaAuthenticationForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaAuthenticationForm.php index 2a9b679734..0d2c7f7268 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaAuthenticationForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaAuthenticationForm.php @@ -19,37 +19,37 @@ class PhraseaAuthenticationForm extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('login', 'text', array( + $builder->add('login', 'text', [ 'label' => _('Login'), 'required' => true, 'disabled' => $options['disabled'], - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - ), - )); + ], + ]); - $builder->add('password', 'password', array( + $builder->add('password', 'password', [ 'label' => _('Password'), 'required' => true, 'disabled' => $options['disabled'], - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - ), - )); + ], + ]); - $builder->add('remember-me', 'checkbox', array( + $builder->add('remember-me', 'checkbox', [ 'label' => _('Remember me'), 'mapped' => false, 'required' => false, - 'attr' => array( + 'attr' => [ 'checked' => 'checked', 'value' => '1', - ) - )); + ] + ]); - $builder->add('redirect', 'hidden', array( + $builder->add('redirect', 'hidden', [ 'required' => false, - )); + ]); } public function getName() diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaForgotPasswordForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaForgotPasswordForm.php index 7bfb6b39ad..4612548bc3 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaForgotPasswordForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaForgotPasswordForm.php @@ -19,14 +19,14 @@ class PhraseaForgotPasswordForm extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('email', 'email', array( + $builder->add('email', 'email', [ 'label' => _('E-mail'), 'required' => true, - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), new Assert\Email() - ), - )); + ], + ]); } public function getName() diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaRecoverPasswordForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaRecoverPasswordForm.php index 48b1e2c596..a3f78d258f 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaRecoverPasswordForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaRecoverPasswordForm.php @@ -31,26 +31,26 @@ class PhraseaRecoverPasswordForm extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('token', 'hidden', array( + $builder->add('token', 'hidden', [ 'required' => true, - 'constraints' => array( + 'constraints' => [ new PasswordToken($this->app, $this->app['tokens']) - ) - )); + ] + ]); - $builder->add('password', 'repeated', array( + $builder->add('password', 'repeated', [ 'type' => 'password', 'required' => true, 'invalid_message' => _('Please provide the same passwords.'), 'first_name' => 'password', 'second_name' => 'confirm', - 'first_options' => array('label' => _('New password')), - 'second_options' => array('label' => _('New password (confirmation)')), - 'constraints' => array( + 'first_options' => ['label' => _('New password')], + 'second_options' => ['label' => _('New password (confirmation)')], + 'constraints' => [ new Assert\NotBlank(), - new Assert\Length(array('min' => 5)), - ), - )); + new Assert\Length(['min' => 5]), + ], + ]); } public function getName() diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php index 341662e016..3e7d49972c 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php @@ -24,7 +24,7 @@ class PhraseaRegisterForm extends AbstractType private $params; private $camelizer; - public function __construct(Application $app, array $available, array $params = array(), Camelizer $camelizer = null) + public function __construct(Application $app, array $available, array $params = [], Camelizer $camelizer = null) { $this->app = $app; $this->available = $available; @@ -34,46 +34,46 @@ class PhraseaRegisterForm extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('email', 'email', array( + $builder->add('email', 'email', [ 'label' => _('E-mail'), 'required' => true, - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), new Assert\Email(), new \Alchemy\Phrasea\Form\Constraint\NewEmail($this->app), - ), - )); + ], + ]); - $builder->add('password', 'repeated', array( + $builder->add('password', 'repeated', [ 'type' => 'password', 'required' => true, 'invalid_message' => _('Please provide the same passwords.'), 'first_name' => 'password', 'second_name' => 'confirm', - 'first_options' => array('label' => _('Password')), - 'second_options' => array('label' => _('Password (confirmation)')), - 'constraints' => array( + 'first_options' => ['label' => _('Password')], + 'second_options' => ['label' => _('Password (confirmation)')], + 'constraints' => [ new Assert\NotBlank(), - new Assert\Length(array('min' => 5)), - ), - )); + new Assert\Length(['min' => 5]), + ], + ]); if ($this->app->hasTermsOfUse()) { - $builder->add('accept-tou', 'checkbox', array( + $builder->add('accept-tou', 'checkbox', [ 'label' => _('Terms of Use'), 'mapped' => false, - "constraints" => array( - new Assert\True(array( + "constraints" => [ + new Assert\True([ "message" => _("Please accept the Terms and conditions in order to register.") - ))), - )); + ])], + ]); } $builder->add('provider-id', 'hidden'); require_once $this->app['root.path'] . '/lib/classes/deprecated/inscript.api.php'; - $choices = array(); - $baseIds = array(); + $choices = []; + $baseIds = []; foreach (\giveMeBases($this->app) as $sbas_id => $baseInsc) { if (($baseInsc['CollsCGU'] || $baseInsc['Colls']) && $baseInsc['inscript']) { @@ -83,7 +83,7 @@ class PhraseaRegisterForm extends AbstractType $sbasName= \phrasea::sbas_names($sbas_id, $this->app); if (!isset($choices[$sbasName])) { - $choices[$sbasName] = array(); + $choices[$sbasName] = []; } $choices[$sbasName][$baseId] = \phrasea::bas_labels($baseId, $this->app); @@ -97,7 +97,7 @@ class PhraseaRegisterForm extends AbstractType $sbasName= \phrasea::sbas_names($sbas_id, $this->app); if (!isset($choices[$sbasName])) { - $choices[$sbasName] = array(); + $choices[$sbasName] = []; } $choices[$sbasName][$baseId] = \phrasea::bas_labels($baseId, $this->app); @@ -108,19 +108,19 @@ class PhraseaRegisterForm extends AbstractType } if (!$this->app['phraseanet.registry']->get('GV_autoselectDB')) { - $builder->add('collections', 'choice', array( + $builder->add('collections', 'choice', [ 'choices' => $choices, 'multiple' => true, 'expanded' => false, - 'constraints' => array( - new Assert\Choice(array( + 'constraints' => [ + new Assert\Choice([ 'choices' => $baseIds, 'minMessage' => _('You must select at least %s collection.'), 'multiple' => true, 'min' => 1, - )), - ), - )); + ]), + ], + ]); } foreach ($this->params as $param) { @@ -129,7 +129,7 @@ class PhraseaRegisterForm extends AbstractType throw new InvalidArgumentException(sprintf('%s is not a valid fieldname')); } if (isset($this->available[$name])) { - $options = array_merge($this->available[$name], array('required' => $param['required'])); + $options = array_merge($this->available[$name], ['required' => $param['required']]); if (!$param['required']) { unset($options['constraints']); } diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaRenewPasswordForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaRenewPasswordForm.php index 04236af7cb..15c287fb4d 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaRenewPasswordForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaRenewPasswordForm.php @@ -22,27 +22,27 @@ class PhraseaRenewPasswordForm extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('oldPassword', 'password', array( + $builder->add('oldPassword', 'password', [ 'label' => _('Current password'), 'required' => true, - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank() - ) - )); + ] + ]); - $builder->add('password', 'repeated', array( + $builder->add('password', 'repeated', [ 'type' => 'password', 'required' => true, 'invalid_message' => _('Please provide the same passwords.'), 'first_name' => 'password', 'second_name' => 'confirm', - 'first_options' => array('label' => _('New password')), - 'second_options' => array('label' => _('New password (confirmation)')), - 'constraints' => array( + 'first_options' => ['label' => _('New password')], + 'second_options' => ['label' => _('New password (confirmation)')], + 'constraints' => [ new Assert\NotBlank(), - new Assert\Length(array('min' => 5)), - ), - )); + new Assert\Length(['min' => 5]), + ], + ]); } public function getName() diff --git a/lib/Alchemy/Phrasea/Form/TaskForm.php b/lib/Alchemy/Phrasea/Form/TaskForm.php index 04b7489a5c..546d424e7d 100644 --- a/lib/Alchemy/Phrasea/Form/TaskForm.php +++ b/lib/Alchemy/Phrasea/Form/TaskForm.php @@ -21,36 +21,36 @@ class TaskForm extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('name', 'text', array( + $builder->add('name', 'text', [ 'label' => _('Task name'), 'required' => true, - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - ), - )); - $builder->add('period', 'integer', array( + ], + ]); + $builder->add('period', 'integer', [ 'label' => _('Task period (in seconds)'), 'required' => true, - 'constraints' => array( + 'constraints' => [ new Assert\NotBlank(), - new Assert\GreaterThan(array('value' => 0)), - ), - )); - $builder->add('status', 'choice', array( + new Assert\GreaterThan(['value' => 0]), + ], + ]); + $builder->add('status', 'choice', [ 'label' => _('The task status'), - 'choices' => array( + 'choices' => [ Task::STATUS_STARTED => 'Started', Task::STATUS_STOPPED => 'Stopped', - ), - )); + ], + ]); $builder->add('settings', 'hidden'); } public function setDefaultOptions(OptionsResolverInterface $resolver) { - $resolver->setDefaults(array( + $resolver->setDefaults([ 'data_class' => 'Alchemy\Phrasea\Model\Entities\Task', - )); + ]); } public function getName() diff --git a/lib/Alchemy/Phrasea/Helper/Prod.php b/lib/Alchemy/Phrasea/Helper/Prod.php index ea6c329b21..b32c4b48fb 100644 --- a/lib/Alchemy/Phrasea/Helper/Prod.php +++ b/lib/Alchemy/Phrasea/Helper/Prod.php @@ -21,13 +21,13 @@ class Prod extends Helper public function get_search_datas() { - $search_datas = array( - 'bases' => array(), - 'dates' => array(), - 'fields' => array() - ); + $search_datas = [ + 'bases' => [], + 'dates' => [], + 'fields' => [] + ]; - $bases = $fields = $dates = array(); + $bases = $fields = $dates = []; if (! $this->app['authentication']->getUser() instanceof \User_Adapter) { return $search_datas; @@ -38,21 +38,21 @@ class Prod extends Helper foreach ($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_sbas() as $databox) { $sbas_id = $databox->get_sbas_id(); - $bases[$sbas_id] = array( + $bases[$sbas_id] = [ 'thesaurus' => (trim($databox->get_thesaurus()) != ""), 'cterms' => false, - 'collections' => array(), + 'collections' => [], 'sbas_id' => $sbas_id - ); + ]; - foreach ($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(array(), array($databox->get_sbas_id())) as $coll) { + foreach ($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base([], [$databox->get_sbas_id()]) as $coll) { $selected = (isset($searchSet['bases']) && isset($searchSet['bases'][$sbas_id])) ? (in_array($coll->get_base_id(), $searchSet['bases'][$sbas_id])) : true; $bases[$sbas_id]['collections'][] = - array( + [ 'selected' => $selected, 'base_id' => $coll->get_base_id() - ); + ]; } $meta_struct = $databox->get_meta_structure(); @@ -65,18 +65,18 @@ class Prod extends Helper if (isset($dates[$id])) $dates[$id]['sbas'][] = $sbas_id; else - $dates[$id] = array('sbas' => array($sbas_id), 'fieldname' => $name); + $dates[$id] = ['sbas' => [$sbas_id], 'fieldname' => $name]; } if (isset($fields[$name])) { $fields[$name]['sbas'][] = $sbas_id; } else { - $fields[$name] = array( - 'sbas' => array($sbas_id) + $fields[$name] = [ + 'sbas' => [$sbas_id] , 'fieldname' => $name , 'type' => $meta->get_type() , 'id' => $id - ); + ]; } } diff --git a/lib/Alchemy/Phrasea/Helper/Record/Helper.php b/lib/Alchemy/Phrasea/Helper/Record/Helper.php index d165cab385..5b2400f3e3 100644 --- a/lib/Alchemy/Phrasea/Helper/Record/Helper.php +++ b/lib/Alchemy/Phrasea/Helper/Record/Helper.php @@ -62,13 +62,13 @@ class Helper extends \Alchemy\Phrasea\Helper\Helper * * @var Array */ - protected $required_rights = array(); + protected $required_rights = []; /** * * @var Array */ - protected $required_sbas_rights = array(); + protected $required_sbas_rights = []; /** * @@ -125,7 +125,7 @@ class Helper extends \Alchemy\Phrasea\Helper\Helper $storyWZ = $repository->findByUserAndId($app, $app['authentication']->getUser(), $Request->get('story')); - $this->selection->load_list(array($storyWZ->getRecord($this->app)->get_serialize_key()), $this->flatten_groupings); + $this->selection->load_list([$storyWZ->getRecord($this->app)->get_serialize_key()], $this->flatten_groupings); } else { $this->selection->load_list(explode(";", $Request->get('lst')), $this->flatten_groupings); } diff --git a/lib/Alchemy/Phrasea/Helper/Record/Push.php b/lib/Alchemy/Phrasea/Helper/Record/Push.php index 0fedb9767f..533db7f209 100644 --- a/lib/Alchemy/Phrasea/Helper/Record/Push.php +++ b/lib/Alchemy/Phrasea/Helper/Record/Push.php @@ -25,6 +25,6 @@ use Alchemy\Phrasea\Helper\Record\Helper as RecordHelper; class Push extends RecordHelper { protected $flatten_groupings = true; - protected $required_rights = array('canpush'); + protected $required_rights = ['canpush']; } diff --git a/lib/Alchemy/Phrasea/Helper/User/Edit.php b/lib/Alchemy/Phrasea/Helper/User/Edit.php index 916bd00e70..ca033cf0ac 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Edit.php +++ b/lib/Alchemy/Phrasea/Helper/User/Edit.php @@ -29,7 +29,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper * * @var array */ - protected $users = array(); + protected $users = []; /** * @@ -49,7 +49,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $this->users = explode(';', $Request->get('users')); - $users = array(); + $users = []; foreach ($this->users as $usr_id) { $usr_id = (int) $usr_id; @@ -77,7 +77,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper protected function delete_user(\User_Adapter $user) { - $list = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(array('canadmin'))); + $list = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['canadmin'])); $this->app['acl']->get($user)->revoke_access_from_bases($list); @@ -90,7 +90,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper public function get_users_rights() { - $list = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(array('canadmin'))); + $list = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['canadmin'])); $sql = "SELECT b.sbas_id, @@ -154,7 +154,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $access = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); - $base_ids = array(); + $base_ids = []; foreach ($access as $acc) { $base_ids[$acc['base_id']] = $acc; } @@ -174,14 +174,14 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper ->execute()->get_results(); $this->users_datas = $rs; - $out = array( + $out = [ 'datas' => $this->users_datas, 'users' => $this->users, 'users_serial' => implode(';', $this->users), 'base_id' => $this->base_id, 'main_user' => null, 'templates' => $templates - ); + ]; if (count($this->users) == 1) { $usr_id = array_pop($this->users); @@ -202,19 +202,19 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $conn = \connection::getPDOConnection($this->app); $stmt = $conn->prepare($sql); - $stmt->execute(array(':base_id' => $this->base_id)); + $stmt->execute([':base_id' => $this->base_id]); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); $this->users_datas = $rs; - return array( + return [ 'datas' => $this->users_datas, 'users' => $this->users, 'users_serial' => implode(';', $this->users), 'base_id' => $this->base_id, 'collection' => \collection::get_from_base_id($this->app, $this->base_id), - ); + ]; } public function get_masks() @@ -228,17 +228,17 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $conn = $this->app['phraseanet.appbox']->get_connection(); $stmt = $conn->prepare($sql); - $stmt->execute(array(':base_id' => $this->base_id)); + $stmt->execute([':base_id' => $this->base_id]); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); - $tbits_and = array(); - $tbits_xor = array(); + $tbits_and = []; + $tbits_xor = []; $nrows = 0; for ($bit = 0; $bit < 32; $bit++) - $tbits_and[$bit] = $tbits_xor[$bit] = array("nset" => 0); + $tbits_and[$bit] = $tbits_xor[$bit] = ["nset" => 0]; foreach ($rs as $row) { $sta_xor = strrev($row["mask_xor"]); @@ -255,8 +255,8 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $nrows++; } - $tbits_left = array(); - $tbits_right = array(); + $tbits_left = []; + $tbits_right = []; $sbas_id = \phrasea::sbasFromBas($this->app, $this->base_id); $databox = $this->app['phraseanet.appbox']->get_databox($sbas_id); @@ -296,22 +296,22 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper } } - $this->users_datas = array( + $this->users_datas = [ 'tbits_left' => $tbits_left, 'tbits_right' => $tbits_right, 'vand_and' => $vand_and, 'vand_or' => $vand_or, 'vxor_and' => $vxor_and, 'vxor_or' => $vxor_or - ); + ]; - return array( + return [ 'datas' => $this->users_datas, 'users' => $this->users, 'users_serial' => implode(';', $this->users), 'base_id' => $this->base_id, 'collection' => \collection::get_from_base_id($this->app, $this->base_id), - ); + ]; } public function get_time() @@ -325,7 +325,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $conn = \connection::getPDOConnection($this->app); $stmt = $conn->prepare($sql); - $stmt->execute(array(':base_id' => $this->base_id)); + $stmt->execute([':base_id' => $this->base_id]); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -355,17 +355,17 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $limited_to = $date_obj_to->format('Y-m-d'); } - $datas = array('time_limited' => $time_limited, 'limited_from' => $limited_from, 'limited_to' => $limited_to); + $datas = ['time_limited' => $time_limited, 'limited_from' => $limited_from, 'limited_to' => $limited_to]; $this->users_datas = $datas; - return array( + return [ 'datas' => $this->users_datas, 'users' => $this->users, 'users_serial' => implode(';', $this->users), 'base_id' => $this->base_id, 'collection' => \collection::get_from_base_id($this->app, $this->base_id), - ); + ]; } public function get_time_sbas() @@ -381,11 +381,11 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $conn = \connection::getPDOConnection($this->app); $stmt = $conn->prepare($sql); - $stmt->execute(array(':sbas_id' => $sbas_id)); + $stmt->execute([':sbas_id' => $sbas_id]); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); - $time_limited = $limited_from = $limited_to = array(); + $time_limited = $limited_from = $limited_to = []; foreach ($rs as $row) { $time_limited[] = $row['time_limited']; @@ -417,39 +417,39 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $limited_to = false; } - $datas = array( + $datas = [ 'time_limited' => array_pop($time_limited), 'limited_from' => $limited_from, 'limited_to' => $limited_to - ); + ]; } else { - $datas = array( + $datas = [ 'time_limited' => 2, 'limited_from' => '', 'limited_to' => '' - ); + ]; } $this->users_datas = $datas; - return array( + return [ 'sbas_id' => $sbas_id, 'datas' => $this->users_datas, 'users' => $this->users, 'users_serial' => implode(';', $this->users), 'databox' => $this->app['phraseanet.appbox']->get_databox($sbas_id), - ); + ]; } public function apply_rights() { $ACL = $this->app['acl']->get($this->app['authentication']->getUser()); - $base_ids = array_keys($ACL->get_granted_base(array('canadmin'))); + $base_ids = array_keys($ACL->get_granted_base(['canadmin'])); - $update = $create = $delete = $create_sbas = $update_sbas = array(); + $update = $create = $delete = $create_sbas = $update_sbas = []; foreach ($base_ids as $base_id) { - $rights = array( + $rights = [ 'access', 'actif', 'canputinalbum', @@ -467,7 +467,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper 'canpush', 'manage', 'modify_struct' - ); + ]; foreach ($rights as $k => $right) { if (($right == 'access' && !$ACL->has_access_to_base($base_id)) || ($right != 'access' && !$ACL->has_right_on_base($base_id, $right))) { @@ -503,12 +503,12 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $sbas_ids = $ACL->get_granted_sbas(); foreach ($sbas_ids as $databox) { - $rights = array( + $rights = [ 'bas_modif_th', 'bas_manage', 'bas_modify_struct', 'bas_chupub' - ); + ]; foreach ($rights as $k => $right) { if (!$ACL->has_right_on_sbas($databox->get_sbas_id(), $right)) { unset($rights[$k]); @@ -576,7 +576,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper return $this; } - $infos = array( + $infos = [ 'gender' , 'first_name' , 'last_name' @@ -589,7 +589,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper , 'activite' , 'telephone' , 'fax' - ); + ]; $parm = $this->unserializedRequestData($this->app['request'], $infos, 'user_infos'); @@ -649,7 +649,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper throw new AccessDeniedHttpException('You are not the owner of the template'); } - $base_ids = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(array('canadmin'))); + $base_ids = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['canadmin'])); foreach ($this->users as $usr_id) { $user = \User_adapter::getInstance($usr_id, $this->app); @@ -709,7 +709,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper $activate = !!$this->request->get('limit'); - $base_ids = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(array('canadmin'))); + $base_ids = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['canadmin'])); foreach ($this->users as $usr_id) { $user = \User_Adapter::getInstance($usr_id, $this->app); @@ -728,7 +728,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper public function resetRights() { - $base_ids = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(array('canadmin'))); + $base_ids = array_keys($this->app['acl']->get($this->app['authentication']->getUser())->get_granted_base(['canadmin'])); foreach ($this->users as $usr_id) { $user = \User_Adapter::getInstance($usr_id, $this->app); @@ -758,7 +758,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper private function unserializedRequestData(Request $request, array $indexes, $requestIndex) { - $parameters = $data = array(); + $parameters = $data = []; parse_str($request->get($requestIndex), $data); if (count($data) > 0) { diff --git a/lib/Alchemy/Phrasea/Helper/User/Manage.php b/lib/Alchemy/Phrasea/Helper/User/Manage.php index b711635cb0..feb7d54a4d 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Manage.php +++ b/lib/Alchemy/Phrasea/Helper/User/Manage.php @@ -49,7 +49,7 @@ class Manage extends Helper $offset_start = (int) $request->get('offset_start'); $offset_start = $offset_start < 0 ? 0 : $offset_start; - $this->query_parms = array( + $this->query_parms = [ 'inactives' => $request->get('inactives') , 'like_field' => $request->get('like_field') , 'like_value' => $request->get('like_value') @@ -59,7 +59,7 @@ class Manage extends Helper , 'srt' => $request->get("srt", \User_Query::SORT_CREATIONDATE) , 'ord' => $request->get("ord", \User_Query::ORD_DESC) , 'offset_start' => 0 - ); + ]; $query = new \User_Query($this->app); @@ -73,7 +73,7 @@ class Manage extends Helper ->last_model_is($this->query_parms['last_model']) ->get_inactives($this->query_parms['inactives']) ->include_templates(false) - ->on_bases_where_i_am($this->app['acl']->get($this->app['authentication']->getUser()), array('canadmin')) + ->on_bases_where_i_am($this->app['acl']->get($this->app['authentication']->getUser()), ['canadmin']) ->execute(); return $this->results->get_results(); @@ -86,7 +86,7 @@ class Manage extends Helper $results_quantity = (int) $this->request->get('per_page'); $results_quantity = ($results_quantity < 10 || $results_quantity > 50) ? 20 : $results_quantity; - $this->query_parms = array( + $this->query_parms = [ 'inactives' => $this->request->get('inactives') , 'like_field' => $this->request->get('like_field') , 'like_value' => $this->request->get('like_value') @@ -97,7 +97,7 @@ class Manage extends Helper , 'ord' => $this->request->get("ord", \User_Query::ORD_DESC) , 'per_page' => $results_quantity , 'offset_start' => $offset_start - ); + ]; $query = new \User_Query($this->app); @@ -111,7 +111,7 @@ class Manage extends Helper ->last_model_is($this->query_parms['last_model']) ->get_inactives($this->query_parms['inactives']) ->include_templates(true) - ->on_bases_where_i_am($this->app['acl']->get($this->app['authentication']->getUser()), array('canadmin')) + ->on_bases_where_i_am($this->app['acl']->get($this->app['authentication']->getUser()), ['canadmin']) ->limit($offset_start, $results_quantity) ->execute(); @@ -139,13 +139,13 @@ class Manage extends Helper ->only_templates(true) ->execute()->get_results(); - return array( + return [ 'users' => $this->results, 'parm' => $this->query_parms, 'invite_user' => $invite, 'autoregister_user' => $autoregister, 'templates' => $templates - ); + ]; } public function create_newuser() @@ -159,7 +159,7 @@ class Manage extends Helper $conn = $this->app['phraseanet.appbox']->get_connection(); $sql = 'SELECT usr_id FROM usr WHERE usr_mail = :email'; $stmt = $conn->prepare($sql); - $stmt->execute(array(':email' => $email)); + $stmt->execute([':email' => $email]); $row = $stmt->fetch(\PDO::FETCH_ASSOC); $count = count($row); @@ -181,7 +181,7 @@ class Manage extends Helper $urlToken = $this->app['tokens']->getUrlToken(\random::TYPE_PASSWORD, $createdUser->get_id()); if ($receiver && false !== $urlToken) { - $url = $this->app->url('login_renew_password', array('token' => $urlToken)); + $url = $this->app->url('login_renew_password', ['token' => $urlToken]); $mail = MailRequestPasswordSetup::create($this->app, $receiver, null, '', $url); $mail->setLogin($createdUser->get_login()); $this->app['notification.deliverer']->deliver($mail); @@ -194,7 +194,7 @@ class Manage extends Helper if ($receiver) { $expire = new \DateTime('+3 days'); $token = $this->app['tokens']->getUrlToken(\random::TYPE_PASSWORD, $createdUser->get_id(), $expire, $createdUser->get_email()); - $url = $this->app->url('login_register_confirm', array('code' => $token)); + $url = $this->app->url('login_register_confirm', ['code' => $token]); $mail = MailRequestEmailConfirmation::create($this->app, $receiver, null, '', $url, $expire); $this->app['notification.deliverer']->deliver($mail); diff --git a/lib/Alchemy/Phrasea/Helper/WorkZone.php b/lib/Alchemy/Phrasea/Helper/WorkZone.php index 03017b0d13..dd7f4765b8 100644 --- a/lib/Alchemy/Phrasea/Helper/WorkZone.php +++ b/lib/Alchemy/Phrasea/Helper/WorkZone.php @@ -44,7 +44,7 @@ class WorkZone extends Helper /* @var $repo_baskets Alchemy\Phrasea\Model\Repositories\BasketRepository */ $repo_baskets = $this->app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Basket'); - $sort = in_array($sort, array('date', 'name')) ? $sort : 'name'; + $sort = in_array($sort, ['date', 'name']) ? $sort : 'name'; $ret = new ArrayCollection(); @@ -59,7 +59,7 @@ class WorkZone extends Helper $this->app['EM']->persist($basket); $this->app['EM']->flush(); - $baskets = array($basket); + $baskets = [$basket]; } $validations = $repo_baskets->findActiveValidationByUser($this->app['authentication']->getUser(), $sort); diff --git a/lib/Alchemy/Phrasea/Http/ServeFileResponseFactory.php b/lib/Alchemy/Phrasea/Http/ServeFileResponseFactory.php index fd709afbdd..cfa62e3e46 100644 --- a/lib/Alchemy/Phrasea/Http/ServeFileResponseFactory.php +++ b/lib/Alchemy/Phrasea/Http/ServeFileResponseFactory.php @@ -72,7 +72,7 @@ class ServeFileResponseFactory implements DeliverDataInterface private function sanitizeFilename($filename) { - return str_replace(array('/', '\\'), '', $filename); + return str_replace(['/', '\\'], '', $filename); } private function sanitizeFilenameFallback($filename) diff --git a/lib/Alchemy/Phrasea/Http/XSendFile/AbstractXSendFileMode.php b/lib/Alchemy/Phrasea/Http/XSendFile/AbstractXSendFileMode.php index cfc09ffc92..c89a297269 100644 --- a/lib/Alchemy/Phrasea/Http/XSendFile/AbstractXSendFileMode.php +++ b/lib/Alchemy/Phrasea/Http/XSendFile/AbstractXSendFileMode.php @@ -15,7 +15,7 @@ use Alchemy\Phrasea\Exception\InvalidArgumentException; abstract class AbstractXSendFileMode { - protected $mapping = array(); + protected $mapping = []; /** * @params array $mapping diff --git a/lib/Alchemy/Phrasea/Http/XSendFile/ApacheMode.php b/lib/Alchemy/Phrasea/Http/XSendFile/ApacheMode.php index 1102205288..d77aa63103 100644 --- a/lib/Alchemy/Phrasea/Http/XSendFile/ApacheMode.php +++ b/lib/Alchemy/Phrasea/Http/XSendFile/ApacheMode.php @@ -21,9 +21,9 @@ class ApacheMode extends AbstractXSendFileMode implements ModeInterface */ public function setHeaders(Request $request) { - $request->headers->add(array( + $request->headers->add([ 'X-Sendfile-Type' => 'X-SendFile', - )); + ]); } /** @@ -31,7 +31,7 @@ class ApacheMode extends AbstractXSendFileMode implements ModeInterface */ public function setMapping(array $mapping) { - $final = array(); + $final = []; foreach ($mapping as $entry) { if (!is_array($entry)) { @@ -46,9 +46,9 @@ class ApacheMode extends AbstractXSendFileMode implements ModeInterface continue; } - $final[] = array( + $final[] = [ 'directory' => $this->sanitizePath(realpath($entry['directory'])) - ); + ]; } $this->mapping = $final; diff --git a/lib/Alchemy/Phrasea/Http/XSendFile/NginxMode.php b/lib/Alchemy/Phrasea/Http/XSendFile/NginxMode.php index 1d81d329b6..610af6d88a 100644 --- a/lib/Alchemy/Phrasea/Http/XSendFile/NginxMode.php +++ b/lib/Alchemy/Phrasea/Http/XSendFile/NginxMode.php @@ -21,17 +21,17 @@ class NginxMode extends AbstractXSendFileMode implements ModeInterface */ public function setHeaders(Request $request) { - $xAccelMapping = array(); + $xAccelMapping = []; foreach ($this->mapping as $entry) { $xAccelMapping[] = sprintf('%s=%s', $entry['mount-point'], $entry['directory']); } if (count($xAccelMapping) > 0 ) { - $request->headers->add(array( + $request->headers->add([ 'X-Sendfile-Type' => 'X-Accel-Redirect', 'X-Accel-Mapping' => implode(',', $xAccelMapping), - )); + ]); } } @@ -40,7 +40,7 @@ class NginxMode extends AbstractXSendFileMode implements ModeInterface */ public function setMapping(array $mapping) { - $final = array(); + $final = []; foreach ($mapping as $entry) { if (!is_array($entry)) { @@ -59,10 +59,10 @@ class NginxMode extends AbstractXSendFileMode implements ModeInterface continue; } - $final[] = array( + $final[] = [ 'directory' => $this->sanitizePath(realpath($entry['directory'])), 'mount-point' => $this->sanitizeMountPoint($entry['mount-point']) - ); + ]; } $this->mapping = $final; diff --git a/lib/Alchemy/Phrasea/Http/XSendFile/XSendFileFactory.php b/lib/Alchemy/Phrasea/Http/XSendFile/XSendFileFactory.php index 10b67a811d..2f51791a2a 100644 --- a/lib/Alchemy/Phrasea/Http/XSendFile/XSendFileFactory.php +++ b/lib/Alchemy/Phrasea/Http/XSendFile/XSendFileFactory.php @@ -50,7 +50,7 @@ class XSendFileFactory { $conf = $app['configuration']['xsendfile']; - $mapping = array(); + $mapping = []; if (isset($conf['mapping'])) { $mapping = $conf['mapping']; diff --git a/lib/Alchemy/Phrasea/Media/Subdef/Audio.php b/lib/Alchemy/Phrasea/Media/Subdef/Audio.php index 545d6ab407..af0a6de749 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/Audio.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/Audio.php @@ -26,14 +26,14 @@ class Audio extends Provider public function __construct() { - $AVaudiosamplerate = array( + $AVaudiosamplerate = [ 8000, 11025, 16000, 22050, 32000, 44056, 44100, 47250, 48000, 50000, 50400, 88200, 96000 - ); + ]; $this->registerOption(new OptionType\Range(_('Audio Birate'), self::OPTION_AUDIOBITRATE, 32, 320, 128, 32)); $this->registerOption(new OptionType\Enum(_('AudioSamplerate'), self::OPTION_AUDIOSAMPLERATE, $AVaudiosamplerate)); - $this->registerOption(new OptionType\Enum(_('Audio Codec'), self::OPTION_ACODEC, array('libmp3lame', 'flac'), 'libmp3lame')); + $this->registerOption(new OptionType\Enum(_('Audio Codec'), self::OPTION_ACODEC, ['libmp3lame', 'flac'], 'libmp3lame')); } public function getType() diff --git a/lib/Alchemy/Phrasea/Media/Subdef/FlexPaper.php b/lib/Alchemy/Phrasea/Media/Subdef/FlexPaper.php index b9e1dfe71e..4550f67b48 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/FlexPaper.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/FlexPaper.php @@ -19,7 +19,7 @@ namespace Alchemy\Phrasea\Media\Subdef; */ class FlexPaper extends Provider { - protected $options = array(); + protected $options = []; public function __construct() { diff --git a/lib/Alchemy/Phrasea/Media/Subdef/Image.php b/lib/Alchemy/Phrasea/Media/Subdef/Image.php index 9a7f6ee2e3..eda3ebab9b 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/Image.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/Image.php @@ -26,7 +26,7 @@ class Image extends Provider const OPTION_STRIP = 'strip'; const OPTION_QUALITY = 'quality'; - protected $options = array(); + protected $options = []; public function __construct() { diff --git a/lib/Alchemy/Phrasea/Media/Subdef/OptionType/Multi.php b/lib/Alchemy/Phrasea/Media/Subdef/OptionType/Multi.php index e1b5549d3e..344acdf02e 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/OptionType/Multi.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/OptionType/Multi.php @@ -28,7 +28,7 @@ class Multi implements OptionType { $this->displayName = $displayName; $this->name = $name; - $this->available = array(); + $this->available = []; foreach ($available as $a) { $this->available[$a] = false; } @@ -93,7 +93,7 @@ class Multi implements OptionType return $this->available; } - $value = array(); + $value = []; foreach ($this->available as $a => $selected) { if ($selected) { diff --git a/lib/Alchemy/Phrasea/Media/Subdef/Provider.php b/lib/Alchemy/Phrasea/Media/Subdef/Provider.php index a068f63a9f..4a000aef59 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/Provider.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/Provider.php @@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Media\Subdef; */ abstract class Provider implements Subdef { - protected $options = array(); + protected $options = []; protected $spec; public function registerOption(OptionType\OptionType $option) diff --git a/lib/Alchemy/Phrasea/Media/Subdef/Video.php b/lib/Alchemy/Phrasea/Media/Subdef/Video.php index 3a5f8d2293..07a12fdd56 100644 --- a/lib/Alchemy/Phrasea/Media/Subdef/Video.php +++ b/lib/Alchemy/Phrasea/Media/Subdef/Video.php @@ -25,7 +25,7 @@ class Video extends Audio const OPTION_VCODEC = 'vcodec'; const OPTION_GOPSIZE = 'GOPsize'; - protected $options = array(); + protected $options = []; public function __construct() { @@ -35,9 +35,9 @@ class Video extends Audio $this->registerOption(new OptionType\Range(_('GOP size'), self::OPTION_GOPSIZE, 1, 300, 10)); $this->registerOption(new OptionType\Range(_('Dimension'), self::OPTION_SIZE, 64, 2000, 600, 16)); $this->registerOption(new OptionType\Range(_('Frame Rate'), self::OPTION_FRAMERATE, 1, 200, 20)); - $this->registerOption(new OptionType\Enum(_('Video Codec'), self::OPTION_VCODEC, array('libx264', 'libvpx', 'libtheora'), 'libx264')); + $this->registerOption(new OptionType\Enum(_('Video Codec'), self::OPTION_VCODEC, ['libx264', 'libvpx', 'libtheora'], 'libx264')); $this->unregisterOption(self::OPTION_ACODEC); - $this->registerOption(new OptionType\Enum(_('Audio Codec'), self::OPTION_ACODEC, array('libfaac', 'libvo_aacenc', 'libmp3lame', 'libvorbis'), 'libfaac')); + $this->registerOption(new OptionType\Enum(_('Audio Codec'), self::OPTION_ACODEC, ['libfaac', 'libvo_aacenc', 'libmp3lame', 'libvorbis'], 'libfaac')); } public function getType() diff --git a/lib/Alchemy/Phrasea/Metadata/TagProvider.php b/lib/Alchemy/Phrasea/Metadata/TagProvider.php index ad888ccdd3..26009ffe87 100644 --- a/lib/Alchemy/Phrasea/Metadata/TagProvider.php +++ b/lib/Alchemy/Phrasea/Metadata/TagProvider.php @@ -20,7 +20,7 @@ class TagProvider extends ExiftoolTagProvider parent::__construct(); $this['Phraseanet'] = $this->share(function () { - return array( + return [ 'PdfText' => new \Alchemy\Phrasea\Metadata\Tag\PdfText(), 'TfArchivedate' => new \Alchemy\Phrasea\Metadata\Tag\TfArchivedate(), 'TfAtime' => new \Alchemy\Phrasea\Metadata\Tag\TfAtime(), @@ -41,7 +41,7 @@ class TagProvider extends ExiftoolTagProvider 'TfRecordid' => new \Alchemy\Phrasea\Metadata\Tag\TfRecordid(), 'TfSize' => new \Alchemy\Phrasea\Metadata\Tag\TfSize(), 'TfWidth' => new \Alchemy\Phrasea\Metadata\Tag\TfWidth(), - ); + ]; }); } @@ -57,107 +57,107 @@ class TagProvider extends ExiftoolTagProvider { $table = parent::getLookupTable(); - $table['phraseanet'] = array( - 'pdftext' => array( + $table['phraseanet'] = [ + 'pdftext' => [ 'tagname' => 'PdfText', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\PdfText', - 'namespace' => 'Phraseanet'), - 'tfarchivedate' => array( + 'namespace' => 'Phraseanet'], + 'tfarchivedate' => [ 'tagname' => 'TfArchivedate', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfArchivedate', 'namespace' => 'Phraseanet' - ), - 'tfatime' => array( + ], + 'tfatime' => [ 'tagname' => 'TfAtime', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfAtime', 'namespace' => 'Phraseanet' - ), - 'tfbasename' => array( + ], + 'tfbasename' => [ 'tagname' => 'TfBasename', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfBasename', 'namespace' => 'Phraseanet' - ), - 'tfbits' => array( + ], + 'tfbits' => [ 'tagname' => 'TfBits', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfBits', 'namespace' => 'Phraseanet' - ), - 'tfchannels' => array( + ], + 'tfchannels' => [ 'tagname' => 'TfChannels', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfChannels', 'namespace' => 'Phraseanet' - ), - 'tTfCtime' => array( + ], + 'tTfCtime' => [ 'tagname' => 'TfCtime', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfCtime', 'namespace' => 'Phraseanet' - ), - 'tfdirname' => array( + ], + 'tfdirname' => [ 'tagname' => 'TfDirname', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfDirname', 'namespace' => 'Phraseanet' - ), - 'tfduration' => array( + ], + 'tfduration' => [ 'tagname' => 'TfDuration', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfDuration', 'namespace' => 'Phraseanet' - ), - 'tfeditdate' => array( + ], + 'tfeditdate' => [ 'tagname' => 'TfEditdate', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfEditdate', 'namespace' => 'Phraseanet' - ), - 'tfextension' => array( + ], + 'tfextension' => [ 'tagname' => 'TfExtension', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfExtension', 'namespace' => 'Phraseanet' - ), - 'tffilename' => array( + ], + 'tffilename' => [ 'tagname' => 'TfFilename', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfFilename', 'namespace' => 'Phraseanet' - ), - 'tffilepath' => array( + ], + 'tffilepath' => [ 'tagname' => 'TfFilepath', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfFilepath', 'namespace' => 'Phraseanet' - ), - 'tfheight' => array( + ], + 'tfheight' => [ 'tagname' => 'TfHeight', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfHeight', 'namespace' => 'Phraseanet' - ), - 'tfmimetype' => array( + ], + 'tfmimetype' => [ 'tagname' => 'TfMimetype', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfMimetype', 'namespace' => 'Phraseanet' - ), - 'tfmtime' => array( + ], + 'tfmtime' => [ 'tagname' => 'TfMtime', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfMtime', 'namespace' => 'Phraseanet' - ), - 'tfquarantine' => array( + ], + 'tfquarantine' => [ 'tagname' => 'TfQuarantine', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfQuarantine', 'namespace' => 'Phraseanet' - ), - 'tfrecordid' => array( + ], + 'tfrecordid' => [ 'tagname' => 'TfRecordid', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfRecordid', 'namespace' => 'Phraseanet' - ), - 'tfsize' => array( + ], + 'tfsize' => [ 'tagname' => 'TfSize', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfSize', 'namespace' => 'Phraseanet' - ), - 'tfwidth' => array( + ], + 'tfwidth' => [ 'tagname' => 'TfWidth', 'classname' => '\\Alchemy\\Phrasea\\Metadata\\Tag\\TfWidth', 'namespace' => 'Phraseanet' - ), - ); + ], + ]; return $table; } diff --git a/lib/Alchemy/Phrasea/Model/Entities/LazaretFile.php b/lib/Alchemy/Phrasea/Model/Entities/LazaretFile.php index 29473fda6c..61508b63e0 100644 --- a/lib/Alchemy/Phrasea/Model/Entities/LazaretFile.php +++ b/lib/Alchemy/Phrasea/Model/Entities/LazaretFile.php @@ -425,7 +425,7 @@ class LazaretFile */ public function getRecordsToSubstitute(Application $app) { - $ret = array(); + $ret = []; $shaRecords = \record_adapter::get_record_by_sha( $app, $this->getCollection($app)->get_sbas_id(), $this->getSha256() diff --git a/lib/Alchemy/Phrasea/Model/Entities/Task.php b/lib/Alchemy/Phrasea/Model/Entities/Task.php index 93bed32811..696531795f 100644 --- a/lib/Alchemy/Phrasea/Model/Entities/Task.php +++ b/lib/Alchemy/Phrasea/Model/Entities/Task.php @@ -198,7 +198,7 @@ class Task */ public function setStatus($status) { - if (!in_array($status, array(static::STATUS_STARTED, static::STATUS_STOPPED), true)) { + if (!in_array($status, [static::STATUS_STARTED, static::STATUS_STOPPED], true)) { throw new InvalidArgumentException('Invalid status value.'); } diff --git a/lib/Alchemy/Phrasea/Model/Entities/User.php b/lib/Alchemy/Phrasea/Model/Entities/User.php index 916039f696..3f20659a49 100644 --- a/lib/Alchemy/Phrasea/Model/Entities/User.php +++ b/lib/Alchemy/Phrasea/Model/Entities/User.php @@ -48,7 +48,7 @@ class User * * @var array */ - private static $defaultUserSettings = array( + private static $defaultUserSettings = [ 'view' => 'thumbs', 'images_per_page' => '20', 'images_size' => '120', @@ -70,7 +70,7 @@ class User 'basket_caption_display' => '0', 'basket_status_display' => '0', 'basket_title_display' => '0' - ); + ]; /** * @ORM\Column(type="integer") @@ -439,11 +439,11 @@ class User */ public function setGender($gender) { - if (null !== $gender && !in_array($gender, array( + if (null !== $gender && !in_array($gender, [ self::GENDER_MISS, self::GENDER_MR, self::GENDER_MRS - ))) { + ])) { throw new InvalidArgumentException(sprintf("Invalid gender %s.", $gender)); } @@ -1018,7 +1018,7 @@ class User */ public function isSpecial() { - return in_array($this->login, array(self::USER_GUEST, self::USER_AUTOREGISTER)); + return in_array($this->login, [self::USER_GUEST, self::USER_AUTOREGISTER]); } /** diff --git a/lib/Alchemy/Phrasea/Model/Entities/UsrListOwner.php b/lib/Alchemy/Phrasea/Model/Entities/UsrListOwner.php index 7763147922..865bd3c53f 100644 --- a/lib/Alchemy/Phrasea/Model/Entities/UsrListOwner.php +++ b/lib/Alchemy/Phrasea/Model/Entities/UsrListOwner.php @@ -111,7 +111,7 @@ class UsrListOwner */ public function setRole($role) { - if ( ! in_array($role, array(self::ROLE_ADMIN, self::ROLE_EDITOR, self::ROLE_USER))) + if ( ! in_array($role, [self::ROLE_ADMIN, self::ROLE_EDITOR, self::ROLE_USER])) throw new \Exception('Unknown role `' . $role . '`'); $this->role = $role; diff --git a/lib/Alchemy/Phrasea/Model/Manager/UserManager.php b/lib/Alchemy/Phrasea/Model/Manager/UserManager.php index 64f87d1a9d..01eedfb30e 100644 --- a/lib/Alchemy/Phrasea/Model/Manager/UserManager.php +++ b/lib/Alchemy/Phrasea/Model/Manager/UserManager.php @@ -137,7 +137,7 @@ class UserManager private function cleanFtpExports(User $user) { $elements = $this->objectManager->getRepository('Alchemy\Phrasea\Model\Entities\FtpExport') - ->findBy(array('usrId' => $user->getId())); + ->findBy(['usrId' => $user->getId()]); foreach ($elements as $element) { $this->objectManager->remove($element); @@ -152,7 +152,7 @@ class UserManager private function cleanOrders(User $user) { $orders = $this->objectManager->getRepository('Alchemy\Phrasea\Model\Entities\Order') - ->findBy(array('usrId' => $user->getId())); + ->findBy(['usrId' => $user->getId()]); foreach ($orders as $order) { $this->objectManager->remove($order); @@ -166,13 +166,13 @@ class UserManager */ private function cleanProperties(User $user) { - foreach(array( + foreach ([ 'DELETE FROM `edit_presets` WHERE usr_id = :usr_id', 'DELETE FROM `sselnew` WHERE usr_id = :usr_id', 'DELETE FROM `tokens` WHERE usr_id = :usr_id', - ) as $sql) { + ] as $sql) { $stmt = $this->appboxConnection->prepare($sql); - $stmt->execute(array(':usr_id' => $user->getId())); + $stmt->execute([':usr_id' => $user->getId()]); $stmt->closeCursor(); } @@ -190,12 +190,12 @@ class UserManager */ private function cleanRights(User $user) { - foreach(array( + foreach ([ 'DELETE FROM `basusr` WHERE usr_id = :usr_id', 'DELETE FROM `sbasusr` WHERE usr_id = :usr_id', - ) as $sql) { + ] as $sql) { $stmt = $this->appboxConnection->prepare($sql); - $stmt->execute(array(':usr_id' => $user->getId())); + $stmt->execute([':usr_id' => $user->getId()]); $stmt->closeCursor(); } } diff --git a/lib/Alchemy/Phrasea/Model/Manipulator/ACLManipulator.php b/lib/Alchemy/Phrasea/Model/Manipulator/ACLManipulator.php index 8b47cab291..430a466bc6 100644 --- a/lib/Alchemy/Phrasea/Model/Manipulator/ACLManipulator.php +++ b/lib/Alchemy/Phrasea/Model/Manipulator/ACLManipulator.php @@ -79,12 +79,12 @@ class ACLManipulator implements ManipulatorInterface { $collections = $databox->get_collections(); - $acl->update_rights_to_sbas($databox->get_sbas_id(), array( + $acl->update_rights_to_sbas($databox->get_sbas_id(), [ 'bas_manage' => '1', 'bas_modify_struct' => '1', 'bas_modif_th' => '1', 'bas_chupub' => '1' - )); + ]); $acl->give_access_to_base(array_map(function (\collection $collection) { return $collection->get_base_id(); @@ -108,7 +108,7 @@ class ACLManipulator implements ManipulatorInterface $acl->set_limits($baseId, false); $acl->remove_quotas_on_base($baseId); $acl->set_masks_on_base($baseId, '0', '0', '0', '0'); - $acl->update_rights_to_base($baseId, array( + $acl->update_rights_to_base($baseId, [ 'canputinalbum' => '1', 'candwnldhd' => '1', 'candwnldsubdef' => '1', @@ -127,7 +127,7 @@ class ACLManipulator implements ManipulatorInterface 'manage' => '1', 'modify_struct' => '1', 'bas_modify_struct' => '1' - )); + ]); } /** @@ -140,7 +140,7 @@ class ACLManipulator implements ManipulatorInterface private function makeTraversable($var) { if (!is_array($var) && !$var instanceof \Traversable) { - return array($var); + return [$var]; } return $var; diff --git a/lib/Alchemy/Phrasea/Model/Manipulator/UserManipulator.php b/lib/Alchemy/Phrasea/Model/Manipulator/UserManipulator.php index 5edf389598..01b75ad7ab 100644 --- a/lib/Alchemy/Phrasea/Model/Manipulator/UserManipulator.php +++ b/lib/Alchemy/Phrasea/Model/Manipulator/UserManipulator.php @@ -293,7 +293,7 @@ class UserManipulator implements ManipulatorInterface private function makeTraversable($var) { if (!is_array($var) && !$var instanceof \Traversable) { - return array($var); + return [$var]; } return $var; diff --git a/lib/Alchemy/Phrasea/Model/MonologSQLLogger.php b/lib/Alchemy/Phrasea/Model/MonologSQLLogger.php index a944af7e9c..aee7ec3d80 100644 --- a/lib/Alchemy/Phrasea/Model/MonologSQLLogger.php +++ b/lib/Alchemy/Phrasea/Model/MonologSQLLogger.php @@ -31,7 +31,7 @@ class MonologSQLLogger implements SQLLogger */ private $logger; private $start; - private $output = array(); + private $output = []; private $outputType; /** diff --git a/lib/Alchemy/Phrasea/Model/Repositories/AuthFailureRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/AuthFailureRepository.php index 592c67c128..91e2d58863 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/AuthFailureRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/AuthFailureRepository.php @@ -20,7 +20,7 @@ class AuthFailureRepository extends EntityRepository FROM Alchemy\Phrasea\Model\Entities\AuthFailure f WHERE f.created < :date'; - $params = array('date' => $date->format('Y-m-d h:i:s')); + $params = ['date' => $date->format('Y-m-d h:i:s')]; $query = $this->_em->createQuery($dql); $query->setParameters($params); @@ -35,10 +35,10 @@ class AuthFailureRepository extends EntityRepository WHERE (f.username = :username OR f.ip = :ip) AND f.locked = true'; - $params = array( + $params = [ 'username' => $username, 'ip' => $ip, - ); + ]; $query = $this->_em->createQuery($dql); $query->setParameters($params); diff --git a/lib/Alchemy/Phrasea/Model/Repositories/BasketElementRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/BasketElementRepository.php index fededd3268..1cd35e8f08 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/BasketElementRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/BasketElementRepository.php @@ -26,11 +26,11 @@ class BasketElementRepository extends EntityRepository WHERE (b.usr_id = :usr_id OR p.usr_id = :same_usr_id) AND e.id = :element_id'; - $params = array( + $params = [ 'usr_id' => $user->get_id(), 'same_usr_id' => $user->get_id(), 'element_id' => $element_id - ); + ]; $query = $this->_em->createQuery($dql); $query->setParameters($params); @@ -55,10 +55,10 @@ class BasketElementRepository extends EntityRepository WHERE e.record_id = :record_id AND e.sbas_id = :sbas_id'; - $params = array( + $params = [ 'sbas_id' => $record->get_sbas_id(), 'record_id' => $record->get_record_id() - ); + ]; $query = $this->_em->createQuery($dql); $query->setParameters($params); @@ -75,9 +75,9 @@ class BasketElementRepository extends EntityRepository LEFT JOIN s.participants p WHERE e.sbas_id = :sbas_id'; - $params = array( + $params = [ 'sbas_id' => $databox->get_sbas_id(), - ); + ]; $query = $this->_em->createQuery($dql); $query->setParameters($params); @@ -103,11 +103,11 @@ class BasketElementRepository extends EntityRepository AND e.record_id = :record_id AND e.sbas_id = :sbas_id'; - $params = array( + $params = [ 'sbas_id' => $record->get_sbas_id(), 'record_id' => $record->get_record_id(), 'usr_id' => $user->get_id() - ); + ]; $query = $this->_em->createQuery($dql); $query->setParameters($params); @@ -126,11 +126,11 @@ class BasketElementRepository extends EntityRepository AND e.record_id = :record_id AND e.sbas_id = :sbas_id'; - $params = array( + $params = [ 'sbas_id' => $record->get_sbas_id(), 'record_id' => $record->get_record_id(), 'usr_id' => $user->get_id() - ); + ]; $query = $this->_em->createQuery($dql); $query->setParameters($params); diff --git a/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php index dd9595f534..e40653eed7 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/BasketRepository.php @@ -47,7 +47,7 @@ class BasketRepository extends EntityRepository } $query = $this->_em->createQuery($dql); - $query->setParameters(array('usr_id' => $user->get_id())); + $query->setParameters(['usr_id' => $user->get_id()]); return $query->getResult(); } @@ -74,11 +74,11 @@ class BasketRepository extends EntityRepository ) AND (s.expires IS NULL OR s.expires > CURRENT_TIMESTAMP())'; - $params = array( + $params = [ 'usr_id_owner' => $user->get_id(), 'usr_id_ownertwo' => $user->get_id(), 'usr_id_participant' => $user->get_id() - ); + ]; $query = $this->_em->createQuery($dql); $query->setParameters($params); @@ -111,7 +111,7 @@ class BasketRepository extends EntityRepository } $query = $this->_em->createQuery($dql); - $query->setParameters(array(1 => $user->get_id(), 2 => $user->get_id())); + $query->setParameters([1 => $user->get_id(), 2 => $user->get_id()]); return $query->getResult(); } @@ -125,10 +125,10 @@ class BasketRepository extends EntityRepository WHERE e.record_id = :record_id AND e.sbas_id = e.sbas_id AND b.usr_id = :usr_id'; - $params = array( + $params = [ 'record_id' => $record->get_record_id(), 'usr_id' => $user->get_id() - ); + ]; $query = $this->_em->createQuery($dql); $query->setParameters($params); @@ -138,7 +138,7 @@ class BasketRepository extends EntityRepository public function findWorkzoneBasket(\User_Adapter $user, $query, $year, $type, $offset, $perPage) { - $params = array(); + $params = []; switch ($type) { case self::RECEIVED: @@ -146,9 +146,9 @@ class BasketRepository extends EntityRepository FROM Alchemy\Phrasea\Model\Entities\Basket b JOIN b.elements e WHERE b.usr_id = :usr_id AND b.pusher_id IS NOT NULL'; - $params = array( + $params = [ 'usr_id' => $user->get_id() - ); + ]; break; case self::VALIDATION_DONE: $dql = 'SELECT b @@ -157,10 +157,10 @@ class BasketRepository extends EntityRepository JOIN b.validation s JOIN s.participants p WHERE b.usr_id != ?1 AND p.usr_id = ?2'; - $params = array( + $params = [ 1 => $user->get_id() , 2 => $user->get_id() - ); + ]; break; case self::VALIDATION_SENT: $dql = 'SELECT b @@ -168,9 +168,9 @@ class BasketRepository extends EntityRepository JOIN b.elements e JOIN b.validation v WHERE b.usr_id = :usr_id'; - $params = array( + $params = [ 'usr_id' => $user->get_id() - ); + ]; break; default: $dql = 'SELECT b @@ -179,10 +179,10 @@ class BasketRepository extends EntityRepository LEFT JOIN b.validation s LEFT JOIN s.participants p WHERE (b.usr_id = :usr_id OR p.usr_id = :validating_usr_id)'; - $params = array( + $params = [ 'usr_id' => $user->get_id(), 'validating_usr_id' => $user->get_id() - ); + ]; break; case self::MYBASKETS: $dql = 'SELECT b @@ -191,9 +191,9 @@ class BasketRepository extends EntityRepository LEFT JOIN b.validation s LEFT JOIN s.participants p WHERE (b.usr_id = :usr_id)'; - $params = array( + $params = [ 'usr_id' => $user->get_id() - ); + ]; break; } @@ -249,7 +249,7 @@ class BasketRepository extends EntityRepository } $query = $this->_em->createQuery($dql); - $query->setParameters(array('usr_id' => $user->get_id())); + $query->setParameters(['usr_id' => $user->get_id()]); return $query->getResult(); } diff --git a/lib/Alchemy/Phrasea/Model/Repositories/FeedItemRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/FeedItemRepository.php index 272f0f22ba..3e3f38d75b 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/FeedItemRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/FeedItemRepository.php @@ -34,7 +34,7 @@ class FeedItemRepository extends EntityRepository AND f.public = true'; $query = $this->_em->createQuery($dql); - $query->setParameters(array('sbas_id' => $sbas_id, 'record_id' => $record_id)); + $query->setParameters(['sbas_id' => $sbas_id, 'record_id' => $record_id]); return count($query->getResult()) > 0; } @@ -50,7 +50,7 @@ class FeedItemRepository extends EntityRepository public function loadLatest(Application $app, $nbItems = 20) { $execution = 0; - $items = array(); + $items = []; do { $dql = 'SELECT i diff --git a/lib/Alchemy/Phrasea/Model/Repositories/FtpExportRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/FtpExportRepository.php index 94eaeb789e..472f40c56d 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/FtpExportRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/FtpExportRepository.php @@ -59,6 +59,6 @@ class FtpExportRepository extends EntityRepository */ public function findByUser(\User_Adapter $user) { - return $this->findBy(array('usrId' => $user->get_id())); + return $this->findBy(['usrId' => $user->get_id()]); } } diff --git a/lib/Alchemy/Phrasea/Model/Repositories/OrderRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/OrderRepository.php index d36e8d026a..c89ddb374d 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/OrderRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/OrderRepository.php @@ -21,7 +21,7 @@ class OrderRepository extends EntityRepository */ public function findByUser(\User_Adapter $user) { - return $this->findBy(array('usrId' => $user->get_id())); + return $this->findBy(['usrId' => $user->get_id()]); } /** @@ -66,7 +66,7 @@ class OrderRepository extends EntityRepository * * @return integer */ - public function countTotalOrders(array $baseIds = array()) + public function countTotalOrders(array $baseIds = []) { $qb = $this ->createQueryBuilder('o'); diff --git a/lib/Alchemy/Phrasea/Model/Repositories/StoryWZRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/StoryWZRepository.php index b7b73a0c98..5847feb2d0 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/StoryWZRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/StoryWZRepository.php @@ -25,7 +25,7 @@ class StoryWZRepository extends EntityRepository } $query = $this->_em->createQuery($dql); - $query->setParameters(array('usr_id' => $user->get_id())); + $query->setParameters(['usr_id' => $user->get_id()]); $stories = $query->getResult(); @@ -41,7 +41,7 @@ class StoryWZRepository extends EntityRepository $this->getEntityManager()->flush(); if ($sort == 'name') { - $sortedStories = array(); + $sortedStories = []; foreach ($stories as $story) { $sortedStories[] = $story->getRecord($app)->get_title(); } @@ -87,11 +87,11 @@ class StoryWZRepository extends EntityRepository public function findUserStory(Application $app, \User_Adapter $user, \record_adapter $Story) { $story = $this->findOneBy( - array( + [ 'usr_id' => $user->get_id(), 'sbas_id' => $Story->get_sbas_id(), 'record_id' => $Story->get_record_id(), - ) + ] ); if ($story) { @@ -113,10 +113,10 @@ class StoryWZRepository extends EntityRepository AND s.record_id = :record_id'; $query = $this->_em->createQuery($dql); - $query->setParameters(array( + $query->setParameters([ 'sbas_id' => $Story->get_sbas_id(), 'record_id' => $Story->get_record_id(), - )); + ]); $stories = $query->getResult(); @@ -138,9 +138,9 @@ class StoryWZRepository extends EntityRepository $dql = 'SELECT s FROM Alchemy\Phrasea\Model\Entities\StoryWZ s WHERE s.sbas_id = :sbas_id'; $query = $this->_em->createQuery($dql); - $query->setParameters(array( + $query->setParameters([ 'sbas_id' => $databox->get_sbas_id(), - )); + ]); $stories = $query->getResult(); diff --git a/lib/Alchemy/Phrasea/Model/Repositories/UserRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/UserRepository.php index 2181933111..f9283bc82a 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/UserRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/UserRepository.php @@ -47,7 +47,7 @@ class UserRepository extends EntityRepository */ public function findByLogin($login) { - return $this->findOneBy(array('login' => $login)); + return $this->findOneBy(['login' => $login]); } /** diff --git a/lib/Alchemy/Phrasea/Model/Repositories/UsrAuthProviderRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/UsrAuthProviderRepository.php index 34e4d43e97..dd5409293c 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/UsrAuthProviderRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/UsrAuthProviderRepository.php @@ -18,7 +18,7 @@ class UsrAuthProviderRepository extends EntityRepository FROM Alchemy\Phrasea\Model\Entities\UsrAuthProvider u WHERE u.usr_id = :usrId'; - $params = array('usrId' => $user->get_id()); + $params = ['usrId' => $user->get_id()]; $query = $this->_em->createQuery($dql); $query->setParameters($params); @@ -32,7 +32,7 @@ class UsrAuthProviderRepository extends EntityRepository FROM Alchemy\Phrasea\Model\Entities\UsrAuthProvider u WHERE u.provider = :providerId AND u.distant_id = :distantId'; - $params = array('providerId' => $providerId, 'distantId' => $distantId); + $params = ['providerId' => $providerId, 'distantId' => $distantId]; $query = $this->_em->createQuery($dql); $query->setParameters($params); diff --git a/lib/Alchemy/Phrasea/Model/Repositories/UsrListEntryRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/UsrListEntryRepository.php index b9d2900ea1..9d41de33d0 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/UsrListEntryRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/UsrListEntryRepository.php @@ -28,9 +28,9 @@ class UsrListEntryRepository extends EntityRepository $dql = 'SELECT e FROM Alchemy\Phrasea\Model\Entities\UsrListEntry e WHERE e.usr_id = :usr_id'; - $params = array( + $params = [ 'usr_id' => $user->get_id(), - ); + ]; $query = $this->_em->createQuery($dql); $query->setParameters($params); @@ -60,10 +60,10 @@ class UsrListEntryRepository extends EntityRepository JOIN e.list l WHERE e.usr_id = :usr_id AND l.id = :list_id'; - $params = array( + $params = [ 'usr_id' => $usr_id, 'list_id' => $list->getId(), - ); + ]; $query = $this->_em->createQuery($dql); $query->setParameters($params); diff --git a/lib/Alchemy/Phrasea/Model/Repositories/UsrListOwnerRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/UsrListOwnerRepository.php index 7c66fb4fb1..eb3b8fb2a8 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/UsrListOwnerRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/UsrListOwnerRepository.php @@ -53,10 +53,10 @@ class UsrListOwnerRepository extends EntityRepository JOIN o.list l WHERE l.id = :list_id AND o.usr_id = :usr_id'; - $params = array( + $params = [ 'usr_id' => $usr_id, 'list_id' => $list->getId() - ); + ]; $query = $this->_em->createQuery($dql); $query->setParameters($params); diff --git a/lib/Alchemy/Phrasea/Model/Repositories/UsrListRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/UsrListRepository.php index a7fcc9e9ca..38a5e4aa4b 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/UsrListRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/UsrListRepository.php @@ -29,9 +29,9 @@ class UsrListRepository extends EntityRepository JOIN l.owners o WHERE o.usr_id = :usr_id'; - $params = array( + $params = [ 'usr_id' => $user->get_id(), - ); + ]; $query = $this->_em->createQuery($dql); $query->setParameters($params); @@ -74,10 +74,10 @@ class UsrListRepository extends EntityRepository JOIN l.owners o WHERE o.usr_id = :usr_id AND l.name LIKE :name'; - $params = array( + $params = [ 'usr_id' => $user->get_id(), 'name' => $name . '%' - ); + ]; $query = $this->_em->createQuery($dql); $query->setParameters($params); diff --git a/lib/Alchemy/Phrasea/Notification/Deliverer.php b/lib/Alchemy/Phrasea/Notification/Deliverer.php index 6a09287db5..7fa2781968 100644 --- a/lib/Alchemy/Phrasea/Notification/Deliverer.php +++ b/lib/Alchemy/Phrasea/Notification/Deliverer.php @@ -68,7 +68,7 @@ class Deliverer if (!$mail->getEmitter()) { throw new LogicException('You must provide an emitter for a ReadReceipt'); } - $message->setReadReceiptTo(array($mail->getEmitter()->getEmail() => $mail->getEmitter()->getName())); + $message->setReadReceiptTo([$mail->getEmitter()->getEmail() => $mail->getEmitter()->getName()]); } $ret = $this->mailer->send($message); diff --git a/lib/Alchemy/Phrasea/Notification/Mail/AbstractMail.php b/lib/Alchemy/Phrasea/Notification/Mail/AbstractMail.php index 016b724962..2fd672a58a 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/AbstractMail.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/AbstractMail.php @@ -47,7 +47,7 @@ abstract class AbstractMail implements MailInterface */ public function renderHTML() { - return $this->app['twig']->render('email-template.html.twig', array( + return $this->app['twig']->render('email-template.html.twig', [ 'phraseanetURL' => $this->getPhraseanetURL(), 'phraseanetTitle' => $this->getPhraseanetTitle(), 'logoUrl' => $this->getLogoUrl(), @@ -59,7 +59,7 @@ abstract class AbstractMail implements MailInterface 'expiration' => $this->getExpiration(), 'buttonUrl' => $this->getButtonURL(), 'buttonText' => $this->getButtonText(), - )); + ]); } /** diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoSomebodyAutoregistered.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoSomebodyAutoregistered.php index 17cd0b220c..2776425cf8 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoSomebodyAutoregistered.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoSomebodyAutoregistered.php @@ -45,6 +45,6 @@ class MailInfoSomebodyAutoregistered extends AbstractMailWithLink */ public function getButtonURL() { - return $this->app->url('admin', array('section' => 'users')); + return $this->app->url('admin', ['section' => 'users']); } } diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoUserRegistered.php b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoUserRegistered.php index 0981334531..0516af5e60 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailInfoUserRegistered.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailInfoUserRegistered.php @@ -65,6 +65,6 @@ class MailInfoUserRegistered extends AbstractMail */ public function getButtonURL() { - return $this->app->url('admin', array('section' => 'registrations')); + return $this->app->url('admin', ['section' => 'registrations']); } } diff --git a/lib/Alchemy/Phrasea/Out/Module/PDF.php b/lib/Alchemy/Phrasea/Out/Module/PDF.php index ec2d10562f..6f1b811801 100644 --- a/lib/Alchemy/Phrasea/Out/Module/PDF.php +++ b/lib/Alchemy/Phrasea/Out/Module/PDF.php @@ -36,7 +36,7 @@ class PDF { $this->app = $app; - $list = array(); + $list = []; foreach ($records as $record) { switch ($layout) { @@ -458,8 +458,8 @@ class PDF $this->pdf->SetFont(PhraseaPDF::FONT, '', 12); $t = str_replace( - array("<", ">", "&") - , array("<", ">", "&") + ["<", ">", "&"] + , ["<", ">", "&"] , strip_tags($field->get_serialized_values()) ); diff --git a/lib/Alchemy/Phrasea/Plugin/Exception/JsonValidationException.php b/lib/Alchemy/Phrasea/Plugin/Exception/JsonValidationException.php index e74656fd56..d0d6e363a0 100644 --- a/lib/Alchemy/Phrasea/Plugin/Exception/JsonValidationException.php +++ b/lib/Alchemy/Phrasea/Plugin/Exception/JsonValidationException.php @@ -17,7 +17,7 @@ class JsonValidationException extends RuntimeException { protected $errors; - public function __construct($message, $errors = array()) + public function __construct($message, $errors = []) { $this->errors = $errors; parent::__construct($message); diff --git a/lib/Alchemy/Phrasea/Plugin/Management/ComposerInstaller.php b/lib/Alchemy/Phrasea/Plugin/Management/ComposerInstaller.php index 79394d8fca..3ba13cf9bf 100644 --- a/lib/Alchemy/Phrasea/Plugin/Management/ComposerInstaller.php +++ b/lib/Alchemy/Phrasea/Plugin/Management/ComposerInstaller.php @@ -66,12 +66,12 @@ class ComposerInstaller throw new ComposerInstallException('Unable to install composer.', $e->getCode(), $e); } } else { - $process = ProcessBuilder::create(array( + $process = ProcessBuilder::create([ $this->phpExecutable, $this->composer, 'self-update' - ))->getProcess(); + ])->getProcess(); $process->run(); } - return ProcessBuilder::create(array($this->phpExecutable, $this->composer)); + return ProcessBuilder::create([$this->phpExecutable, $this->composer]); } } diff --git a/lib/Alchemy/Phrasea/Plugin/Schema/Manifest.php b/lib/Alchemy/Phrasea/Plugin/Schema/Manifest.php index 779909c690..ecbee28b98 100644 --- a/lib/Alchemy/Phrasea/Plugin/Schema/Manifest.php +++ b/lib/Alchemy/Phrasea/Plugin/Schema/Manifest.php @@ -67,17 +67,17 @@ class Manifest public function getServices() { - return $this->get('services') ? : array(); + return $this->get('services') ? : []; } public function getCommands() { - return $this->get('commands') ? : array(); + return $this->get('commands') ? : []; } public function getTwigPaths() { - return $this->get('twig-paths') ? : array(); + return $this->get('twig-paths') ? : []; } public function getExtra() diff --git a/lib/Alchemy/Phrasea/Plugin/Schema/ManifestValidator.php b/lib/Alchemy/Phrasea/Plugin/Schema/ManifestValidator.php index 26e9d18c5b..1f368f6c26 100644 --- a/lib/Alchemy/Phrasea/Plugin/Schema/ManifestValidator.php +++ b/lib/Alchemy/Phrasea/Plugin/Schema/ManifestValidator.php @@ -45,7 +45,7 @@ class ManifestValidator $this->validator->check($data, $this->schemaData); if (!$this->validator->isValid()) { - $errors = array(); + $errors = []; foreach ((array) $this->validator->getErrors() as $error) { $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message']; } @@ -53,7 +53,7 @@ class ManifestValidator } if (!preg_match('/^[a-z0-9-_]+$/', $data->name)) { - throw new JsonValidationException('Does not match the expected JSON schema', array('"name" must not contains only alphanumeric caracters')); + throw new JsonValidationException('Does not match the expected JSON schema', ['"name" must not contains only alphanumeric caracters']); } if (isset($data->{'minimum-phraseanet-version'})) { diff --git a/lib/Alchemy/Phrasea/Plugin/Schema/PluginValidator.php b/lib/Alchemy/Phrasea/Plugin/Schema/PluginValidator.php index c963a0c363..0f10b199f0 100644 --- a/lib/Alchemy/Phrasea/Plugin/Schema/PluginValidator.php +++ b/lib/Alchemy/Phrasea/Plugin/Schema/PluginValidator.php @@ -95,7 +95,7 @@ class PluginValidator } if (is_array($data)) { - return array_map(array($this, 'objectToArray'), $data); + return array_map([$this, 'objectToArray'], $data); } return $data; diff --git a/lib/Alchemy/Phrasea/SearchEngine/AbstractConfigurationPanel.php b/lib/Alchemy/Phrasea/SearchEngine/AbstractConfigurationPanel.php index 10b54c187b..d9099e22a6 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/AbstractConfigurationPanel.php +++ b/lib/Alchemy/Phrasea/SearchEngine/AbstractConfigurationPanel.php @@ -20,7 +20,7 @@ abstract class AbstractConfigurationPanel implements ConfigurationPanelInterface */ public function getAvailableDateFields(array $databoxes) { - $date_fields = array(); + $date_fields = []; foreach ($databoxes as $databox) { foreach ($databox->get_meta_structure() as $field) { diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/ConfigurationPanel.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/ConfigurationPanel.php index 2c408ce979..5ae8ede86a 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/ConfigurationPanel.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/ConfigurationPanel.php @@ -42,10 +42,10 @@ class ConfigurationPanel extends AbstractConfigurationPanel { $configuration = $this->getConfiguration(); - $params = array( + $params = [ 'configuration' => $configuration, 'available_sort'=> $this->searchEngine->getAvailableSort(), - ); + ]; return $app['twig']->render('admin/search-engine/phrasea.html.twig', $params); } @@ -56,9 +56,9 @@ class ConfigurationPanel extends AbstractConfigurationPanel public function post(Application $app, Request $request) { $configuration = $this->getConfiguration(); - $configuration['date_fields'] = array(); + $configuration['date_fields'] = []; - foreach ($request->request->get('date_fields', array()) as $field) { + foreach ($request->request->get('date_fields', []) as $field) { $configuration['date_fields'][] = $field; } @@ -75,14 +75,14 @@ class ConfigurationPanel extends AbstractConfigurationPanel */ public function getConfiguration() { - $configuration = isset($this->conf['main']['search-engine']['options']) ? $this->conf['main']['search-engine']['options'] : array(); + $configuration = isset($this->conf['main']['search-engine']['options']) ? $this->conf['main']['search-engine']['options'] : []; if (!is_array($configuration)) { - $configuration = array(); + $configuration = []; } if (!isset($configuration['date_fields'])) { - $configuration['date_fields'] = array(); + $configuration['date_fields'] = []; } if (!isset($configuration['default_sort'])) { diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php index 81ab20947c..a5bcd9c604 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php @@ -32,11 +32,11 @@ class PhraseaEngine implements SearchEngineInterface private $app; private $dateFields; private $configuration; - private $queries = array(); - private $arrayq = array(); - private $colls = array(); - private $qp = array(); - private $needthesaurus = array(); + private $queries = []; + private $arrayq = []; + private $colls = []; + private $qp = []; + private $needthesaurus = []; private $configurationPanel; private $resetCacheNextQuery = false; @@ -63,7 +63,7 @@ class PhraseaEngine implements SearchEngineInterface public function getAvailableDateFields() { if (!$this->dateFields) { - $this->dateFields = array(); + $this->dateFields = []; foreach ($this->app['phraseanet.appbox']->get_databoxes() as $databox) { foreach ($databox->get_meta_structure() as $databox_field) { if ($databox_field->get_type() != \databox_field::TYPE_DATE) { @@ -109,7 +109,7 @@ class PhraseaEngine implements SearchEngineInterface { $date_fields = $this->getAvailableDateFields(); - $sort = array('' => _('No sort')); + $sort = ['' => _('No sort')]; foreach ($date_fields as $field) { $sort[$field] = $field; @@ -133,10 +133,10 @@ class PhraseaEngine implements SearchEngineInterface */ public function getAvailableOrder() { - return array( + return [ 'desc' => _('descendant'), 'asc' => _('ascendant'), - ); + ]; } /** @@ -214,9 +214,9 @@ class PhraseaEngine implements SearchEngineInterface */ public function getStatus() { - $status = array(); + $status = []; foreach (phrasea_info() as $key => $value) { - $status[] = array($key, $value); + $status[] = [$key, $value]; } return $status; @@ -239,7 +239,7 @@ class PhraseaEngine implements SearchEngineInterface */ public function getAvailableTypes() { - return array(self::GEM_TYPE_RECORD, self::GEM_TYPE_STORY); + return [self::GEM_TYPE_RECORD, self::GEM_TYPE_STORY]; } /** @@ -259,17 +259,17 @@ class PhraseaEngine implements SearchEngineInterface $sql = "DELETE FROM prop WHERE record_id = :record_id"; $stmt = $connbas->prepare($sql); - $stmt->execute(array(':record_id' => $record->get_record_id())); + $stmt->execute([':record_id' => $record->get_record_id()]); $stmt->closeCursor(); $sql = "DELETE FROM idx WHERE record_id = :record_id"; $stmt = $connbas->prepare($sql); - $stmt->execute(array(':record_id' => $record->get_record_id())); + $stmt->execute([':record_id' => $record->get_record_id()]); $stmt->closeCursor(); $sql = "DELETE FROM thit WHERE record_id = :record_id"; $stmt = $connbas->prepare($sql); - $stmt->execute(array(':record_id' => $record->get_record_id())); + $stmt->execute([':record_id' => $record->get_record_id()]); $stmt->closeCursor(); unset($stmt, $connbas); @@ -377,7 +377,7 @@ class PhraseaEngine implements SearchEngineInterface $sql = 'SELECT query, query_time, duration, total FROM cache WHERE session_id = :ses_id'; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute(array(':ses_id' => $this->app['session']->get('phrasea_session_id'))); + $stmt->execute([':ses_id' => $this->app['session']->get('phrasea_session_id')]); $row = $stmt->fetch(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -398,7 +398,7 @@ class PhraseaEngine implements SearchEngineInterface $sql = 'SELECT query, query_time, duration, total FROM cache WHERE session_id = :ses_id'; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute(array(':ses_id' => $this->app['session']->get('phrasea_session_id'))); + $stmt->execute([':ses_id' => $this->app['session']->get('phrasea_session_id')]); $row = $stmt->fetch(\PDO::FETCH_ASSOC); $stmt->closeCursor(); } else { @@ -412,7 +412,7 @@ class PhraseaEngine implements SearchEngineInterface $this->app['session']->get('phrasea_session_id'), $offset + 1, $perPage, false ); - $rs = array(); + $rs = []; $error = _('Unable to execute query'); if (isset($res['results']) && is_array($res['results'])) { @@ -450,7 +450,7 @@ class PhraseaEngine implements SearchEngineInterface */ private function getSuggestions($query) { - $suggestions = array(); + $suggestions = []; if ($this->qp && isset($this->qp['main'])) { $suggestions = array_map(function ($value) use ($query) { @@ -512,7 +512,7 @@ class PhraseaEngine implements SearchEngineInterface * * @return PhraseaEngine */ - public static function create(Application $app, array $options = array()) + public static function create(Application $app, array $options = []) { return new static($app); } @@ -542,7 +542,7 @@ class PhraseaEngine implements SearchEngineInterface } foreach ($this->queries as $sbas_id => $qry) { - $BF = array(); + $BF = []; foreach ($this->options->getBusinessFieldsOn() as $collection) { // limit business field query to databox local collection @@ -575,12 +575,12 @@ class PhraseaEngine implements SearchEngineInterface SET query = :query, query_time = NOW(), duration = :duration, total = :total WHERE session_id = :ses_id'; - $params = array( + $params = [ 'query' => $query, ':ses_id' => $this->app['session']->get('phrasea_session_id'), ':duration' => $total_time, ':total' => $nbanswers, - ); + ]; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute($params); @@ -602,7 +602,7 @@ class PhraseaEngine implements SearchEngineInterface */ public function excerpt($query, $fields, \record_adapter $record) { - $ret = array(); + $ret = []; $this->initialize(); $this->checkSession(); @@ -613,22 +613,22 @@ class PhraseaEngine implements SearchEngineInterface ); if (!isset($res['results']) || !is_array($res['results'])) { - return array(); + return []; } $rs = $res['results']; $res = array_shift($rs); if (!isset($res['xml'])) { - return array(); + return []; } $sxe = @simplexml_load_string($res['xml']); foreach ($fields as $name => $field) { if ($sxe && $sxe->description && $sxe->description->$name) { - $val = array(); + $val = []; foreach ($sxe->description->$name as $value) { - $val[] = str_replace(array('[[em]]', '[[/em]]'), array('', ''), (string) $value); + $val[] = str_replace(['[[em]]', '[[/em]]'], ['', ''], (string) $value); } $separator = $field['separator'] ? $field['separator'][0] : ''; $val = implode(' ' . $separator . ' ', $val); @@ -648,7 +648,7 @@ class PhraseaEngine implements SearchEngineInterface public function resetCache() { $this->resetCacheNextQuery = true; - $this->queries = $this->arrayq = $this->colls = $this->qp = $this->needthesaurus = array(); + $this->queries = $this->arrayq = $this->colls = $this->qp = $this->needthesaurus = []; return $this; } @@ -721,7 +721,7 @@ class PhraseaEngine implements SearchEngineInterface foreach ($this->options->getDataboxes() as $databox) { $sbas_id = $databox->get_sbas_id(); - $this->colls[$sbas_id] = array(); + $this->colls[$sbas_id] = []; foreach ($databox->get_collections() as $collection) { if (in_array($collection->get_base_id(), $base_ids)) { @@ -803,7 +803,7 @@ class PhraseaEngine implements SearchEngineInterface $sql = "SELECT session_id FROM cache WHERE lastaccess <= :date"; $stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute(array(':date' => $date->format(DATE_ISO8601))); + $stmt->execute([':date' => $date->format(DATE_ISO8601)]); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php index 24002f2f79..e0f08457e2 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngineQueryParser.php @@ -21,53 +21,53 @@ use Alchemy\Phrasea\Application; */ class PhraseaEngineQueryParser { - public $ops = array( - "et" => array("NODETYPE" => PHRASEA_OP_AND, "CANNUM" => false), - "and" => array("NODETYPE" => PHRASEA_OP_AND, "CANNUM" => false), - "ou" => array("NODETYPE" => PHRASEA_OP_OR, "CANNUM" => false), - "or" => array("NODETYPE" => PHRASEA_OP_OR, "CANNUM" => false), - "sauf" => array("NODETYPE" => PHRASEA_OP_EXCEPT, "CANNUM" => false), - "except" => array("NODETYPE" => PHRASEA_OP_EXCEPT, "CANNUM" => false), - "pres" => array("NODETYPE" => PHRASEA_OP_NEAR, "CANNUM" => true), - "near" => array("NODETYPE" => PHRASEA_OP_NEAR, "CANNUM" => true), - "avant" => array("NODETYPE" => PHRASEA_OP_BEFORE, "CANNUM" => true), - "before" => array("NODETYPE" => PHRASEA_OP_BEFORE, "CANNUM" => true), - "apres" => array("NODETYPE" => PHRASEA_OP_AFTER, "CANNUM" => true), - "after" => array("NODETYPE" => PHRASEA_OP_AFTER, "CANNUM" => true), - "dans" => array("NODETYPE" => PHRASEA_OP_IN, "CANNUM" => false), - "in" => array("NODETYPE" => PHRASEA_OP_IN, "CANNUM" => false) - ); - public $opk = array( - "<" => array("NODETYPE" => PHRASEA_OP_LT, "CANNUM" => false), - ">" => array("NODETYPE" => PHRASEA_OP_GT, "CANNUM" => false), - "<=" => array("NODETYPE" => PHRASEA_OP_LEQT, "CANNUM" => false), - ">=" => array("NODETYPE" => PHRASEA_OP_GEQT, "CANNUM" => false), - "<>" => array("NODETYPE" => PHRASEA_OP_NOTEQU, "CANNUM" => false), - "=" => array("NODETYPE" => PHRASEA_OP_EQUAL, "CANNUM" => false), - ":" => array("NODETYPE" => PHRASEA_OP_COLON, "CANNUM" => false) - ); - public $spw = array( - "all" => array( + public $ops = [ + "et" => ["NODETYPE" => PHRASEA_OP_AND, "CANNUM" => false], + "and" => ["NODETYPE" => PHRASEA_OP_AND, "CANNUM" => false], + "ou" => ["NODETYPE" => PHRASEA_OP_OR, "CANNUM" => false], + "or" => ["NODETYPE" => PHRASEA_OP_OR, "CANNUM" => false], + "sauf" => ["NODETYPE" => PHRASEA_OP_EXCEPT, "CANNUM" => false], + "except" => ["NODETYPE" => PHRASEA_OP_EXCEPT, "CANNUM" => false], + "pres" => ["NODETYPE" => PHRASEA_OP_NEAR, "CANNUM" => true], + "near" => ["NODETYPE" => PHRASEA_OP_NEAR, "CANNUM" => true], + "avant" => ["NODETYPE" => PHRASEA_OP_BEFORE, "CANNUM" => true], + "before" => ["NODETYPE" => PHRASEA_OP_BEFORE, "CANNUM" => true], + "apres" => ["NODETYPE" => PHRASEA_OP_AFTER, "CANNUM" => true], + "after" => ["NODETYPE" => PHRASEA_OP_AFTER, "CANNUM" => true], + "dans" => ["NODETYPE" => PHRASEA_OP_IN, "CANNUM" => false], + "in" => ["NODETYPE" => PHRASEA_OP_IN, "CANNUM" => false] + ]; + public $opk = [ + "<" => ["NODETYPE" => PHRASEA_OP_LT, "CANNUM" => false], + ">" => ["NODETYPE" => PHRASEA_OP_GT, "CANNUM" => false], + "<=" => ["NODETYPE" => PHRASEA_OP_LEQT, "CANNUM" => false], + ">=" => ["NODETYPE" => PHRASEA_OP_GEQT, "CANNUM" => false], + "<>" => ["NODETYPE" => PHRASEA_OP_NOTEQU, "CANNUM" => false], + "=" => ["NODETYPE" => PHRASEA_OP_EQUAL, "CANNUM" => false], + ":" => ["NODETYPE" => PHRASEA_OP_COLON, "CANNUM" => false] + ]; + public $spw = [ + "all" => [ "CLASS" => "PHRASEA_KW_ALL", "NODETYPE" => PHRASEA_KW_ALL, "CANNUM" => false - ), - "last" => array( + ], + "last" => [ "CLASS" => "PHRASEA_KW_LAST", "NODETYPE" => PHRASEA_KW_LAST, "CANNUM" => true - ), + ], // "first" => array("CLASS"=>PHRASEA_KW_FIRST, "CANNUM"=>true), // "premiers" => array("CLASS"=>PHRASEA_KW_FIRST, "CANNUM"=>true), - "tout" => array( + "tout" => [ "CLASS" => "PHRASEA_KW_ALL", "NODETYPE" => PHRASEA_KW_ALL, "CANNUM" => false - ), - "derniers" => array( + ], + "derniers" => [ "CLASS" => "PHRASEA_KW_LAST", "NODETYPE" => PHRASEA_KW_LAST, "CANNUM" => true - ) - ); - public $quoted_defaultop = array( + ] + ]; + public $quoted_defaultop = [ "VALUE" => "default_avant", "NODETYPE" => PHRASEA_OP_BEFORE, "PNUM" => 0 - ); - public $defaultop = array( + ]; + public $defaultop = [ "VALUE" => "and", "NODETYPE" => PHRASEA_OP_AND, "PNUM" => NULL - ); + ]; public $defaultlast = 12; public $phq; public $errmsg = ""; @@ -84,7 +84,7 @@ class PhraseaEngineQueryParser * * @var array */ - public $proposals = Array("QRY" => "", "BASES" => array(), "QUERIES" => array()); + public $proposals = ["QRY" => "", "BASES" => [], "QUERIES" => []]; public $app; /** @@ -121,7 +121,7 @@ class PhraseaEngineQueryParser } } - $this->proposals = Array("QRY" => "", "BASES" => array(), "QUERIES" => array()); + $this->proposals = ["QRY" => "", "BASES" => [], "QUERIES" => []]; $this->phq = $this->mb_trim($phq, 'UTF-8'); if ($this->phq != "") { return($this->maketree(0)); @@ -377,13 +377,13 @@ class PhraseaEngineQueryParser if ($tree["CLASS"] == "OPK" && ($tree["RB"]["CLASS"] == "OPS")) { // on a un truc du genre (a = (5 ou 6)), on le transforme en ((a = 5) ou (a = 6)) - $tmp = array("CLASS" => $tree["CLASS"], + $tmp = ["CLASS" => $tree["CLASS"], "NODETYPE" => $tree["NODETYPE"], "VALUE" => $tree["VALUE"], "PNUM" => $tree["PNUM"], "LB" => $tree["LB"], "RB" => $tree["RB"]["RB"], - "DEPTH" => $tree["LB"]["DEPTH"]); + "DEPTH" => $tree["LB"]["DEPTH"]]; $t = $tree["RB"]; $tree["RB"] = $t["LB"]; $t["LB"] = $tree; @@ -403,7 +403,7 @@ class PhraseaEngineQueryParser } if (($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE") && isset($tree["SREF"]) && isset($tree["SREF"]["TIDS"])) { - $tids = array(); + $tids = []; foreach ($tree["SREF"]["TIDS"] as $tid) { if ($tid["bid"] == $bid) $tids[] = $tid["pid"]; @@ -422,7 +422,7 @@ class PhraseaEngineQueryParser $tree["VALUE"] = array("^" . $val); } */ - $tree["VALUE"] = array(); + $tree["VALUE"] = []; foreach ($tids as $tid) $tree["VALUE"][] = str_replace(".", "d", $tid) . "d%";; } else { @@ -506,26 +506,26 @@ class PhraseaEngineQueryParser } if ($keepFullText) { // on fait un OU entre la recherche ft et une recherche th - $tmp = array("CLASS" => "OPS", + $tmp = ["CLASS" => "OPS", "NODETYPE" => PHRASEA_OP_OR, "VALUE" => "OR", "PNUM" => null, "DEPTH" => $simple["DEPTH"], "LB" => $simple, - "RB" => array("CLASS" => "OPK", + "RB" => ["CLASS" => "OPK", "NODETYPE" => PHRASEA_OP_COLON, "VALUE" => ":", // "CONTEXT"=>$context, "PNUM" => null, "DEPTH" => $simple["DEPTH"] + 1, - "LB" => array("CLASS" => "SIMPLE", + "LB" => ["CLASS" => "SIMPLE", "NODETYPE" => PHRASEA_KEYLIST, - "VALUE" => array("*"), + "VALUE" => ["*"], "DEPTH" => $simple["DEPTH"] + 2 - ), + ], "RB" => $simple - ) - ); + ] + ]; // on vire le contexte du coté fulltext unset($tmp["LB"]["CONTEXT"]); // ajoute le contexte si nécéssaire @@ -542,19 +542,19 @@ class PhraseaEngineQueryParser $tmp["RB"]["RB"]["PATH"] = $path; } else { // on remplace le ft par du th - $tmp = array("CLASS" => "OPK", + $tmp = ["CLASS" => "OPK", "NODETYPE" => PHRASEA_OP_COLON, "VALUE" => ":", // "CONTEXT"=>$context, "PNUM" => null, "DEPTH" => $simple["DEPTH"] + 1, - "LB" => array("CLASS" => "SIMPLE", + "LB" => ["CLASS" => "SIMPLE", "NODETYPE" => PHRASEA_KEYLIST, - "VALUE" => array("*"), + "VALUE" => ["*"], "DEPTH" => $simple["DEPTH"] + 1 - ), + ], "RB" => $simple - ); + ]; // ajoute le contexte si nécéssaire if ($context !== null) $tmp["CONTEXT"] = $context; @@ -577,7 +577,7 @@ class PhraseaEngineQueryParser print("thesaurus2:\n\$tree=" . var_export($tree, true) . "\n"); if ($depth == 0) - $this->proposals["BASES"]["b$bid"] = array("BID" => $bid, "NAME" => $name, "TERMS" => array()); + $this->proposals["BASES"]["b$bid"] = ["BID" => $bid, "NAME" => $name, "TERMS" => []]; if (!$tree) { return(0); @@ -597,14 +597,14 @@ class PhraseaEngineQueryParser public function propAsHTML(&$node, &$html, $path, $depth = 0) { if ($depth > 0) { - $tsy = array(); + $tsy = []; $lngfound = "?"; for ($n = $node->firstChild; $n; $n = $n->nextSibling) { if ($n->nodeName == "sy") { $lng = $n->getAttribute("lng"); if (!array_key_exists($lng, $tsy)) - $tsy[$lng] = array(); - $zsy = array("v" => $n->getAttribute("v"), "w" => $n->getAttribute("w"), "k" => $n->getAttribute("k"), "lng" => $lng); + $tsy[$lng] = []; + $zsy = ["v" => $n->getAttribute("v"), "w" => $n->getAttribute("w"), "k" => $n->getAttribute("k"), "lng" => $lng]; if ($lngfound == "?" || ($lng == $this->lng && $lngfound != $lng)) { $lngfound = $lng; @@ -625,7 +625,7 @@ class PhraseaEngineQueryParser $ksug = $syfound["w"] . '(' . $syfound["k"] . ')'; $vsug = $syfound["w"] . ($syfound["k"] ? (' (' . $syfound["k"] . ')'):''); - $this->proposals['QUERIES'][$ksug] = array('value'=>$vsug, 'current'=>$node->getAttribute("marked")=="2", 'hits'=>null, 'lng'=>$syfound['lng']); + $this->proposals['QUERIES'][$ksug] = ['value'=>$vsug, 'current'=>$node->getAttribute("marked")=="2", 'hits'=>null, 'lng'=>$syfound['lng']]; $thtml = $syfound["v"]; $kjs = $syfound["k"] ? ("'" . \p4string::MakeString($syfound["k"], "js") . "'") : "null"; @@ -641,7 +641,7 @@ class PhraseaEngineQueryParser $html .= $tab . "\t" . $thtml . "\n"; } - $tsort = array(); + $tsort = []; for ($n = $node->firstChild; $n; $n = $n->nextSibling) { if ($n->nodeType == XML_ELEMENT_NODE && $n->getAttribute("marked")) { // only 'te' marked $lngfound = '?'; @@ -748,7 +748,7 @@ class PhraseaEngineQueryParser $nodes = $dxp->query($x); if (!isset($tree["RB"]["SREF"]["TIDS"])) - $tree["RB"]["SREF"]["TIDS"] = array(); + $tree["RB"]["SREF"]["TIDS"] = []; if ($nodes->length >= 1) { if ($nodes->length == 1) { // on cherche un id simple, on utilisera la syntaxe sql 'like' (l'extension repérera elle méme la syntaxe car la value finira par '%') @@ -821,16 +821,16 @@ class PhraseaEngineQueryParser } } if (!$found) - $extendednode["SREF"]["TIDS"][] = array("bid" => $bid, "pid" => $pid, "id" => $id, "w" => $w, "k" => $k, "lng" => $lng, "p" => $p); + $extendednode["SREF"]["TIDS"][] = ["bid" => $bid, "pid" => $pid, "id" => $id, "w" => $w, "k" => $k, "lng" => $lng, "p" => $p]; // on liste les propositions de thésaurus pour ce node (dans l'arbre simple) if (!isset($this->proposals["BASES"]["b$bid"]["TERMS"][$path])) { - // $this->proposals["TERMS"][$path] = array("TERM"=>implode(" ", $extendednode["VALUE"]), "PROPOSALS"=>array()); + // $this->proposals["TERMS"][$path] = array("TERM"=>implode(" ", $extendednode["VALUE"]), "PROPOSALS"=>[]); $term = implode(" ", $extendednode["VALUE"]); if (isset($extendednode["CONTEXT"]) && $extendednode["CONTEXT"]) { $term .= " (" . $extendednode["CONTEXT"] . ")"; } - $this->proposals["BASES"]["b$bid"]["TERMS"][$path] = array("TERM" => $term); // , "PROPOSALS"=>array() ); //, "PROPOSALS_TREE"=>new DOMDocument("1.0", "UTF-8")); + $this->proposals["BASES"]["b$bid"]["TERMS"][$path] = ["TERM" => $term]; // , "PROPOSALS"=>[] ); //, "PROPOSALS_TREE"=>new DOMDocument("1.0", "UTF-8")); } // printf("<%s id='%s'>'));
+ $terms = str_replace(["\r\n", "\n", "\r"], ['', '', ''], strip_tags($terms, '
';
- $ret = array(
+ $ret = [
'text' => sprintf(
_('Rappel : Il vous reste %1$d jours pour valider %2$s de %3$s'), $this->app['phraseanet.registry']->get('GV_validation_reminder'), $bask_link, $sender
)
, 'class' => ($unread == 1 ? 'reload_baskets' : '')
- );
+ ];
return $ret;
}
diff --git a/lib/classes/eventsmanager/notifyAbstract.php b/lib/classes/eventsmanager/notifyAbstract.php
index 2a7bb3372d..b57a6411f4 100644
--- a/lib/classes/eventsmanager/notifyAbstract.php
+++ b/lib/classes/eventsmanager/notifyAbstract.php
@@ -2,7 +2,7 @@
abstract class eventsmanager_notifyAbstract extends eventsmanager_eventAbstract
{
- protected $events = array('__EVENT__');
+ protected $events = ['__EVENT__'];
public function fire($event, $params, &$object)
{
diff --git a/lib/classes/format.php b/lib/classes/format.php
index d368c9a5bd..0a0cc0ccdd 100644
--- a/lib/classes/format.php
+++ b/lib/classes/format.php
@@ -5,8 +5,8 @@ class format
public static function arr_to_csv_line($arr, $tri_column = false)
{
- $line = array();
- $tmp = array();
+ $line = [];
+ $tmp = [];
foreach ($arr as $v) {
if (is_array($v)) {
$line[] = self::arr_to_csv_line($v);
@@ -40,7 +40,7 @@ class format
public static function arr_to_csv($arr, $tri_column = false)
{
- $lines = array();
+ $lines = [];
if ($tri_column) {
$title = "";
@@ -60,7 +60,7 @@ class format
public static function csv_to_arr($filename)
{
$separateur = ",";
- $array = array();
+ $array = [];
// For mac
$autoDetectLineEndings = ini_get("auto_detect_line_endings");
diff --git a/lib/classes/ftpclient.php b/lib/classes/ftpclient.php
index 3c0102039a..81f739b019 100644
--- a/lib/classes/ftpclient.php
+++ b/lib/classes/ftpclient.php
@@ -5,7 +5,7 @@ class ftpclient
protected $connexion;
protected $proxy;
protected $host;
- protected $cached_dirs = array();
+ protected $cached_dirs = [];
protected $debug = false;
public function __construct($host, $port = 21, $timeout = 90, $ssl = false, $proxy = false, $proxyport = false)
@@ -365,7 +365,7 @@ class ftpclient
$current_dir = $this->pwd();
$contents = ftp_rawlist($this->connexion, $current_dir, ! ! $recursive);
- $list = array();
+ $list = [];
foreach ($contents as $content) {
if ($content == '')
@@ -388,9 +388,9 @@ class ftpclient
$date = strtotime($info[6] . ' ' . $info[5] . ' ' . date('Y') . ' ' . $info[7]);
}
- $list[$file] = array(
+ $list[$file] = [
'date' => $date
- );
+ ];
}
return $list;
diff --git a/lib/classes/media/Permalink/Adapter.php b/lib/classes/media/Permalink/Adapter.php
index f5e5936bf9..c07a0aca88 100644
--- a/lib/classes/media/Permalink/Adapter.php
+++ b/lib/classes/media/Permalink/Adapter.php
@@ -148,13 +148,13 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea
{
$label = $this->get_label() . '.' . pathinfo($this->media_subdef->get_file(), PATHINFO_EXTENSION);
- return $this->app->url('permalinks_permalink', array(
+ return $this->app->url('permalinks_permalink', [
'sbas_id' => $this->media_subdef->get_sbas_id(),
'record_id' => $this->media_subdef->get_record_id(),
'subdef' => $this->media_subdef->get_name(),
'label' => $label,
'token' => $this->get_token(),
- ));
+ ]);
}
/**
@@ -163,12 +163,12 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea
*/
public function get_page()
{
- return $this->app->url('permalinks_permaview', array(
+ return $this->app->url('permalinks_permaview', [
'sbas_id' => $this->media_subdef->get_sbas_id(),
'record_id' => $this->media_subdef->get_record_id(),
'subdef' => $this->media_subdef->get_name(),
'token' => $this->get_token(),
- ));
+ ]);
}
/**
@@ -183,7 +183,7 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea
$sql = 'UPDATE permalinks SET token = :token, last_modified = NOW()
WHERE id = :id';
$stmt = $this->databox->get_connection()->prepare($sql);
- $stmt->execute(array(':token' => $this->token, ':id' => $this->get_id()));
+ $stmt->execute([':token' => $this->token, ':id' => $this->get_id()]);
$stmt->closeCursor();
$this->delete_data_from_cache();
@@ -204,10 +204,10 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea
WHERE id = :id';
$stmt = $this->databox->get_connection()->prepare($sql);
- $params = array(
+ $params = [
':activated' => $this->is_activated,
':id' => $this->get_id()
- );
+ ];
$stmt->execute($params);
$stmt->closeCursor();
@@ -235,7 +235,7 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea
$sql = 'UPDATE permalinks SET label = :label, last_modified = NOW()
WHERE id = :id';
$stmt = $this->databox->get_connection()->prepare($sql);
- $stmt->execute(array(':label' => $this->label, ':id' => $this->get_id()));
+ $stmt->execute([':label' => $this->label, ':id' => $this->get_id()]);
$stmt->closeCursor();
$this->delete_data_from_cache();
@@ -268,7 +268,7 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea
FROM permalinks p
WHERE p.subdef_id = :subdef_id';
$stmt = $this->databox->get_connection()->prepare($sql);
- $stmt->execute(array(':subdef_id' => $this->media_subdef->get_subdef_id()));
+ $stmt->execute([':subdef_id' => $this->media_subdef->get_subdef_id()]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -282,14 +282,14 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea
$this->last_modified = new DateTime($row['last_modified']);
$this->label = $row['label'];
- $datas = array(
+ $datas = [
'id' => $this->id
, 'token' => $this->token
, 'is_activated' => $this->is_activated
, 'created_on' => $this->created_on
, 'last_modified' => $this->last_modified
, 'label' => $this->label
- );
+ ];
$this->set_data_to_cache($datas);
@@ -327,11 +327,11 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea
(id, subdef_id, token, activated, created_on, last_modified, label)
VALUES (null, :subdef_id, :token, :activated, NOW(), NOW(), "")';
- $params = array(
+ $params = [
':subdef_id' => $media_subdef->get_subdef_id()
, ':token' => random::generatePassword(8, random::LETTERS_AND_NUMBERS)
, ':activated' => '1'
- );
+ ];
$error = null;
$stmt = $databox->get_connection()->prepare($sql);
@@ -371,11 +371,11 @@ class media_Permalink_Adapter implements media_Permalink_Interface, cache_cachea
AND activated = "1"
AND token = :token';
- $params = array(
+ $params = [
':record_id' => $record_id
, ':token' => $token
, ':name' => $name
- );
+ ];
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute($params);
diff --git a/lib/classes/media/subdef.php b/lib/classes/media/subdef.php
index e660a61572..c7598a6c50 100644
--- a/lib/classes/media/subdef.php
+++ b/lib/classes/media/subdef.php
@@ -190,10 +190,10 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
FROM subdef
WHERE name = :name AND record_id = :record_id';
- $params = array(
+ $params = [
':record_id' => $this->record->get_record_id(),
':name' => $this->name
- );
+ ];
$stmt = $connbas->prepare($sql);
$stmt->execute($params);
@@ -225,7 +225,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$this->find_substitute_file();
}
- $datas = array(
+ $datas = [
'mime' => $this->mime
, 'width' => $this->width
, 'height' => $this->height
@@ -238,7 +238,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
, 'subdef_id' => $this->subdef_id
, 'modification_date' => $this->modification_date
, 'creation_date' => $this->creation_date
- );
+ ];
$this->set_data_to_cache($datas);
@@ -358,7 +358,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$sql = "UPDATE subdef SET etag = :etag WHERE subdef_id = :subdef_id";
$stmt = $this->record->get_databox()->get_connection()->prepare($sql);
- $stmt->execute(array(':subdef_id' => $this->subdef_id, ':etag' => $etag));
+ $stmt->execute([':subdef_id' => $this->subdef_id, ':etag' => $etag]);
$stmt->closeCursor();
return $this;
@@ -531,7 +531,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
public function getDevices()
{
if ($this->get_name() == 'document') {
- return array(\databox_subdef::DEVICE_ALL);
+ return [\databox_subdef::DEVICE_ALL];
}
try {
@@ -541,7 +541,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
->get_subdef($this->record->get_type(), $this->get_name())
->getDevices();
} catch (\Exception_Databox_SubdefNotFound $e) {
- return array();
+ return [];
}
}
@@ -574,12 +574,12 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
SET height = :height , width = :width, updated_on = NOW()
WHERE record_id = :record_id AND name = :name";
- $params = array(
+ $params = [
':width' => $media->getWidth(),
':height' => $media->getHeight(),
':record_id' => $this->get_record_id(),
':name' => $this->get_name(),
- );
+ ];
$stmt = $this->record->get_databox()->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -604,14 +604,14 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
public function readTechnicalDatas(MediaVorus $mediavorus)
{
if ( ! $this->is_physically_present()) {
- return array();
+ return [];
}
$media = $mediavorus->guess($this->get_pathfile());
- $datas = array();
+ $datas = [];
- $methods = array(
+ $methods = [
self::TC_DATA_WIDTH => 'getWidth',
self::TC_DATA_HEIGHT => 'getHeight',
self::TC_DATA_FOCALLENGTH => 'getFocalLength',
@@ -630,11 +630,11 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
self::TC_DATA_AUDIOSAMPLERATE => 'getAudioSampleRate',
self::TC_DATA_VIDEOCODEC => 'getVideoCodec',
self::TC_DATA_AUDIOCODEC => 'getAudioCodec',
- );
+ ];
foreach ($methods as $tc_name => $method) {
if (method_exists($media, $method)) {
- $result = call_user_func(array($media, $method));
+ $result = call_user_func([$media, $method]);
if (null !== $result) {
$datas[$tc_name] = $result;
@@ -660,7 +660,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$path = $media->getFile()->getPath();
$newname = $media->getFile()->getFilename();
- $params = array(
+ $params = [
':path' => $path,
':file' => $newname,
':width' => 0,
@@ -668,7 +668,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
':mime' => $media->getFile()->getMimeType(),
':size' => $media->getFile()->getSize(),
':dispatched' => 1,
- );
+ ];
if (method_exists($media, 'getWidth') && null !== $media->getWidth()) {
$params[':width'] = $media->getWidth();
@@ -682,10 +682,10 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$sql = 'SELECT subdef_id FROM subdef
WHERE record_id = :record_id AND name = :name';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(
+ $stmt->execute([
':record_id' => $record->get_record_id(),
':name' => $name,
- ));
+ ]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -738,7 +738,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
return;
}
- if (in_array($this->mime, array('video/mp4'))) {
+ if (in_array($this->mime, ['video/mp4'])) {
$token = p4file::apache_tokenize($this->app['phraseanet.registry'], $this->get_pathfile());
if ($token) {
$this->url = $token;
diff --git a/lib/classes/module/console/checkExtension.php b/lib/classes/module/console/checkExtension.php
index ff4b9dee89..0ff803ad82 100644
--- a/lib/classes/module/console/checkExtension.php
+++ b/lib/classes/module/console/checkExtension.php
@@ -134,16 +134,16 @@ class module_console_checkExtension extends Command
return 1;
}
- $tbases = array();
+ $tbases = [];
foreach ($phSession["bases"] as $phbase) {
- $tcoll = array();
+ $tcoll = [];
foreach ($phbase["collections"] as $coll) {
$tcoll[] = 0 + $coll["base_id"];
}
if (sizeof($tcoll) > 0) {
$kbase = "S" . $phbase["sbas_id"];
- $tbases[$kbase] = array();
+ $tbases[$kbase] = [];
$tbases[$kbase]["sbas_id"] = $phbase["sbas_id"];
$tbases[$kbase]["searchcoll"] = $tcoll;
$tbases[$kbase]["mask_xor"] = $tbases[$kbase]["mask_and"] = 0;
@@ -172,7 +172,7 @@ class module_console_checkExtension extends Command
, false
, PHRASEA_MULTIDOC_DOCONLY
, ''
- , array()
+ , []
);
if ($ret) {
@@ -206,10 +206,10 @@ class module_console_checkExtension extends Command
// prepare the test before closing session
if (function_exists("phrasea_public_query")) {
// fill an array for each sbas to query
- $tbases = array();
+ $tbases = [];
foreach ($phSession["bases"] as $phbase) {
// fill an array of collections to query for this sbas
- $tcoll = array();
+ $tcoll = [];
foreach ($phbase["collections"] as $coll) {
$tcoll[] = 0 + $coll["base_id"];
}
@@ -220,11 +220,11 @@ class module_console_checkExtension extends Command
$treeq = $qp->parsequery($input->getOption('query'));
$arrayq = $qp->makequery($treeq);
- $tbases["S".$phbase["sbas_id"]] = array( // key does no matter
+ $tbases["S".$phbase["sbas_id"]] = [ // key does no matter
"sbas_id" => $phbase["sbas_id"], // sbas_id
"searchcoll" => $tcoll, // colls to query
"arrayq" => $arrayq // parsed query
- );
+ ];
}
}
}
@@ -249,7 +249,7 @@ class module_console_checkExtension extends Command
$tbases // array of sbas with colls and query
, PHRASEA_MULTIDOC_DOCONLY // mode
, '' // sortfield
- , array() // search business fields
+ , [] // search business fields
, '' // lng for stemmed search
, 0 // offset for first answer (start=0)
, 5 // nbr of answers
diff --git a/lib/classes/module/console/fieldsMerge.php b/lib/classes/module/console/fieldsMerge.php
index ae750629ea..5296cdf672 100644
--- a/lib/classes/module/console/fieldsMerge.php
+++ b/lib/classes/module/console/fieldsMerge.php
@@ -57,7 +57,7 @@ class module_console_fieldsMerge extends Command
return 1;
}
- $sources = array();
+ $sources = [];
foreach ($input->getArgument('source') as $source_id) {
$sources[] = $databox->get_meta_structure()->get_element($source_id);
@@ -71,7 +71,7 @@ class module_console_fieldsMerge extends Command
$destination = $databox->get_meta_structure()->get_element($input->getArgument('destination'));
- $types = $multis = array();
+ $types = $multis = [];
foreach ($sources as $source) {
array_push($types, $source->get_type());
@@ -97,7 +97,7 @@ class module_console_fieldsMerge extends Command
);
}
- $field_names = array();
+ $field_names = [];
foreach ($sources as $source) {
$field_names[] = $source->get_name();
@@ -172,7 +172,7 @@ class module_console_fieldsMerge extends Command
foreach ($results as $row) {
$record = $databox->get_record($row['record_id']);
- $datas = array();
+ $datas = [];
foreach ($sources as $source) {
try {
@@ -195,11 +195,11 @@ class module_console_fieldsMerge extends Command
}
foreach ((array) $datas as $data) {
- $record->set_metadatas(array(array(
+ $record->set_metadatas([[
'meta_struct_id' => $destination->get_id(),
'meta_id' => null,
'value' => $data,
- )), true);
+ ]], true);
}
$this->getService('phraseanet.SE')->updateRecord($record);
diff --git a/lib/classes/module/console/fieldsRename.php b/lib/classes/module/console/fieldsRename.php
index b1414f3e7a..e2b8159959 100644
--- a/lib/classes/module/console/fieldsRename.php
+++ b/lib/classes/module/console/fieldsRename.php
@@ -102,7 +102,7 @@ class module_console_fieldsRename extends Command
foreach ($results as $row) {
$record = $databox->get_record($row['record_id']);
- $record->set_metadatas(array());
+ $record->set_metadatas([]);
unset($record);
}
diff --git a/lib/classes/module/console/sphinxGenerateSuggestion.php b/lib/classes/module/console/sphinxGenerateSuggestion.php
index a68f5c2b75..b9a4fad4f6 100644
--- a/lib/classes/module/console/sphinxGenerateSuggestion.php
+++ b/lib/classes/module/console/sphinxGenerateSuggestion.php
@@ -43,7 +43,7 @@ class module_console_sphinxGenerateSuggestion extends Command
foreach ($params as $sbas_id => $p) {
$index = sprintf("%u", crc32(
str_replace(
- array('.', '%')
+ ['.', '%']
, '_'
, sprintf('%s_%s_%s_%s', $p['host'], $p['port'], $p['user'], $p['dbname'])
)
@@ -61,7 +61,7 @@ class module_console_sphinxGenerateSuggestion extends Command
return 1;
}
- $builder = ProcessBuilder::create(array('/usr/local/bin/indexer'));
+ $builder = ProcessBuilder::create(['/usr/local/bin/indexer']);
$builder->add('metadatas' . $index)
->add('--buildstops')
->add($tmp_file)
diff --git a/lib/classes/module/console/systemClearCache.php b/lib/classes/module/console/systemClearCache.php
index 9f350f7188..7cb8489bf1 100644
--- a/lib/classes/module/console/systemClearCache.php
+++ b/lib/classes/module/console/systemClearCache.php
@@ -39,13 +39,13 @@ class module_console_systemClearCache extends Command
$finder
->exclude('.git')
->exclude('.svn')
- ->in(array(
+ ->in([
$this->container['root.path'] . '/tmp/cache_minify/',
$this->container['root.path'] . '/tmp/cache_twig/',
$this->container['root.path'] . '/tmp/cache/profiler/',
$this->container['root.path'] . '/tmp/doctrine/',
$this->container['root.path'] . '/tmp/serializer/',
- ));
+ ]);
$filesystem = new Filesystem();
diff --git a/lib/classes/module/console/systemExport.php b/lib/classes/module/console/systemExport.php
index 2c2dfceb27..95873dda68 100644
--- a/lib/classes/module/console/systemExport.php
+++ b/lib/classes/module/console/systemExport.php
@@ -39,7 +39,7 @@ class module_console_systemExport extends Command
* To implement
*/
// $this->addOption('excludefield', 'f', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY
-// , 'Exclude field from XML', array());
+// , 'Exclude field from XML', []);
/**
* To implement
@@ -57,10 +57,10 @@ class module_console_systemExport extends Command
, 'Limit files quantity (for test purposes)', false);
$this->addOption('base_id', 'b', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY
- , 'Restrict on base_ids', array());
+ , 'Restrict on base_ids', []);
$this->addOption('sbas_id', 's', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY
- , 'Restrict on sbas_ids', array());
+ , 'Restrict on sbas_ids', []);
$this->addArgument('directory', InputOption::VALUE_REQUIRED
, 'The directory where to export');
@@ -134,7 +134,7 @@ class module_console_systemExport extends Command
}
$go = true;
- $coll_ids = array();
+ $coll_ids = [];
if (count($restrictBaseIds) > 0) {
$go = false;
@@ -187,7 +187,7 @@ class module_console_systemExport extends Command
$record = $databox->get_record($row['record_id']);
if (($done % $docPerDir) === 0) {
$dir_increment ++;
- $in_dir_files = array();
+ $in_dir_files = [];
$current_dir = $local_export . sprintf($dir_format, $dir_increment) . '/';
$this->getService('filesystem')->mkdir($current_dir);
}
diff --git a/lib/classes/module/console/systemMailCheck.php b/lib/classes/module/console/systemMailCheck.php
index 17940fddd6..3059308c20 100644
--- a/lib/classes/module/console/systemMailCheck.php
+++ b/lib/classes/module/console/systemMailCheck.php
@@ -42,7 +42,7 @@ class module_console_systemMailCheck extends Command
{
$output->writeln("Processing...");
- $bad_users = array();
+ $bad_users = [];
if (version_compare($this->getService('phraseanet.appbox')->get_version(), '3.9', '<')) {
$bad_users = MailChecker::getWrongEmailUsers($this->container);
}
@@ -76,7 +76,7 @@ class module_console_systemMailCheck extends Command
. 'continue (C), detach from mail (d), or stop (s)';
$continue = mb_strtolower($dialog->ask($output, $question, 'C'));
- } while ( ! in_array($continue, array('c', 'd', 's')));
+ } while ( ! in_array($continue, ['c', 'd', 's']));
if ($continue == 's') {
return false;
diff --git a/lib/classes/module/console/systemTemplateGenerator.php b/lib/classes/module/console/systemTemplateGenerator.php
index 428ed7c68d..fc5f5a0f1b 100644
--- a/lib/classes/module/console/systemTemplateGenerator.php
+++ b/lib/classes/module/console/systemTemplateGenerator.php
@@ -35,10 +35,10 @@ class module_console_systemTemplateGenerator extends Command
protected function doExecute(InputInterface $input, OutputInterface $output)
{
- $tplDirs = array(
+ $tplDirs = [
realpath(__DIR__ . '/../../../../templates/web/'),
realpath(__DIR__ . '/../../../../templates/mobile/')
- );
+ ];
$n_ok = $n_error = 0;
@@ -48,9 +48,9 @@ class module_console_systemTemplateGenerator extends Command
$this->container['twig'];
foreach ($tplDirs as $tplDir) {
- $this->container['twig.loader.filesystem']->setPaths(array($tplDir));
+ $this->container['twig.loader.filesystem']->setPaths([$tplDir]);
$finder = new Finder();
- foreach ($finder->files()->in(array($tplDir)) as $file) {
+ foreach ($finder->files()->in([$tplDir]) as $file) {
try {
$this->container['twig']->loadTemplate(str_replace($tplDir, '', $file->getPathname()));
$output->writeln('' . $file . '');
diff --git a/lib/classes/module/console/systemUpgrade.php b/lib/classes/module/console/systemUpgrade.php
index 960d22f7b5..d4ba3a18df 100644
--- a/lib/classes/module/console/systemUpgrade.php
+++ b/lib/classes/module/console/systemUpgrade.php
@@ -58,7 +58,7 @@ class module_console_systemUpgrade extends Command
do {
$continue = mb_strtolower($dialog->ask($output, ''));
$sql = 'UPDATE pref SET value = :terms ';
if ($reset_date)
@@ -1412,7 +1412,7 @@ class databox extends base
$sql .= ' WHERE prop="ToU" AND locale = :locale';
$stmt = $this->get_connection()->prepare($sql);
- $stmt->execute(array(':terms' => $terms, ':locale' => $locale));
+ $stmt->execute([':terms' => $terms, ':locale' => $locale]);
$stmt->closeCursor();
$this->cgus = null;
$this->delete_data_from_cache(self::CACHE_CGUS);
@@ -1424,10 +1424,10 @@ class databox extends base
{
$this->_sxml_structure = $this->_dom_structure = $this->_xpath_structure = null;
- $vars = array();
+ $vars = [];
foreach ($this as $key => $value) {
- if (in_array($key, array('app', 'meta_struct'))) {
+ if (in_array($key, ['app', 'meta_struct'])) {
continue;
}
diff --git a/lib/classes/databox/cgu.php b/lib/classes/databox/cgu.php
index d0fb21176e..da271f76f9 100644
--- a/lib/classes/databox/cgu.php
+++ b/lib/classes/databox/cgu.php
@@ -49,7 +49,7 @@ class databox_cgu
private static function getUnvalidated(Application $app, $home = false)
{
- $terms = array();
+ $terms = [];
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
try {
@@ -71,7 +71,7 @@ class databox_cgu
}
if ($userValidation)
- $terms[$name] = array('sbas_id' => $databox->get_sbas_id(), 'terms' => $value, 'date' => $update);
+ $terms[$name] = ['sbas_id' => $databox->get_sbas_id(), 'terms' => $value, 'date' => $update];
} catch (Exception $e) {
}
diff --git a/lib/classes/databox/descriptionStructure.php b/lib/classes/databox/descriptionStructure.php
index 2b7e4f41b6..e28f60ece3 100644
--- a/lib/classes/databox/descriptionStructure.php
+++ b/lib/classes/databox/descriptionStructure.php
@@ -20,14 +20,14 @@ class databox_descriptionStructure implements IteratorAggregate, Countable
*
* @var Array
*/
- protected $elements = array();
+ protected $elements = [];
/**
* Cache array for the get element by name function
*
* @var Array
*/
- protected $cache_name_id = array();
+ protected $cache_name_id = [];
/**
*
diff --git a/lib/classes/databox/field.php b/lib/classes/databox/field.php
index 6fe166d92b..55fd60fd26 100644
--- a/lib/classes/databox/field.php
+++ b/lib/classes/databox/field.php
@@ -116,7 +116,7 @@ class databox_field implements cache_cacheableInterface
*
* @var array
*/
- protected $labels = array();
+ protected $labels = [];
/**
*
@@ -138,7 +138,7 @@ class databox_field implements cache_cacheableInterface
* @var int
*/
protected $sbas_id;
- protected static $_instance = array();
+ protected static $_instance = [];
protected $dces_element;
protected $Vocabulary;
protected $VocabularyType;
@@ -192,7 +192,7 @@ class databox_field implements cache_cacheableInterface
FROM metadatas_structure WHERE id=:id";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':id' => $id));
+ $stmt->execute([':id' => $id]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -209,7 +209,7 @@ class databox_field implements cache_cacheableInterface
$this->on_error = true;
}
- foreach (array('en', 'fr', 'de', 'nl') as $code) {
+ foreach (['en', 'fr', 'de', 'nl'] as $code) {
$this->labels[$code] = $row['label_' . $code];
}
@@ -338,7 +338,7 @@ class databox_field implements cache_cacheableInterface
$connbas = $this->get_connection();
$sql = 'DELETE FROM metadatas_structure WHERE id = :id';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':id' => $this->get_id()));
+ $stmt->execute([':id' => $this->get_id()]);
$stmt->closeCursor();
$dom_struct = $this->databox->get_dom_structure();
@@ -389,7 +389,7 @@ class databox_field implements cache_cacheableInterface
`label_nl` = :label_nl
WHERE id = :id';
- $params = array(
+ $params = [
':name' => $this->name,
':source' => $this->tag->getTagname(),
':indexable' => $this->indexable ? '1' : '0',
@@ -410,7 +410,7 @@ class databox_field implements cache_cacheableInterface
':label_fr' => isset($this->labels['fr']) ? $this->labels['fr'] : null,
':label_de' => isset($this->labels['de']) ? $this->labels['de'] : null,
':label_nl' => isset($this->labels['nl']) ? $this->labels['nl'] : null
- );
+ ];
$stmt = $connbas->prepare($sql);
$stmt->execute($params);
@@ -611,9 +611,9 @@ class databox_field implements cache_cacheableInterface
SET dces_element = null WHERE dces_element = :dces_element';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(
+ $stmt->execute([
':dces_element' => $DCES_element->get_label()
- ));
+ ]);
$stmt->closeCursor();
}
@@ -621,10 +621,10 @@ class databox_field implements cache_cacheableInterface
SET dces_element = :dces_element WHERE id = :id';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(
+ $stmt->execute([
':dces_element' => $DCES_element ? $DCES_element->get_label() : null
, ':id' => $this->id
- ));
+ ]);
$stmt->closeCursor();
$this->dces_element = $DCES_element;
@@ -925,7 +925,7 @@ class databox_field implements cache_cacheableInterface
public function toArray()
{
- return array(
+ return [
'id' => $this->id,
'sbas-id' => $this->sbas_id,
'labels' => $this->labels,
@@ -945,7 +945,7 @@ class databox_field implements cache_cacheableInterface
'dces-element' => $this->dces_element ? $this->dces_element->get_label() : null,
'vocabulary-type' => $this->Vocabulary ? $this->Vocabulary->getType() : null,
'vocabulary-restricted' => $this->VocabularyRestriction,
- );
+ ];
}
/**
@@ -990,7 +990,7 @@ class databox_field implements cache_cacheableInterface
$multi = $multi ? 1 : 0;
$stmt = $databox->get_connection()->prepare($sql);
- $stmt->execute(array(':name' => $name, ':sorter' => $sorter, ':multi' => $multi));
+ $stmt->execute([':name' => $name, ':sorter' => $sorter, ':multi' => $multi]);
$id = $databox->get_connection()->lastInsertId();
$stmt->closeCursor();
@@ -1014,9 +1014,9 @@ class databox_field implements cache_cacheableInterface
*/
public function __sleep()
{
- $vars = array();
+ $vars = [];
foreach ($this as $key => $value) {
- if (in_array($key, array('databox', 'app', 'Vocabulary')))
+ if (in_array($key, ['databox', 'app', 'Vocabulary']))
continue;
$vars[] = $key;
}
diff --git a/lib/classes/databox/status.php b/lib/classes/databox/status.php
index 06656df722..eb037a7c2d 100644
--- a/lib/classes/databox/status.php
+++ b/lib/classes/databox/status.php
@@ -26,7 +26,7 @@ class databox_status
*
* @var Array
*/
- private static $_status = array();
+ private static $_status = [];
/**
*
@@ -38,7 +38,7 @@ class databox_status
*
* @var Array
*/
- private $status = array();
+ private $status = [];
/**
*
@@ -59,7 +59,7 @@ class databox_status
*/
private function __construct(Application $app, $sbas_id)
{
- $this->status = array();
+ $this->status = [];
$path = $url = false;
@@ -138,7 +138,7 @@ class databox_status
$sbas_ids = $app['acl']->get($app['authentication']->getUser())->get_granted_sbas();
- $statuses = array();
+ $statuses = [];
foreach ($sbas_ids as $databox) {
try {
@@ -155,11 +155,11 @@ class databox_status
public static function getSearchStatus(Application $app)
{
- $statuses = array();
+ $statuses = [];
$sbas_ids = $app['acl']->get($app['authentication']->getUser())->get_granted_sbas();
- $see_all = array();
+ $see_all = [];
foreach ($sbas_ids as $databox) {
$see_all[$databox->get_sbas_id()] = false;
@@ -177,7 +177,7 @@ class databox_status
}
}
- $stats = array();
+ $stats = [];
foreach ($statuses as $sbas_id => $status) {
@@ -202,31 +202,31 @@ class databox_status
}
}
if (! $set) {
- $stats[$bit][] = array(
- 'sbas' => array($sbas_id),
+ $stats[$bit][] = [
+ 'sbas' => [$sbas_id],
'labeloff' => $props['labeloff'],
'labelon' => $props['labelon'],
'labels_on_i18n' => $props['labels_on_i18n'],
'labels_off_i18n' => $props['labels_off_i18n'],
'imgoff' => $props['img_off'],
'imgon' => $props['img_on']
- );
+ ];
$set = true;
}
}
if (! $set) {
- $stats[$bit] = array(
- array(
- 'sbas' => array($sbas_id),
+ $stats[$bit] = [
+ [
+ 'sbas' => [$sbas_id],
'labeloff' => $props['labeloff'],
'labelon' => $props['labelon'],
'labels_on_i18n' => $props['labels_on_i18n'],
'labels_off_i18n' => $props['labels_off_i18n'],
'imgoff' => $props['img_off'],
'imgon' => $props['img_on']
- )
- );
+ ]
+ ];
}
}
}
@@ -387,7 +387,7 @@ class databox_status
{
$status = self::getStatus($app, $sbas_id);
- $switch = in_array($switch, array('on', 'off')) ? $switch : false;
+ $switch = in_array($switch, ['on', 'off']) ? $switch : false;
if (! $switch) {
return false;
@@ -407,7 +407,7 @@ class databox_status
public static function updateIcon(Application $app, $sbas_id, $bit, $switch, UploadedFile $file)
{
- $switch = in_array($switch, array('on', 'off')) ? $switch : false;
+ $switch = in_array($switch, ['on', 'off']) ? $switch : false;
if (! $switch) {
throw new Exception_InvalidArgument();
diff --git a/lib/classes/databox/subdef.php b/lib/classes/databox/subdef.php
index 218e104079..652e363f3e 100644
--- a/lib/classes/databox/subdef.php
+++ b/lib/classes/databox/subdef.php
@@ -31,20 +31,20 @@ class databox_subdef
* @var string
*/
protected $class;
- protected $devices = array();
+ protected $devices = [];
protected $name;
protected $path;
protected $subdef_group;
- protected $labels = array();
+ protected $labels = [];
protected $write_meta;
protected $downloadable;
- protected static $mediaTypeToSubdefTypes = array(
- SubdefType::TYPE_AUDIO => array(SubdefSpecs::TYPE_IMAGE, SubdefSpecs::TYPE_AUDIO),
- SubdefType::TYPE_DOCUMENT => array(SubdefSpecs::TYPE_IMAGE, SubdefSpecs::TYPE_FLEXPAPER),
- SubdefType::TYPE_FLASH => array(SubdefSpecs::TYPE_IMAGE),
- SubdefType::TYPE_IMAGE => array(SubdefSpecs::TYPE_IMAGE),
- SubdefType::TYPE_VIDEO => array(SubdefSpecs::TYPE_IMAGE, SubdefSpecs::TYPE_VIDEO, SubdefSpecs::TYPE_ANIMATION),
- );
+ protected static $mediaTypeToSubdefTypes = [
+ SubdefType::TYPE_AUDIO => [SubdefSpecs::TYPE_IMAGE, SubdefSpecs::TYPE_AUDIO],
+ SubdefType::TYPE_DOCUMENT => [SubdefSpecs::TYPE_IMAGE, SubdefSpecs::TYPE_FLEXPAPER],
+ SubdefType::TYPE_FLASH => [SubdefSpecs::TYPE_IMAGE],
+ SubdefType::TYPE_IMAGE => [SubdefSpecs::TYPE_IMAGE],
+ SubdefType::TYPE_VIDEO => [SubdefSpecs::TYPE_IMAGE, SubdefSpecs::TYPE_VIDEO, SubdefSpecs::TYPE_ANIMATION],
+ ];
const CLASS_THUMBNAIL = 'thumbnail';
const CLASS_PREVIEW = 'preview';
@@ -194,16 +194,16 @@ class databox_subdef
*/
public function getAvailableSubdefTypes()
{
- $subdefTypes = array();
+ $subdefTypes = [];
- $availableDevices = array(
+ $availableDevices = [
self::DEVICE_ALL,
self::DEVICE_HANDHELD,
self::DEVICE_PRINT,
self::DEVICE_PROJECTION,
self::DEVICE_SCREEN,
self::DEVICE_TV,
- );
+ ];
if (isset(self::$mediaTypeToSubdefTypes[$this->subdef_group->getType()])) {
diff --git a/lib/classes/databox/subdefsStructure.php b/lib/classes/databox/subdefsStructure.php
index 6d838f8407..2703a3888e 100644
--- a/lib/classes/databox/subdefsStructure.php
+++ b/lib/classes/databox/subdefsStructure.php
@@ -20,7 +20,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
*
* @var Array
*/
- protected $AvSubdefs = array();
+ protected $AvSubdefs = [];
/**
*
@@ -76,13 +76,13 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
{
$sx_struct = $this->databox->get_sxml_structure();
- $this->AvSubdefs = array(
- 'image' => array(),
- 'video' => array(),
- 'audio' => array(),
- 'document' => array(),
- 'flash' => array()
- );
+ $this->AvSubdefs = [
+ 'image' => [],
+ 'video' => [],
+ 'audio' => [],
+ 'document' => [],
+ 'flash' => []
+ ];
if (! $sx_struct) {
return $this;
@@ -94,7 +94,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
$subdefgroup_name = strtolower($subdefs->attributes()->name);
if ( ! isset($AvSubdefs[$subdefgroup_name])) {
- $AvSubdefs[$subdefgroup_name] = array();
+ $AvSubdefs[$subdefgroup_name] = [];
}
foreach ($subdefs as $sd) {
diff --git a/lib/classes/deprecated/countries.php b/lib/classes/deprecated/countries.php
index cbe4e5bbb6..6db3d6bcf5 100644
--- a/lib/classes/deprecated/countries.php
+++ b/lib/classes/deprecated/countries.php
@@ -16,7 +16,7 @@
*/
function getCountries($lng = 'fr')
{
- $countries['en'] = array(
+ $countries['en'] = [
'AF' => 'AFGHANISTAN',
'AX' => 'ÅLAND ISLANDS',
'AL' => 'ALBANIA',
@@ -263,11 +263,11 @@ function getCountries($lng = 'fr')
'YE' => 'YEMEN',
'ZM' => 'ZAMBIA',
'ZW' => 'ZIMBABWE',
- );
+ ];
$countries['us'] = $countries['en'];
- $countries['fr'] = array(
+ $countries['fr'] = [
'AF' => 'AFGHANISTAN',
'ZA' => 'AFRIQUE DU SUD',
'AX' => 'ÅLAND, ÎLES',
@@ -514,7 +514,7 @@ function getCountries($lng = 'fr')
'YE' => 'YÉMEN',
'ZM' => 'ZAMBIE',
'ZW' => 'ZIMBABWE'
- );
+ ];
if ( ! isset($countries[$lng]))
$lng = 'us';
foreach ($countries[$lng] as $k => $country)
diff --git a/lib/classes/deprecated/inscript.api.php b/lib/classes/deprecated/inscript.api.php
index 72906dc234..93a8e0e9af 100644
--- a/lib/classes/deprecated/inscript.api.php
+++ b/lib/classes/deprecated/inscript.api.php
@@ -40,7 +40,7 @@ function giveMeBases(Application $app, $usr = null)
AND usr.usr_id = :usr_id AND model_of = 0';
$stmt = $conn->prepare($sqlU);
- $stmt->execute(array(':usr_id' => $usr));
+ $stmt->execute([':usr_id' => $usr]);
$rsU = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -72,7 +72,7 @@ function giveMeBases(Application $app, $usr = null)
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
$collname = $basname = null;
$sbas_id = $databox->get_sbas_id();
- $inscriptions[$sbas_id] = array();
+ $inscriptions[$sbas_id] = [];
$inscriptions[$sbas_id]['CGU'] = false;
$inscriptions[$sbas_id]['CGUrelease'] = false;
$inscriptions[$sbas_id]['inscript'] = false;
@@ -293,7 +293,7 @@ function giveMeBaseUsr(Application $app, $usr)
$out .= '';
- return array('tab' => $out, 'demandes' => $noDemand);
+ return ['tab' => $out, 'demandes' => $noDemand];
}
function giveModInscript($usr, $lng)
diff --git a/lib/classes/eventsmanager/broker.php b/lib/classes/eventsmanager/broker.php
index 977eaa4db2..50d9ecc9b0 100644
--- a/lib/classes/eventsmanager/broker.php
+++ b/lib/classes/eventsmanager/broker.php
@@ -4,9 +4,9 @@ use Alchemy\Phrasea\Application;
class eventsmanager_broker
{
- protected $events = array();
- protected $notifications = array();
- protected $pool_classes = array();
+ protected $events = [];
+ protected $notifications = [];
+ protected $pool_classes = [];
/**
*
@@ -23,11 +23,11 @@ class eventsmanager_broker
public function start()
{
- $iterators_pool = array(
- 'event' => array(
+ $iterators_pool = [
+ 'event' => [
'eventsmanager_event_test'
- ),
- 'notify' => array(
+ ],
+ 'notify' => [
'eventsmanager_notify_autoregister',
'eventsmanager_notify_bridgeuploadfail',
'eventsmanager_notify_downloadmailfail',
@@ -41,8 +41,8 @@ class eventsmanager_broker
'eventsmanager_notify_validate',
'eventsmanager_notify_validationdone',
'eventsmanager_notify_validationreminder',
- )
- );
+ ]
+ ];
foreach ($iterators_pool as $type => $iterators) {
foreach ($iterators as $fileinfo) {
@@ -64,7 +64,7 @@ class eventsmanager_broker
return;
}
- public function trigger($event, $array_params = array(), &$object = false)
+ public function trigger($event, $array_params = [], &$object = false)
{
if (array_key_exists($event, $this->events)) {
foreach ($this->events[$event] as $classname) {
@@ -79,7 +79,7 @@ class eventsmanager_broker
{
if ( ! array_key_exists($event, $this->events))
- $this->events[$event] = array();
+ $this->events[$event] = [];
$this->events[$event][] = $object_name;
}
@@ -93,12 +93,12 @@ class eventsmanager_broker
VALUES
(null, :usr_id, :event_type, 1, :mailed, :datas, NOW())';
- $params = array(
+ $params = [
':usr_id' => $usr_id
, ':event_type' => $event_type
, ':mailed' => ($mailed ? 1 : 0)
, ':datas' => $datas
- );
+ ];
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -118,7 +118,7 @@ class eventsmanager_broker
FROM notifications WHERE usr_id = :usr_id';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
- $stmt->execute(array(':usr_id' => $this->app['authentication']->getUser()->get_id()));
+ $stmt->execute([':usr_id' => $this->app['authentication']->getUser()->get_id()]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -133,10 +133,10 @@ class eventsmanager_broker
ORDER BY created_on DESC
LIMIT ' . ((int) $page * $n) . ', ' . $n;
- $data = array('notifications' => array(), 'next' => '');
+ $data = ['notifications' => [], 'next' => ''];
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
- $stmt->execute(array(':usr_id' => $this->app['authentication']->getUser()->get_id()));
+ $stmt->execute([':usr_id' => $this->app['authentication']->getUser()->get_id()]);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -147,7 +147,7 @@ class eventsmanager_broker
if ( ! isset($this->pool_classes[$type]) || count($content) === 0) {
$sql = 'DELETE FROM notifications WHERE id = :id';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
- $stmt->execute(array(':id' => $row['id']));
+ $stmt->execute([':id' => $row['id']]);
$stmt->closeCursor();
continue;
}
@@ -156,19 +156,19 @@ class eventsmanager_broker
$display_date = $this->app['date-formatter']->getDate(new DateTime($row['created_on']));
if ( ! isset($data['notifications'][$date_key])) {
- $data['notifications'][$date_key] = array(
+ $data['notifications'][$date_key] = [
'display' => $display_date
- , 'notifications' => array()
- );
+ , 'notifications' => []
+ ];
}
- $data['notifications'][$date_key]['notifications'][$row['id']] = array(
+ $data['notifications'][$date_key]['notifications'][$row['id']] = [
'classname' => $content['class']
, 'time' => $this->app['date-formatter']->getTime(new DateTime($row['created_on']))
, 'icon' => '
'
, 'id' => $row['id']
, 'text' => $content['text']
- );
+ ];
}
if (((int) $page + 1) * $n < $total) {
@@ -186,7 +186,7 @@ class eventsmanager_broker
FROM notifications
WHERE usr_id = :usr_id AND unread="1"';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
- $stmt->execute(array(':usr_id' => $this->app['authentication']->getUser()->get_id()));
+ $stmt->execute([':usr_id' => $this->app['authentication']->getUser()->get_id()]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -205,7 +205,7 @@ class eventsmanager_broker
FROM notifications WHERE usr_id = :usr_id';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
- $stmt->execute(array(':usr_id' => $this->app['authentication']->getUser()->get_id()));
+ $stmt->execute([':usr_id' => $this->app['authentication']->getUser()->get_id()]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -221,9 +221,9 @@ class eventsmanager_broker
WHERE usr_id = :usr_id AND unread="1" ORDER BY created_on DESC';
}
- $ret = array();
+ $ret = [];
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
- $stmt->execute(array(':usr_id' => $this->app['authentication']->getUser()->get_id()));
+ $stmt->execute([':usr_id' => $this->app['authentication']->getUser()->get_id()]);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -237,19 +237,19 @@ class eventsmanager_broker
if ( ! isset($this->pool_classes[$type]) || count($datas) === 0) {
$sql = 'DELETE FROM notifications WHERE id = :id';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
- $stmt->execute(array(':id' => $row['id']));
+ $stmt->execute([':id' => $row['id']]);
$stmt->closeCursor();
continue;
}
$ret[] = array_merge(
$datas
- , array(
+ , [
'created_on' => $this->app['date-formatter']->getPrettyString(new DateTime($row['created_on']))
, 'icon' => $this->pool_classes[$type]->icon_url()
, 'id' => $row['id']
, 'unread' => $row['unread']
- )
+ ]
);
}
@@ -267,7 +267,7 @@ class eventsmanager_broker
AND (id="' . implode('" OR id="', $notifications) . '")';
$stmt = $this->app['phraseanet.appbox']->get_connection()->prepare($sql);
- $stmt->execute(array(':usr_id' => $usr_id));
+ $stmt->execute([':usr_id' => $usr_id]);
$stmt->closeCursor();
return $this;
@@ -275,7 +275,7 @@ class eventsmanager_broker
public function list_notifications_available($usr_id)
{
- $personnal_notifications = array();
+ $personnal_notifications = [];
foreach ($this->notifications as $notification) {
if (!$this->pool_classes[$notification]->is_available($usr_id)) {
@@ -284,12 +284,12 @@ class eventsmanager_broker
$group = $this->pool_classes[$notification]->get_group();
$group = $group === null ? _('Notifications globales') : $group;
- $personnal_notifications[$group][] = array(
+ $personnal_notifications[$group][] = [
'name' => $this->pool_classes[$notification]->get_name()
, 'id' => $notification
, 'description' => $this->pool_classes[$notification]->get_description()
, 'subscribe_emails' => true
- );
+ ];
}
return $personnal_notifications;
diff --git a/lib/classes/eventsmanager/event/test.php b/lib/classes/eventsmanager/event/test.php
index 0c44941856..60d8d94956 100644
--- a/lib/classes/eventsmanager/event/test.php
+++ b/lib/classes/eventsmanager/event/test.php
@@ -21,7 +21,7 @@ class eventsmanager_event_test extends eventsmanager_eventAbstract
*
* @var Array
*/
- protected $events = array('__EVENT__');
+ protected $events = ['__EVENT__'];
/**
*
diff --git a/lib/classes/eventsmanager/eventAbstract.php b/lib/classes/eventsmanager/eventAbstract.php
index 3967503b5f..88d8582ad1 100644
--- a/lib/classes/eventsmanager/eventAbstract.php
+++ b/lib/classes/eventsmanager/eventAbstract.php
@@ -4,7 +4,7 @@ use Alchemy\Phrasea\Application;
abstract class eventsmanager_eventAbstract
{
- protected $events = array();
+ protected $events = [];
protected $group = null;
/**
diff --git a/lib/classes/eventsmanager/notify/autoregister.php b/lib/classes/eventsmanager/notify/autoregister.php
index fb20884e54..5bc09600ee 100644
--- a/lib/classes/eventsmanager/notify/autoregister.php
+++ b/lib/classes/eventsmanager/notify/autoregister.php
@@ -24,7 +24,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
*
* @var string
*/
- public $events = array('__REGISTER_AUTOREGISTER__');
+ public $events = ['__REGISTER_AUTOREGISTER__'];
/**
*
@@ -44,10 +44,10 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
*/
public function fire($event, $params, &$object)
{
- $default = array(
+ $default = [
'usr_id' => ''
- , 'autoregister' => array()
- );
+ , 'autoregister' => []
+ ];
$params = array_merge($default, $params);
$base_ids = array_keys($params['autoregister']);
@@ -56,7 +56,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
return;
}
- $mailColl = array();
+ $mailColl = [];
$sql = 'SELECT u.usr_id, b.base_id FROM usr u, basusr b
WHERE u.usr_id = b.usr_id
@@ -75,7 +75,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
foreach ($rs as $row) {
if ( ! isset($mailColl[$row['usr_id']]))
- $mailColl[$row['usr_id']] = array();
+ $mailColl[$row['usr_id']] = [];
$mailColl[$row['usr_id']][] = $row['base_id'];
}
@@ -149,16 +149,16 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
try {
User_Adapter::getInstance($usr_id, $this->app);
} catch (Exception $e) {
- return array();
+ return [];
}
$sender = User_Adapter::getInstance($usr_id, $this->app)->get_display_name();
- $ret = array(
+ $ret = [
'text' => sprintf(
_('%1$s s\'est enregistre sur une ou plusieurs %2$scollections%3$s'), $sender, '', '')
, 'class' => ''
- );
+ ];
return $ret;
}
diff --git a/lib/classes/eventsmanager/notify/bridgeuploadfail.php b/lib/classes/eventsmanager/notify/bridgeuploadfail.php
index 692ab2ad54..be93dbe133 100644
--- a/lib/classes/eventsmanager/notify/bridgeuploadfail.php
+++ b/lib/classes/eventsmanager/notify/bridgeuploadfail.php
@@ -24,7 +24,7 @@ class eventsmanager_notify_bridgeuploadfail extends eventsmanager_notifyAbstract
*
* @var string
*/
- public $events = array('__BRIDGE_UPLOAD_FAIL__');
+ public $events = ['__BRIDGE_UPLOAD_FAIL__'];
/**
*
@@ -44,13 +44,13 @@ class eventsmanager_notify_bridgeuploadfail extends eventsmanager_notifyAbstract
*/
public function fire($event, $params, &$object)
{
- $default = array(
+ $default = [
'usr_id' => null
, 'reason' => ''
, 'account_id' => null
, 'base_id' => null
, 'record_id' => null
- );
+ ];
$params = array_merge($default, $params);
@@ -127,14 +127,14 @@ class eventsmanager_notify_bridgeuploadfail extends eventsmanager_notifyAbstract
$account = Bridge_Account::load_account($this->app, $account_id);
$record = new record_adapter($this->app, $sbas_id, $rid);
} catch (Exception $e) {
- return array();
+ return [];
}
- $ret = array(
+ $ret = [
'text' => sprintf("L'upload concernant le record %s sur le comptre %s a echoue pour les raisons suivantes : %s"
, $record->get_title(), $account->get_api()->get_connector()->get_name(), $reason)
, 'class' => ''
- );
+ ];
return $ret;
}
diff --git a/lib/classes/eventsmanager/notify/downloadmailfail.php b/lib/classes/eventsmanager/notify/downloadmailfail.php
index b73e55b5cd..a94448c3c1 100644
--- a/lib/classes/eventsmanager/notify/downloadmailfail.php
+++ b/lib/classes/eventsmanager/notify/downloadmailfail.php
@@ -24,7 +24,7 @@ class eventsmanager_notify_downloadmailfail extends eventsmanager_notifyAbstract
*
* @var string
*/
- public $events = array('__EXPORT_MAIL_FAIL__');
+ public $events = ['__EXPORT_MAIL_FAIL__'];
/**
*
@@ -44,13 +44,13 @@ class eventsmanager_notify_downloadmailfail extends eventsmanager_notifyAbstract
*/
public function fire($event, $params, &$object)
{
- $default = array(
+ $default = [
'usr_id' => null
, 'lst' => ''
, 'ssttid' => ''
, 'dest' => ''
, 'reason' => ''
- );
+ ];
$params = array_merge($default, $params);
@@ -117,10 +117,10 @@ class eventsmanager_notify_downloadmailfail extends eventsmanager_notifyAbstract
, $reason
);
- $ret = array(
+ $ret = [
'text' => $text
, 'class' => ''
- );
+ ];
return $ret;
}
diff --git a/lib/classes/eventsmanager/notify/feed.php b/lib/classes/eventsmanager/notify/feed.php
index f566989653..5a1ace4f22 100644
--- a/lib/classes/eventsmanager/notify/feed.php
+++ b/lib/classes/eventsmanager/notify/feed.php
@@ -24,7 +24,7 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
*
* @var string
*/
- public $events = array('__FEED_ENTRY_CREATE__');
+ public $events = ['__FEED_ENTRY_CREATE__'];
/**
*
@@ -44,10 +44,10 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
*/
public function fire($event, $params, &$entry)
{
- $params = array(
+ $params = [
'entry_id' => $entry->getId(),
'notify_email' => $params['notify_email'],
- );
+ ];
$dom_xml = new DOMDocument('1.0', 'UTF-8');
@@ -74,16 +74,16 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
->email_not_null(true);
if ($entry->getFeed()->getCollection($this->app)) {
- $Query->on_base_ids(array($entry->getFeed()->getCollection($this->app)->get_base_id()));
+ $Query->on_base_ids([$entry->getFeed()->getCollection($this->app)->get_base_id()]);
}
$start = 0;
$perLoop = 100;
- $from = array(
+ $from = [
'email' => $entry->getAuthorEmail(),
'name' => $entry->getAuthorName()
- );
+ ];
do {
$results = $Query->limit($start, $perLoop)->execute()->get_results();
@@ -102,7 +102,7 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
, $entry->getId()
);
- $url = $this->app->url('lightbox', array('LOG' => $token));
+ $url = $this->app->url('lightbox', ['LOG' => $token]);
$receiver = Receiver::fromUser($user_to_notif);
$readyToSend = true;
@@ -142,17 +142,17 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
$entry = $this->app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\FeedEntry')->find((int) $sx->entry_id);
if (null === $entry) {
- return array();
+ return [];
}
- $ret = array(
+ $ret = [
'text' => sprintf(
_('%1$s has published %2$s')
, $entry->getAuthorName()
, '' . $entry->getTitle() . ''
)
, 'class' => ($unread == 1 ? 'reload_baskets' : '')
- );
+ ];
return $ret;
}
diff --git a/lib/classes/eventsmanager/notify/order.php b/lib/classes/eventsmanager/notify/order.php
index 1f92e77437..d4f898d8e0 100644
--- a/lib/classes/eventsmanager/notify/order.php
+++ b/lib/classes/eventsmanager/notify/order.php
@@ -24,7 +24,7 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract
*
* @var string
*/
- public $events = array('__NEW_ORDER__');
+ public $events = ['__NEW_ORDER__'];
/**
*
@@ -44,22 +44,22 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract
*/
public function fire($event, $params, &$object)
{
- $default = array(
+ $default = [
'usr_id' => ''
- , 'order_id' => array()
- );
+ , 'order_id' => []
+ ];
$params = array_merge($default, $params);
$order_id = $params['order_id'];
- $users = array();
+ $users = [];
try {
$repository = $this->app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\OrderElement');
- $results = $repository->findBy(array('orderId' => $order_id));
+ $results = $repository->findBy(['orderId' => $order_id]);
- $base_ids = array();
+ $base_ids = [];
foreach ($results as $result) {
$base_ids[] = $result->getBaseId();
}
@@ -67,7 +67,7 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract
$query = new User_Query($this->app);
$users = $query->on_base_ids($base_ids)
- ->who_have_right(array('order_master'))
+ ->who_have_right(['order_master'])
->execute()->get_results();
} catch (Exception $e) {
@@ -147,18 +147,18 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract
try {
User_Adapter::getInstance($usr_id, $this->app);
} catch (Exception $e) {
- return array();
+ return [];
}
$sender = User_Adapter::getInstance($usr_id, $this->app)->get_display_name();
- $ret = array(
+ $ret = [
'text' => sprintf(_('%1$s a passe une %2$scommande%3$s')
, $sender
, ''
, '')
, 'class' => ''
- );
+ ];
return $ret;
}
diff --git a/lib/classes/eventsmanager/notify/orderdeliver.php b/lib/classes/eventsmanager/notify/orderdeliver.php
index c95636e67f..4b72f18fcd 100644
--- a/lib/classes/eventsmanager/notify/orderdeliver.php
+++ b/lib/classes/eventsmanager/notify/orderdeliver.php
@@ -26,7 +26,7 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract
*
* @var string
*/
- public $events = array('__ORDER_DELIVER__');
+ public $events = ['__ORDER_DELIVER__'];
/**
*
@@ -58,12 +58,12 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract
*/
public function fire($event, $params, &$object)
{
- $default = array(
+ $default = [
'from' => ''
, 'to' => ''
, 'ssel_id' => ''
, 'n' => ''
- );
+ ];
$params = array_merge($default, $params);
@@ -113,7 +113,7 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract
}
if ($readyToSend) {
- $url = $this->app->url('lightbox_compare', array(
+ $url = $this->app->url('lightbox_compare', [
'basket' => $basket->getId(),
'LOG' => $this->app['tokens']->getUrlToken(
\random::TYPE_VIEW,
@@ -121,7 +121,7 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract
null,
$basket->getId()
)
- ));
+ ]);
$mail = MailInfoOrderDelivered::create($this->app, $receiver, $emitter, null);
$mail->setButtonUrl($url);
@@ -153,7 +153,7 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract
try {
User_Adapter::getInstance($from, $this->app);
} catch (Exception $e) {
- return array();
+ return [];
}
$sender = User_Adapter::getInstance($from, $this->app)->get_display_name();
@@ -161,16 +161,16 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract
try {
$basket = $this->app['converter.basket']->convert($ssel_id);
} catch (Exception $e) {
- return array();
+ return [];
}
- $ret = array(
+ $ret = [
'text' => sprintf(
_('%1$s vous a delivre %2$d document(s) pour votre commande %3$s'), $sender, $n, ''
. $basket->getName() . ''
)
, 'class' => ''
- );
+ ];
return $ret;
}
diff --git a/lib/classes/eventsmanager/notify/ordernotdelivered.php b/lib/classes/eventsmanager/notify/ordernotdelivered.php
index b555eedf07..d046f1afb0 100644
--- a/lib/classes/eventsmanager/notify/ordernotdelivered.php
+++ b/lib/classes/eventsmanager/notify/ordernotdelivered.php
@@ -25,7 +25,7 @@ class eventsmanager_notify_ordernotdelivered extends eventsmanager_notifyAbstrac
*
* @var string
*/
- public $events = array('__ORDER_NOT_DELIVERED__');
+ public $events = ['__ORDER_NOT_DELIVERED__'];
public function __construct(Application $app, eventsmanager_broker $broker)
{
@@ -42,11 +42,11 @@ class eventsmanager_notify_ordernotdelivered extends eventsmanager_notifyAbstrac
public function fire($event, $params, &$object)
{
- $default = array(
+ $default = [
'from' => ''
, 'to' => ''
, 'n' => ''
- );
+ ];
$params = array_merge($default, $params);
@@ -115,17 +115,17 @@ class eventsmanager_notify_ordernotdelivered extends eventsmanager_notifyAbstrac
try {
User_Adapter::getInstance($from, $this->app);
} catch (Exception $e) {
- return array();
+ return [];
}
$sender = User_Adapter::getInstance($from, $this->app)->get_display_name();
- $ret = array(
+ $ret = [
'text' => sprintf(
_('%1$s a refuse la livraison de %2$d document(s) pour votre commande'), $sender, $n
)
, 'class' => ''
- );
+ ];
return $ret;
}
diff --git a/lib/classes/eventsmanager/notify/push.php b/lib/classes/eventsmanager/notify/push.php
index b9a2143ff7..61fb451be2 100644
--- a/lib/classes/eventsmanager/notify/push.php
+++ b/lib/classes/eventsmanager/notify/push.php
@@ -25,7 +25,7 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract
*
* @var string
*/
- public $events = array('__PUSH_DATAS__');
+ public $events = ['__PUSH_DATAS__'];
/**
*
@@ -45,12 +45,12 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract
*/
public function fire($event, $params, &$object)
{
- $default = array(
+ $default = [
'from' => ''
, 'to' => ''
, 'message' => ''
, 'ssel_id' => ''
- );
+ ];
$params = array_merge($default, $params);
@@ -128,17 +128,17 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract
try {
User_Adapter::getInstance($from, $this->app);
} catch (Exception $e) {
- return array();
+ return [];
}
$sender = User_Adapter::getInstance($from, $this->app)->get_display_name();
- $ret = array(
+ $ret = [
'text' => sprintf(
_('%1$s vous a envoye un %2$spanier%3$s'), $sender, '', '')
, 'class' => ($unread == 1 ? 'reload_baskets' : '')
- );
+ ];
return $ret;
}
diff --git a/lib/classes/eventsmanager/notify/register.php b/lib/classes/eventsmanager/notify/register.php
index 0df131a710..b2cebb6bff 100644
--- a/lib/classes/eventsmanager/notify/register.php
+++ b/lib/classes/eventsmanager/notify/register.php
@@ -24,7 +24,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
*
* @var string
*/
- public $events = array('__REGISTER_APPROVAL__');
+ public $events = ['__REGISTER_APPROVAL__'];
/**
*
@@ -44,10 +44,10 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
*/
public function fire($event, $params, &$object)
{
- $default = array(
+ $default = [
'usr_id' => ''
- , 'demand' => array()
- );
+ , 'demand' => []
+ ];
$params = array_merge($default, $params);
$base_ids = $params['demand'];
@@ -56,7 +56,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
return;
}
- $mailColl = array();
+ $mailColl = [];
try {
$sql = 'SELECT u.usr_id, b.base_id
@@ -76,7 +76,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
foreach ($rs as $row) {
if ( ! isset($mailColl[$row['usr_id']]))
- $mailColl[$row['usr_id']] = array();
+ $mailColl[$row['usr_id']] = [];
$mailColl[$row['usr_id']][] = $row['base_id'];
}
@@ -159,17 +159,17 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
try {
User_Adapter::getInstance($usr_id, $this->app);
} catch (Exception $e) {
- return array();
+ return [];
}
$sender = User_Adapter::getInstance($usr_id, $this->app)->get_display_name();
- $ret = array(
+ $ret = [
'text' => sprintf(
- _('%1$s demande votre approbation sur une ou plusieurs %2$scollections%3$s'), $sender, '', ''
+ _('%1$s demande votre approbation sur une ou plusieurs %2$scollections%3$s'), $sender, '', ''
)
, 'class' => ''
- );
+ ];
return $ret;
}
diff --git a/lib/classes/eventsmanager/notify/uploadquarantine.php b/lib/classes/eventsmanager/notify/uploadquarantine.php
index 0fb8881cab..3d49b996b6 100644
--- a/lib/classes/eventsmanager/notify/uploadquarantine.php
+++ b/lib/classes/eventsmanager/notify/uploadquarantine.php
@@ -26,7 +26,7 @@ class eventsmanager_notify_uploadquarantine extends eventsmanager_notifyAbstract
*
* @var string
*/
- public $events = array('__UPLOAD_QUARANTINE__');
+ public $events = ['__UPLOAD_QUARANTINE__'];
/**
*
@@ -87,8 +87,8 @@ class eventsmanager_notify_uploadquarantine extends eventsmanager_notifyAbstract
$query = new User_Query($this->app);
$users = $query
- ->on_base_ids(array($lazaretFile->getBaseId()))
- ->who_have_right(array('canaddrecord'))
+ ->on_base_ids([$lazaretFile->getBaseId()])
+ ->who_have_right(['canaddrecord'])
->execute()
->get_results();
@@ -140,7 +140,7 @@ class eventsmanager_notify_uploadquarantine extends eventsmanager_notifyAbstract
{
$sx = simplexml_load_string($datas);
- $reasons = array();
+ $reasons = [];
foreach ($sx->reasons as $reason) {
$checkClassName = (string) $reason->checkClassName;
@@ -158,7 +158,7 @@ class eventsmanager_notify_uploadquarantine extends eventsmanager_notifyAbstract
$text .= ' ' . sprintf(_('for the following reasons : %s'), implode(', ', $reasons));
}
- $ret = array('text' => $text, 'class' => '');
+ $ret = ['text' => $text, 'class' => ''];
return $ret;
}
diff --git a/lib/classes/eventsmanager/notify/validate.php b/lib/classes/eventsmanager/notify/validate.php
index 6b499a809f..f89ee3f8a1 100644
--- a/lib/classes/eventsmanager/notify/validate.php
+++ b/lib/classes/eventsmanager/notify/validate.php
@@ -20,7 +20,7 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract
*
* @var string
*/
- public $events = array('__PUSH_VALIDATION__');
+ public $events = ['__PUSH_VALIDATION__'];
/**
*
@@ -52,12 +52,12 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract
*/
public function fire($event, $params, &$object)
{
- $default = array(
+ $default = [
'from' => ''
, 'to' => ''
, 'message' => ''
, 'ssel_id' => ''
- );
+ ];
$params = array_merge($default, $params);
@@ -140,7 +140,7 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract
try {
User_Adapter::getInstance($from, $this->app);
} catch (Exception $e) {
- return array();
+ return [];
}
$sender = User_Adapter::getInstance($from, $this->app)->get_display_name();
@@ -153,17 +153,17 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract
}
$bask_link = ''
. $basket_name . '';
- $ret = array(
+ $ret = [
'text' => sprintf(
_('%1$s vous demande de valider %2$s')
, $sender, $bask_link
)
, 'class' => ($unread == 1 ? 'reload_baskets' : '')
- );
+ ];
return $ret;
}
diff --git a/lib/classes/eventsmanager/notify/validationdone.php b/lib/classes/eventsmanager/notify/validationdone.php
index f3cf41b933..75f09fc7f0 100644
--- a/lib/classes/eventsmanager/notify/validationdone.php
+++ b/lib/classes/eventsmanager/notify/validationdone.php
@@ -20,7 +20,7 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract
*
* @var string
*/
- public $events = array('__VALIDATION_DONE__');
+ public $events = ['__VALIDATION_DONE__'];
/**
*
@@ -52,11 +52,11 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract
*/
public function fire($event, $params, &$object)
{
- $default = array(
+ $default = [
'from' => ''
, 'to' => ''
, 'ssel_id' => ''
- );
+ ];
$params = array_merge($default, $params);
@@ -134,7 +134,7 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract
try {
$registered_user = User_Adapter::getInstance($from, $this->app);
} catch (Exception $e) {
- return array();
+ return [];
}
$sender = $registered_user->get_display_name();
@@ -142,17 +142,17 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract
try {
$basket = $this->app['converter.basket']->convert($ssel_id);
} catch (Exception $e) {
- return array();
+ return [];
}
- $ret = array(
+ $ret = [
'text' => sprintf(
_('%1$s a envoye son rapport de validation de %2$s'), $sender, ''
. $basket->getName() . ''
)
, 'class' => ''
- );
+ ];
return $ret;
}
diff --git a/lib/classes/eventsmanager/notify/validationreminder.php b/lib/classes/eventsmanager/notify/validationreminder.php
index 2925583985..039e37c2d2 100644
--- a/lib/classes/eventsmanager/notify/validationreminder.php
+++ b/lib/classes/eventsmanager/notify/validationreminder.php
@@ -20,7 +20,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra
*
* @var string
*/
- public $events = array('__VALIDATION_REMINDER__');
+ public $events = ['__VALIDATION_REMINDER__'];
/**
*
@@ -52,12 +52,12 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra
*/
public function fire($event, $params, &$object)
{
- $default = array(
+ $default = [
'from' => ''
, 'to' => ''
, 'ssel_id' => ''
, 'url' => ''
- );
+ ];
$params = array_merge($default, $params);
@@ -139,7 +139,7 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra
try {
User_Adapter::getInstance($from, $this->app);
} catch (Exception $e) {
- return array();
+ return [];
}
$sender = User_Adapter::getInstance($from, $this->app)->get_display_name();
@@ -155,12 +155,12 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra
. (string) $sx->ssel_id . '\');return false;">'
. $basket_name . '
"
@@ -526,7 +526,7 @@ class module_report_nav extends module_report
, 'type' => $document->get_mime()
, 'titre' => $record->get_title()
, 'taille' => $document->get_size()
- );
+ ];
$this->setDisplayNav();
$this->setReport();
@@ -542,7 +542,7 @@ class module_report_nav extends module_report
$sqlBuilder = new module_report_sql($this->app, $this);
$filter = $sqlBuilder->getFilters();
$report_filter = $filter->getReportFilter();
- $params = array_merge($report_filter['params'], array(':browser' => $navigator));
+ $params = array_merge($report_filter['params'], [':browser' => $navigator]);
$sql = "
SELECT DISTINCT(tt.version), COUNT(tt.version) as nb
diff --git a/lib/classes/module/report/push.php b/lib/classes/module/report/push.php
index a6fb89fa59..e49284e3a8 100644
--- a/lib/classes/module/report/push.php
+++ b/lib/classes/module/report/push.php
@@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application;
class module_report_push extends module_report
{
- protected $cor_query = array(
+ protected $cor_query = [
'user' => 'log.user',
'site' => 'log.site',
'societe' => 'log.societe',
@@ -29,7 +29,7 @@ class module_report_push extends module_report
'final' => 'd.final',
'comment' => 'd.comment',
'size' => 's.size'
- );
+ ];
/**
* constructor
@@ -72,7 +72,7 @@ class module_report_push extends module_report
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $ret = array();
+ $ret = [];
foreach ($rs as $row) {
$value = $row['val'];
@@ -90,7 +90,7 @@ class module_report_push extends module_report
$caption = p4string::format_octets($value);
}
- $ret[] = array('val' => $caption, 'value' => $value);
+ $ret[] = ['val' => $caption, 'value' => $value];
}
return $ret;
diff --git a/lib/classes/module/report/question.php b/lib/classes/module/report/question.php
index 14343c4fab..3d10d6875e 100644
--- a/lib/classes/module/report/question.php
+++ b/lib/classes/module/report/question.php
@@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application;
class module_report_question extends module_report
{
- protected $cor_query = array(
+ protected $cor_query = [
'user' => 'log.user',
'usrid' => 'log.usrid',
'ddate' => 'log_search.date',
@@ -26,7 +26,7 @@ class module_report_question extends module_report
'sit_session' => 'log.sit_session',
'appli' => 'log.appli',
'ip' => 'log.ip'
- );
+ ];
/**
* constructor
@@ -58,7 +58,7 @@ class module_report_question extends module_report
public function colFilter($field)
{
- $ret = array();
+ $ret = [];
$sqlBuilder = $this->sqlBuilder('question');
$var = $sqlBuilder->sqlDistinctValByField($field);
$sql = $var['sql'];
@@ -76,7 +76,7 @@ class module_report_question extends module_report
$caption = $this->app['date-formatter']->getPrettyString(new DateTime($value));
else
$caption = $row['val'];
- $ret[] = array('val' => $caption, 'value' => $value);
+ $ret[] = ['val' => $caption, 'value' => $value];
}
return $ret;
diff --git a/lib/classes/module/report/sent.php b/lib/classes/module/report/sent.php
index 519286fb54..b16a006267 100644
--- a/lib/classes/module/report/sent.php
+++ b/lib/classes/module/report/sent.php
@@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application;
class module_report_sent extends module_report
{
- protected $cor_query = array(
+ protected $cor_query = [
'user' => 'log.user',
'site' => 'log.site',
'societe' => 'log.societe',
@@ -29,7 +29,7 @@ class module_report_sent extends module_report
'final' => 'd.final',
'comment' => 'd.comment',
'size' => 's.size'
- );
+ ];
/**
* constructor
@@ -72,7 +72,7 @@ class module_report_sent extends module_report
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $ret = array();
+ $ret = [];
foreach ($rs as $row) {
$value = $row['val'];
@@ -90,7 +90,7 @@ class module_report_sent extends module_report
$caption = p4string::format_octets($value);
}
- $ret[] = array('val' => $caption, 'value' => $value);
+ $ret[] = ['val' => $caption, 'value' => $value];
}
return $ret;
diff --git a/lib/classes/module/report/sql.php b/lib/classes/module/report/sql.php
index f88711aa7c..c1dfa0873a 100644
--- a/lib/classes/module/report/sql.php
+++ b/lib/classes/module/report/sql.php
@@ -43,7 +43,7 @@ class module_report_sql
$this->connbas = connection::getPDOConnection($app, $report->getSbasId());
$this->filter = new module_report_sqlfilter($app, $report);
$this->sql = '';
- $this->params = array();
+ $this->params = [];
$this->total_row = 0;
$this->enable_limit = $report->getEnableLimit();
}
diff --git a/lib/classes/module/report/sqlaction.php b/lib/classes/module/report/sqlaction.php
index b29a0273d1..b39abea283 100644
--- a/lib/classes/module/report/sqlaction.php
+++ b/lib/classes/module/report/sqlaction.php
@@ -22,7 +22,7 @@ class module_report_sqlaction extends module_report_sql implements module_report
public function setAction($action)
{
- $a = array('edit', 'add', 'push', 'validate', 'mail');
+ $a = ['edit', 'add', 'push', 'validate', 'mail'];
if (in_array($action, $a)) {
$this->action = $action;
@@ -38,10 +38,10 @@ class module_report_sqlaction extends module_report_sql implements module_report
public function buildSql()
{
- $customFieldMap = array();
+ $customFieldMap = [];
- $filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
- $this->params = array_merge(array(':action' => $this->action), $filter['params']);
+ $filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
+ $this->params = array_merge([':action' => $this->action], $filter['params']);
if ($this->groupby == false) {
$this->sql = "
@@ -55,7 +55,7 @@ class module_report_sqlaction extends module_report_sql implements module_report
WHERE (" . $filter['sql'] . ") AND (d.action = :action)
) AS tt";
- $customFieldMap = array(
+ $customFieldMap = [
'log.usrid' => 'tt.usrid',
'log.user' => 'tt.user',
'd.final' => 'getter',
@@ -64,7 +64,7 @@ class module_report_sqlaction extends module_report_sql implements module_report
'record.mime' => 'tt.mime',
'file' => 'tt.file',
'd.comment' => 'tt.comment'
- );
+ ];
$stmt = $this->getConnBas()->prepare($this->sql);
$stmt->execute($this->params);
@@ -100,8 +100,8 @@ class module_report_sqlaction extends module_report_sql implements module_report
public function sqlDistinctValByField($field)
{
- $filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
- $this->params = array_merge(array(':action' => $this->action), $filter['params']);
+ $filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
+ $this->params = array_merge([':action' => $this->action], $filter['params']);
$this->sql = "
SELECT DISTINCT(val)
@@ -116,6 +116,6 @@ class module_report_sqlaction extends module_report_sql implements module_report
AND (d.action = :action)
) AS tt " . ($this->filter->getOrderFilter() ? $this->filter->getOrderFilter() : '');
- return array('sql' => $this->sql, 'params' => $this->params);
+ return ['sql' => $this->sql, 'params' => $this->params];
}
}
diff --git a/lib/classes/module/report/sqlconnexion.php b/lib/classes/module/report/sqlconnexion.php
index eb30201584..585a91736d 100644
--- a/lib/classes/module/report/sqlconnexion.php
+++ b/lib/classes/module/report/sqlconnexion.php
@@ -21,8 +21,8 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
public function buildSql()
{
- $filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
- $this->params = array_merge(array(), $filter['params']);
+ $filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
+ $this->params = array_merge([], $filter['params']);
if ($this->groupby == false) {
$this->sql = "
@@ -76,8 +76,8 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
public function sqlDistinctValByField($field)
{
- $filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
- $this->params = array_merge(array(), $filter['params']);
+ $filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
+ $this->params = array_merge([], $filter['params']);
$this->sql = '
SELECT DISTINCT(val)
@@ -88,6 +88,6 @@ class module_report_sqlconnexion extends module_report_sql implements module_rep
WHERE (' . $filter['sql'] . ')
) AS tt ORDER BY val ASC';
- return array('sql' => $this->sql, 'params' => $this->params);
+ return ['sql' => $this->sql, 'params' => $this->params];
}
}
diff --git a/lib/classes/module/report/sqldownload.php b/lib/classes/module/report/sqldownload.php
index 4edc45e30c..51acccb793 100644
--- a/lib/classes/module/report/sqldownload.php
+++ b/lib/classes/module/report/sqldownload.php
@@ -25,10 +25,10 @@ class module_report_sqldownload extends module_report_sql implements module_repo
public function buildSql()
{
- $customFieldMap = array();
+ $customFieldMap = [];
- $filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
- $this->params = array_merge(array(), $filter['params']);
+ $filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
+ $this->params = array_merge([], $filter['params']);
if ($this->groupby == false) {
$this->sql = "
@@ -57,14 +57,14 @@ class module_report_sqldownload extends module_report_sql implements module_repo
INNER JOIN record ON (log_docs.record_id = record.record_id)
INNER JOIN subdef ON (log_docs.record_id = subdef.record_id)';
- $customFieldMap = array(
+ $customFieldMap = [
$field => $name,
'log_docs.comment' => 'tt.comment',
'subdef.size' => 'tt.size',
'subdef.file' => 'tt.file',
'subdef.mime' => 'tt.mime',
'log_docs.final' => 'tt.final',
- );
+ ];
} elseif ($this->on == 'DOC') {
$this->sql = '
@@ -115,8 +115,8 @@ class module_report_sqldownload extends module_report_sql implements module_repo
public function sqlDistinctValByField($field)
{
- $filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
- $this->params = array_merge(array(), $filter['params']);
+ $filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
+ $this->params = array_merge([], $filter['params']);
$this->sql = '
SELECT DISTINCT(tt.val)
@@ -135,6 +135,6 @@ class module_report_sqldownload extends module_report_sql implements module_repo
$this->sql .= $this->filter->getOrderFilter() ? : '';
$this->sql .= $this->filter->getLimitFilter() ? : '';
- return array('sql' => $this->sql, 'params' => $this->params);
+ return ['sql' => $this->sql, 'params' => $this->params];
}
}
diff --git a/lib/classes/module/report/sqlfilter.php b/lib/classes/module/report/sqlfilter.php
index 0509ddea79..fa62093b58 100644
--- a/lib/classes/module/report/sqlfilter.php
+++ b/lib/classes/module/report/sqlfilter.php
@@ -15,7 +15,7 @@ class module_report_sqlfilter
{
public $conn;
private $filter;
- private $cor_query = array();
+ private $cor_query = [];
private $app;
private $report;
@@ -34,16 +34,16 @@ class module_report_sqlfilter
public static function constructDateFilter($dmin, $dmax)
{
- return array(
+ return [
'sql' => ($dmin && $dmax ? ' log_date.date > :date_min AND log_date.date < :date_max ' : false)
- , 'params' => ($dmin && $dmax ? array(':date_min' => $dmin, ':date_max' => $dmax) : array())
- );
+ , 'params' => ($dmin && $dmax ? [':date_min' => $dmin, ':date_max' => $dmax] : [])
+ ];
}
public static function constructCollectionFilter(Application $app, $list_coll_id)
{
- $ret = array('sql' => '', 'params' => array());
- $coll_filter = array();
+ $ret = ['sql' => '', 'params' => []];
+ $coll_filter = [];
foreach (array_filter(explode(',', $list_coll_id)) as $val) {
$val = \phrasea::collFromBas($app, $val);
if ($val) {
@@ -64,7 +64,7 @@ class module_report_sqlfilter
{
$finalfilter = '';
- $params = array(':log_site' => $this->app['configuration']['main']['key']);
+ $params = [':log_site' => $this->app['configuration']['main']['key']];
if ($this->filter['date']) {
$finalfilter .= $this->filter['date']['sql'] . ' AND ';
@@ -80,22 +80,22 @@ class module_report_sqlfilter
}
$finalfilter .= ' log.site = :log_site';
- return array('sql' => $finalfilter, 'params' => $params);
+ return ['sql' => $finalfilter, 'params' => $params];
}
public function getGvSitFilter()
{
- $params = array();
+ $params = [];
$sql = 'log.site = :log_site_gv_filter';
$params[':log_site_gv_filter'] = $this->app['configuration']['main']['key'];
- return array('sql' => $sql, 'params' => $params);
+ return ['sql' => $sql, 'params' => $params];
}
public function getUserIdFilter($id)
{
- return array('sql' => "log.usrid = :usr_id_filter", 'params' => array(':usr_id_filter' => $id));
+ return ['sql' => "log.usrid = :usr_id_filter", 'params' => [':usr_id_filter' => $id]];
}
public function getDateFilter()
@@ -136,13 +136,13 @@ class module_report_sqlfilter
{
$this->filter['date'] = false;
if ($report->getDmin() && $report->getDmax()) {
- $this->filter['date'] = array(
+ $this->filter['date'] = [
'sql' => ' (log.date > :date_min_f AND log.date < :date_max_f) '
- , 'params' => array(
+ , 'params' => [
':date_min_f' => $report->getDmin()
, ':date_max_f' => $report->getDmax()
- )
- );
+ ]
+ ];
}
return;
@@ -154,15 +154,15 @@ class module_report_sqlfilter
$f = $report->getTabFilter();
if (sizeof($f) > 0) {
- $filter = array();
- $params = array();
+ $filter = [];
+ $params = [];
$n = 0;
foreach ($f as $field => $value) {
if (array_key_exists($value['f'], $this->cor_query))
$value['f'] = $this->cor_query[$value['f']];
if ($value['o'] == 'LIKE') {
- $filter[] = $value['f'] . ' ' . $value['o'] . ' \'%' . str_replace(array("'", '%'), array("\'", '\%'), ' :user_filter' . $n) . '%\'';
+ $filter[] = $value['f'] . ' ' . $value['o'] . ' \'%' . str_replace(["'", '%'], ["\'", '\%'], ' :user_filter' . $n) . '%\'';
$params[':user_filter' . $n] = $value['v'];
} elseif ($value['o'] == 'OR') {
$filter[] = $value['f'] . ' ' . $value['o'] . ' :user_filter' . $n;
@@ -174,7 +174,7 @@ class module_report_sqlfilter
$n ++;
}
- $filter_user = array('sql' => implode(' AND ', $filter), 'params' => $params);
+ $filter_user = ['sql' => implode(' AND ', $filter), 'params' => $params];
$this->filter['user'] = $filter_user;
}
@@ -185,7 +185,7 @@ class module_report_sqlfilter
private function collectionFilter(module_report $report)
{
$this->filter['collection'] = false;
- $coll_filter = array();
+ $coll_filter = [];
if ($report->getUserId() == '') {
return;
@@ -201,7 +201,7 @@ class module_report_sqlfilter
}
}
- $this->filter['collection'] = array('sql' => ' (' . implode(' OR ', array_unique($coll_filter)) . ') ', 'params' => array());
+ $this->filter['collection'] = ['sql' => ' (' . implode(' OR ', array_unique($coll_filter)) . ') ', 'params' => []];
}
return;
@@ -210,7 +210,7 @@ class module_report_sqlfilter
private function recordFilter(module_report $report)
{
$this->filter['record'] = false;
- $dl_coll_filter = $params = array();
+ $dl_coll_filter = $params = [];
$n = 0;
if (($report->getUserId() != '')) {
$tab = explode(",", $report->getListCollId());
@@ -219,7 +219,7 @@ class module_report_sqlfilter
$params[":record_fil" . $n] = phrasea::collFromBas($this->app, $val);
$n ++;
}
- $this->filter['record'] = array('sql' => implode(' OR ', $dl_coll_filter), 'params' => $params);
+ $this->filter['record'] = ['sql' => implode(' OR ', $dl_coll_filter), 'params' => $params];
}
return;
diff --git a/lib/classes/module/report/sqlquestion.php b/lib/classes/module/report/sqlquestion.php
index d27d9298d8..dcf34510af 100644
--- a/lib/classes/module/report/sqlquestion.php
+++ b/lib/classes/module/report/sqlquestion.php
@@ -21,8 +21,8 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
public function buildSql()
{
- $filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
- $this->params = array_merge(array(), $filter['params']);
+ $filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
+ $this->params = array_merge([], $filter['params']);
if ($this->groupby == false) {
$this->sql ="
@@ -65,8 +65,8 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
public function sqlDistinctValByField($field)
{
- $filter = $this->filter->getReportFilter() ? : array('params' => array(), 'sql' => false);
- $this->params = array_merge(array(), $filter['params']);
+ $filter = $this->filter->getReportFilter() ? : ['params' => [], 'sql' => false];
+ $this->params = array_merge([], $filter['params']);
$this->sql = "
SELECT DISTINCT(tt.val)
@@ -79,6 +79,6 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
) as tt
ORDER BY tt.val ASC";
- return array('sql' => $this->sql, 'params' => $this->params);
+ return ['sql' => $this->sql, 'params' => $this->params];
}
}
diff --git a/lib/classes/module/report/validate.php b/lib/classes/module/report/validate.php
index c42de8ef12..19eca4d99a 100644
--- a/lib/classes/module/report/validate.php
+++ b/lib/classes/module/report/validate.php
@@ -13,7 +13,7 @@ use Alchemy\Phrasea\Application;
class module_report_validate extends module_report
{
- protected $cor_query = array(
+ protected $cor_query = [
'user' => 'log.user',
'site' => 'log.site',
'societe' => 'log.societe',
@@ -29,7 +29,7 @@ class module_report_validate extends module_report
'final' => 'd.final',
'comment' => 'd.comment',
'size' => 's.size'
- );
+ ];
/**
* constructor
@@ -72,7 +72,7 @@ class module_report_validate extends module_report
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $ret = array();
+ $ret = [];
foreach ($rs as $row) {
$value = $row['val'];
@@ -90,7 +90,7 @@ class module_report_validate extends module_report
$caption = p4string::format_octets($value);
}
- $ret[] = array('val' => $caption, 'value' => $value);
+ $ret[] = ['val' => $caption, 'value' => $value];
}
return $ret;
diff --git a/lib/classes/p4string.php b/lib/classes/p4string.php
index 7016f88ecd..b8aa6817ff 100644
--- a/lib/classes/p4string.php
+++ b/lib/classes/p4string.php
@@ -51,7 +51,7 @@ class p4string
$lastCharacter = substr($path, -1, 1);
- if ( ! in_array($lastCharacter, array('\\', '/'))) {
+ if ( ! in_array($lastCharacter, ['\\', '/'])) {
$path .= DIRECTORY_SEPARATOR;
}
@@ -90,7 +90,7 @@ class p4string
*/
public static function JSstring($s)
{
- return(str_replace(array("\\", "\"", "\r", "\n"), array("\\\\", "\\\"", "\\r", "\\n"), $s));
+ return(str_replace(["\\", "\"", "\r", "\n"], ["\\\\", "\\\"", "\\r", "\\n"], $s));
}
/**
@@ -104,42 +104,42 @@ class p4string
{
switch (mb_strtolower($context . '_' . $quoted)) {
case 'js_': // old method
- $s = str_replace(array("\\", "\"", "'", "\r", "\n"), array("\\\\", "\\\"", "\\'", "\\r", "\\n"), $s);
+ $s = str_replace(["\\", "\"", "'", "\r", "\n"], ["\\\\", "\\\"", "\\'", "\\r", "\\n"], $s);
break;
case 'js_"':
- $s = str_replace(array("\\", "\"", "\r", "\n"), array("\\\\", "\\\"", "\\r", "\\n"), $s);
+ $s = str_replace(["\\", "\"", "\r", "\n"], ["\\\\", "\\\"", "\\r", "\\n"], $s);
break;
case 'js_\'':
- $s = str_replace(array("\\", "'", "\r", "\n"), array("\\\\", "\\'", "\\r", "\\n"), $s);
+ $s = str_replace(["\\", "'", "\r", "\n"], ["\\\\", "\\'", "\\r", "\\n"], $s);
break;
case 'dquot_"':
- $s = str_replace(array("\\", "\"", "\r", "\n"), array("\\\\", "\\\"", "\\r", "\\n"), $s);
+ $s = str_replace(["\\", "\"", "\r", "\n"], ["\\\\", "\\\"", "\\r", "\\n"], $s);
break;
case 'squot_"':
- $s = str_replace(array("\\", "'", "\r", "\n"), array("\\\\", "\\'", "\\r", "\\n"), $s);
+ $s = str_replace(["\\", "'", "\r", "\n"], ["\\\\", "\\'", "\\r", "\\n"], $s);
break;
case 'html_': // old method
case 'html_\'':
case 'html_"':
- $s = str_replace(array("&", "<", ">", "\n"), array("&", "<", ">", "
\n"), $s);
+ $s = str_replace(["&", "<", ">", "\n"], ["&", "<", ">", "
\n"], $s);
break;
case 'htmlprop_':
- $s = str_replace(array("\"", "'", "<", ">"), array(""", "'", "<", ">"), $s);
+ $s = str_replace(["\"", "'", "<", ">"], [""", "'", "<", ">"], $s);
break;
case 'htmlprop_\'':
- $s = str_replace(array("'", "<", ">"), array("'", "<", ">"), $s);
+ $s = str_replace(["'", "<", ">"], ["'", "<", ">"], $s);
break;
case 'htmlprop_"':
- $s = str_replace(array("\"", "<", ">"), array(""", "<", ">"), $s);
+ $s = str_replace(["\"", "<", ">"], [""", "<", ">"], $s);
break;
case 'form_':
case 'form_\'': //
case 'form_"':
- $s = str_replace(array("&", "\"", "'", "<", ">"), array("&", """, "'", "<", ">"), $s);
+ $s = str_replace(["&", "\"", "'", "<", ">"], ["&", """, "'", "<", ">"], $s);
break;
case 'none_"':
diff --git a/lib/classes/patch/320alpha1a.php b/lib/classes/patch/320alpha1a.php
index 95e0c26ef5..b50520f006 100644
--- a/lib/classes/patch/320alpha1a.php
+++ b/lib/classes/patch/320alpha1a.php
@@ -29,7 +29,7 @@ class patch_320alpha1a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
*
diff --git a/lib/classes/patch/320alpha1b.php b/lib/classes/patch/320alpha1b.php
index cb64eb3bc7..051e23f804 100644
--- a/lib/classes/patch/320alpha1b.php
+++ b/lib/classes/patch/320alpha1b.php
@@ -28,7 +28,7 @@ class patch_320alpha1b implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
diff --git a/lib/classes/patch/320alpha2a.php b/lib/classes/patch/320alpha2a.php
index 5f20daa8db..a67a054af4 100644
--- a/lib/classes/patch/320alpha2a.php
+++ b/lib/classes/patch/320alpha2a.php
@@ -28,7 +28,7 @@ class patch_320alpha2a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
@@ -66,7 +66,7 @@ class patch_320alpha2a implements patchInterface
$stmt = $appbox->get_connection()->prepare($sql);
foreach ($rs as $row) {
$nonce = random::generatePassword(16);
- $params = array(':usr_id' => $row['usr_id'], ':nonce' => $nonce);
+ $params = [':usr_id' => $row['usr_id'], ':nonce' => $nonce];
$stmt->execute($params);
}
$stmt->closeCursor();
@@ -83,10 +83,10 @@ class patch_320alpha2a implements patchInterface
if (strpos($row['class'], 'task_period_') !== false)
continue;
- $params = array(
+ $params = [
':task_id' => $row['task_id']
, ':class' => str_replace('task_', 'task_period_', $row['class'])
- );
+ ];
$stmt->execute($params);
}
diff --git a/lib/classes/patch/320alpha3a.php b/lib/classes/patch/320alpha3a.php
index 4c016767bc..9fa14b3821 100644
--- a/lib/classes/patch/320alpha3a.php
+++ b/lib/classes/patch/320alpha3a.php
@@ -28,7 +28,7 @@ class patch_320alpha3a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
diff --git a/lib/classes/patch/320alpha4a.php b/lib/classes/patch/320alpha4a.php
index f700f39c8b..89d4118a50 100644
--- a/lib/classes/patch/320alpha4a.php
+++ b/lib/classes/patch/320alpha4a.php
@@ -28,7 +28,7 @@ class patch_320alpha4a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
*
@@ -70,7 +70,7 @@ class patch_320alpha4a implements patchInterface
$stmt->execute();
$stmt->closeCursor();
- $phrasea_maps = array(
+ $phrasea_maps = [
'pdftext' => 'Phraseanet:pdftext'
, 'tf-archivedate' => 'Phraseanet:tf-archivedate'
, 'tf-atime' => 'Phraseanet:tf-atime'
@@ -89,7 +89,7 @@ class patch_320alpha4a implements patchInterface
, 'tf-recordid' => 'Phraseanet:tf-recordid'
, 'tf-size' => 'Phraseanet:tf-size'
, 'tf-width' => 'Phraseanet:tf-width'
- );
+ ];
$sxe = $databox->get_sxml_structure();
$dom_struct = $databox->get_dom_structure();
diff --git a/lib/classes/patch/320alpha4b.php b/lib/classes/patch/320alpha4b.php
index 2526da5577..1018ea50cc 100644
--- a/lib/classes/patch/320alpha4b.php
+++ b/lib/classes/patch/320alpha4b.php
@@ -34,7 +34,7 @@ class patch_320alpha4b implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
@@ -61,7 +61,7 @@ class patch_320alpha4b implements patchInterface
public function apply(base $appbox, Application $app)
{
- $feeds = array();
+ $feeds = [];
try {
$sql = 'ALTER TABLE `ssel` ADD `migrated` INT NOT NULL DEFAULT "0"';
@@ -118,7 +118,7 @@ class patch_320alpha4b implements patchInterface
$sql = 'SELECT sselcont_id, ssel_id, base_id, record_id
FROM sselcont WHERE ssel_id = :ssel_id ORDER BY ord ASC';
$stmt = $appbox->get_connection()->prepare($sql);
- $stmt->execute(array(':ssel_id' => $row['ssel_id']));
+ $stmt->execute([':ssel_id' => $row['ssel_id']]);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -141,7 +141,7 @@ class patch_320alpha4b implements patchInterface
$sql = 'UPDATE ssel SET deleted = "1", migrated="1"
WHERE ssel_id = :ssel_id';
$stmt = $appbox->get_connection()->prepare($sql);
- $stmt->execute(array(':ssel_id' => $row['ssel_id']));
+ $stmt->execute([':ssel_id' => $row['ssel_id']]);
$stmt->closeCursor();
$app['EM']->persist($feed);
$n++;
@@ -169,7 +169,7 @@ class patch_320alpha4b implements patchInterface
return;
}
- protected static $feeds = array();
+ protected static $feeds = [];
protected function get_feed(appbox $appbox, User_Adapter $user, $pub_restrict, $homelink, Application $app)
{
diff --git a/lib/classes/patch/320alpha5a.php b/lib/classes/patch/320alpha5a.php
index f507659c73..38d516e2a3 100644
--- a/lib/classes/patch/320alpha5a.php
+++ b/lib/classes/patch/320alpha5a.php
@@ -28,7 +28,7 @@ class patch_320alpha5a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
@@ -67,10 +67,10 @@ class patch_320alpha5a implements patchInterface
$stmt = $appbox->get_connection()->prepare($sql);
foreach ($rs as $row) {
- $params = array(
+ $params = [
':base_id' => $row['base_id'],
':usr_id' => $row['usr_id']
- );
+ ];
$stmt->execute($params);
}
diff --git a/lib/classes/patch/320alpha6a.php b/lib/classes/patch/320alpha6a.php
index 3e4e45fd86..878b40f6de 100644
--- a/lib/classes/patch/320alpha6a.php
+++ b/lib/classes/patch/320alpha6a.php
@@ -28,7 +28,7 @@ class patch_320alpha6a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
*
diff --git a/lib/classes/patch/320alpha8a.php b/lib/classes/patch/320alpha8a.php
index 7ec5f3423a..0b6a404c64 100644
--- a/lib/classes/patch/320alpha8a.php
+++ b/lib/classes/patch/320alpha8a.php
@@ -28,7 +28,7 @@ class patch_320alpha8a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
diff --git a/lib/classes/patch/360alpha1a.php b/lib/classes/patch/360alpha1a.php
index f28e2eddad..c7fb59eca0 100644
--- a/lib/classes/patch/360alpha1a.php
+++ b/lib/classes/patch/360alpha1a.php
@@ -28,7 +28,7 @@ class patch_360alpha1a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
@@ -55,7 +55,7 @@ class patch_360alpha1a implements patchInterface
public function apply(base $appbox, Application $app)
{
- $tables = array('StoryWZ', 'ValidationDatas', 'ValidationParticipants', 'ValidationSessions', 'BasketElements', 'Baskets');
+ $tables = ['StoryWZ', 'ValidationDatas', 'ValidationParticipants', 'ValidationSessions', 'BasketElements', 'Baskets'];
foreach ($tables as $table) {
$sql = 'DELETE FROM ' . $table;
@@ -64,7 +64,7 @@ class patch_360alpha1a implements patchInterface
$stmt->closeCursor();
}
- $stories = array();
+ $stories = [];
$sql = 'SELECT sbas_id, rid as record_id, usr_id
FROM ssel
@@ -75,7 +75,7 @@ class patch_360alpha1a implements patchInterface
$rs_s = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $current = array();
+ $current = [];
foreach ($rs_s as $row_story) {
$serial = $row_story['sbas_id'] . '_' . $row_story['usr_id'] . '_' . $row_story['record_id'];
@@ -93,11 +93,11 @@ class patch_360alpha1a implements patchInterface
$stmt = $appbox->get_connection()->prepare($sql);
foreach ($stories as $row) {
- $params = array(
+ $params = [
':usr_id' => $row['usr_id'],
':sbas_id' => $row['sbas_id'],
':record_id' => $row['record_id']
- );
+ ];
$stmt->execute($params);
}
@@ -133,7 +133,7 @@ class patch_360alpha1a implements patchInterface
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $sselcont_ids = array();
+ $sselcont_ids = [];
foreach ($rs as $row) {
$sql = 'SELECT c.sselcont_id, c.record_id, b.sbas_id
@@ -142,11 +142,11 @@ class patch_360alpha1a implements patchInterface
AND c.ssel_id = :ssel_id AND s.ssel_id = c.ssel_id';
$stmt = $appbox->get_connection()->prepare($sql);
- $stmt->execute(array(':ssel_id' => $row['ssel_id']));
+ $stmt->execute([':ssel_id' => $row['ssel_id']]);
$rs_be = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $current = array();
+ $current = [];
foreach ($rs_be as $row_sselcont) {
$serial = $row_sselcont['sbas_id'] . '_' . $row_sselcont['record_id'];
@@ -163,7 +163,7 @@ class patch_360alpha1a implements patchInterface
$stmt = $appbox->get_connection()->prepare($sql);
foreach ($sselcont_ids as $sselcont_id) {
- $stmt->execute(array(':sselcont_id' => $sselcont_id));
+ $stmt->execute([':sselcont_id' => $sselcont_id]);
}
$stmt->closeCursor();
@@ -231,11 +231,11 @@ class patch_360alpha1a implements patchInterface
)';
$stmt = $appbox->get_connection()->prepare($sql);
foreach ($rs as $row) {
- $params = array(
+ $params = [
':participant_id' => $row['participant_id'],
':basket_id' => $row['basket_id'],
':usr_id' => $row['usr_id'],
- );
+ ];
$stmt->execute($params);
}
diff --git a/lib/classes/patch/360alpha1b.php b/lib/classes/patch/360alpha1b.php
index 7e07492d23..09009c2d8d 100644
--- a/lib/classes/patch/360alpha1b.php
+++ b/lib/classes/patch/360alpha1b.php
@@ -28,7 +28,7 @@ class patch_360alpha1b implements patchInterface
*
* @var Array
*/
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
*
diff --git a/lib/classes/patch/360alpha2a.php b/lib/classes/patch/360alpha2a.php
index c1ae020ae3..dd8893ff69 100644
--- a/lib/classes/patch/360alpha2a.php
+++ b/lib/classes/patch/360alpha2a.php
@@ -28,7 +28,7 @@ class patch_360alpha2a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
diff --git a/lib/classes/patch/360alpha2b.php b/lib/classes/patch/360alpha2b.php
index 61db6a32b8..20480fec22 100644
--- a/lib/classes/patch/360alpha2b.php
+++ b/lib/classes/patch/360alpha2b.php
@@ -28,7 +28,7 @@ class patch_360alpha2b implements patchInterface
*
* @var Array
*/
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
*
@@ -117,7 +117,7 @@ class patch_360alpha2b implements patchInterface
VALUES (null, :record_id, :meta_struct_id, :value)';
$stmt = $databox->get_connection()->prepare($sql);
- $databox_fields = array();
+ $databox_fields = [];
foreach ($rs as $row) {
$meta_struct_id = $row['meta_struct_id'];
@@ -129,11 +129,11 @@ class patch_360alpha2b implements patchInterface
$values = \caption_field::get_multi_values($row['value'], $databox_fields[$meta_struct_id]->get_separator());
foreach ($values as $value) {
- $params = array(
+ $params = [
':record_id' => $row['record_id'],
':meta_struct_id' => $row['meta_struct_id'],
':value' => $value,
- );
+ ];
$stmt->execute($params);
}
}
@@ -144,7 +144,7 @@ class patch_360alpha2b implements patchInterface
$stmt = $databox->get_connection()->prepare($sql);
foreach ($rs as $row) {
- $params = array(':id' => $row['id']);
+ $params = [':id' => $row['id']];
$stmt->execute($params);
}
diff --git a/lib/classes/patch/361alpha1a.php b/lib/classes/patch/361alpha1a.php
index baba8b4121..4fa4563196 100644
--- a/lib/classes/patch/361alpha1a.php
+++ b/lib/classes/patch/361alpha1a.php
@@ -29,7 +29,7 @@ class patch_361alpha1a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
@@ -77,7 +77,7 @@ class patch_361alpha1a implements patchInterface
$sql = 'SELECT record_id FROM record WHERE record_id = :record_id';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $row['record_id']));
+ $stmt->execute([':record_id' => $row['record_id']]);
$rowCount = $stmt->rowCount();
$stmt->closeCursor();
diff --git a/lib/classes/patch/370alpha1a.php b/lib/classes/patch/370alpha1a.php
index 1c13bcb4c1..86c29a004a 100644
--- a/lib/classes/patch/370alpha1a.php
+++ b/lib/classes/patch/370alpha1a.php
@@ -28,7 +28,7 @@ class patch_370alpha1a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
*
@@ -84,7 +84,7 @@ class patch_370alpha1a implements patchInterface
$sql = 'UPDATE pref SET value = :structure WHERE prop = "structure"';
$stmt = $conn->prepare($sql);
- $stmt->execute(array(':structure' => $DOMDocument->saveXML()));
+ $stmt->execute([':structure' => $DOMDocument->saveXML()]);
$stmt->closeCursor();
return true;
diff --git a/lib/classes/patch/370alpha3a.php b/lib/classes/patch/370alpha3a.php
index 849e7352a8..e4c744dfcd 100644
--- a/lib/classes/patch/370alpha3a.php
+++ b/lib/classes/patch/370alpha3a.php
@@ -29,7 +29,7 @@ class patch_370alpha3a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
diff --git a/lib/classes/patch/370alpha4a.php b/lib/classes/patch/370alpha4a.php
index 1f2c165006..755791348b 100644
--- a/lib/classes/patch/370alpha4a.php
+++ b/lib/classes/patch/370alpha4a.php
@@ -28,7 +28,7 @@ class patch_370alpha4a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
*
@@ -62,7 +62,7 @@ class patch_370alpha4a implements patchInterface
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $update = array();
+ $update = [];
$tagDirname = new \Alchemy\Phrasea\Metadata\Tag\TfDirname();
$tagBasename = new \Alchemy\Phrasea\Metadata\Tag\TfBasename();
@@ -70,10 +70,10 @@ class patch_370alpha4a implements patchInterface
foreach ($rs as $row) {
if (strpos(strtolower($row['src']), 'tf-parentdir') !== false) {
- $update[] = array('id' => $row['id'], 'src' => $tagDirname->getTagname());
+ $update[] = ['id' => $row['id'], 'src' => $tagDirname->getTagname()];
}
if (strpos(strtolower($row['src']), 'tf-filename') !== false) {
- $update[] = array('id' => $row['id'], 'src' => $tagBasename->getTagname());
+ $update[] = ['id' => $row['id'], 'src' => $tagBasename->getTagname()];
}
}
@@ -81,7 +81,7 @@ class patch_370alpha4a implements patchInterface
$stmt = $databox->get_connection()->prepare($sql);
foreach ($update as $row) {
- $stmt->execute(array(':src' => $row['src'], ':id' => $row['id']));
+ $stmt->execute([':src' => $row['src'], ':id' => $row['id']]);
}
$stmt->closeCursor();
diff --git a/lib/classes/patch/370alpha5a.php b/lib/classes/patch/370alpha5a.php
index c31ca080a2..aa31ffcd10 100644
--- a/lib/classes/patch/370alpha5a.php
+++ b/lib/classes/patch/370alpha5a.php
@@ -28,7 +28,7 @@ class patch_370alpha5a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
*
@@ -62,20 +62,20 @@ class patch_370alpha5a implements patchInterface
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $update = array();
+ $update = [];
foreach ($rs as $row) {
$src = str_replace(
- array('/rdf:RDF/rdf:Description/PHRASEANET:', '/rdf:RDF/rdf:Description/'), array('Phraseanet:', ''), $row['src']
+ ['/rdf:RDF/rdf:Description/PHRASEANET:', '/rdf:RDF/rdf:Description/'], ['Phraseanet:', ''], $row['src']
);
- $update[] = array('id' => $row['id'], 'src' => $src);
+ $update[] = ['id' => $row['id'], 'src' => $src];
}
$sql = 'UPDATE metadatas_structure SET src = :src WHERE id = :id';
$stmt = $databox->get_connection()->prepare($sql);
foreach ($update as $row) {
- $stmt->execute(array(':src' => $row['src'], ':id' => $row['id']));
+ $stmt->execute([':src' => $row['src'], ':id' => $row['id']]);
}
$stmt->closeCursor();
diff --git a/lib/classes/patch/370alpha6a.php b/lib/classes/patch/370alpha6a.php
index 165349f8ee..0d80e5d2d3 100644
--- a/lib/classes/patch/370alpha6a.php
+++ b/lib/classes/patch/370alpha6a.php
@@ -28,7 +28,7 @@ class patch_370alpha6a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
*
@@ -80,7 +80,7 @@ class patch_370alpha6a implements patchInterface
$this->addScreenDeviceOption($subdefgroups, $subdef, $groupname);
- if (in_array($name, array('preview', 'thumbnail'))) {
+ if (in_array($name, ['preview', 'thumbnail'])) {
if ($name == 'thumbnail' || $subdef->getSubdefType()->getType() != \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO) {
$this->addMobileSubdefImage($subdefgroups, $subdef, $groupname);
@@ -104,7 +104,7 @@ class patch_370alpha6a implements patchInterface
{
$optionsSubdef = $subdef->getOptions();
- $options = array();
+ $options = [];
foreach ($optionsSubdef as $optname => $option) {
$options[$optname] = $option->getValue();
@@ -113,19 +113,19 @@ class patch_370alpha6a implements patchInterface
$options['path'] = $subdef->get_path();
$options['mediatype'] = $subdef->getSubdefType()->getType();
$options['meta'] = $subdef->meta_writeable() ? 'yes' : 'no';
- $options['devices'] = array(databox_subdef::DEVICE_SCREEN);
+ $options['devices'] = [databox_subdef::DEVICE_SCREEN];
- $root->set_subdef($groupname, $subdef->get_name(), $subdef->get_class(), $subdef->is_downloadable(), $options, array());
+ $root->set_subdef($groupname, $subdef->get_name(), $subdef->get_class(), $subdef->is_downloadable(), $options, []);
}
protected function addMobileSubdefVideo($root, $baseSubdef, $groupname)
{
- $newSubdefOptionsWebM = $newSubdefOptionsOgg = $newSubdefOptionsX264 = array(
+ $newSubdefOptionsWebM = $newSubdefOptionsOgg = $newSubdefOptionsX264 = [
'path' => $baseSubdef->get_path(),
'mediatype' => \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO
- );
+ ];
- $options = array(
+ $options = [
'path' => $baseSubdef->get_path(),
'mediatype' => \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO,
'bitrate' => '300',
@@ -133,8 +133,8 @@ class patch_370alpha6a implements patchInterface
'GOPsize' => '25',
'size' => '480',
'fps' => '15',
- 'devices' => array(databox_subdef::DEVICE_HANDHELD),
- );
+ 'devices' => [databox_subdef::DEVICE_HANDHELD],
+ ];
foreach ($options as $name => $value) {
$newSubdefOptionsWebM[$name] = $value;
@@ -151,14 +151,14 @@ class patch_370alpha6a implements patchInterface
$newSubdefOptionsX264['acodec'] = 'libvo_aacenc';
$newSubdefOptionsX264['vcodec'] = 'libx264';
- $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_webM', $baseSubdef->get_class(), false, $newSubdefOptionsWebM, array());
- $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg, array());
- $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_X264', $baseSubdef->get_class(), false, $newSubdefOptionsX264, array());
+ $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_webM', $baseSubdef->get_class(), false, $newSubdefOptionsWebM, []);
+ $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg, []);
+ $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_X264', $baseSubdef->get_class(), false, $newSubdefOptionsX264, []);
}
protected function addMobileSubdefImage($root, $baseSubdef, $groupname)
{
- $optionMobile = array();
+ $optionMobile = [];
$optionMobile['size'] = $baseSubdef->get_name() == 'thumbnail' ? '150' : '480';
$optionMobile['resolution'] = '72';
@@ -168,18 +168,18 @@ class patch_370alpha6a implements patchInterface
$optionMobile['mediatype'] = \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_IMAGE;
$optionMobile['meta'] = 'no';
- $optionMobile['devices'] = array(databox_subdef::DEVICE_HANDHELD);
+ $optionMobile['devices'] = [databox_subdef::DEVICE_HANDHELD];
- $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile', $baseSubdef->get_class(), false, $optionMobile, array());
+ $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile', $baseSubdef->get_class(), false, $optionMobile, []);
}
protected function addHtml5Video($root, $baseSubdef, $groupname)
{
- $newSubdefOptionsWebM = $newSubdefOptionsOgg = array(
+ $newSubdefOptionsWebM = $newSubdefOptionsOgg = [
'path' => $baseSubdef->get_path(),
'mediatype' => \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO,
- 'devices' => array(\databox_subdef::DEVICE_SCREEN)
- );
+ 'devices' => [\databox_subdef::DEVICE_SCREEN]
+ ];
foreach ($baseSubdef->getOptions() as $optionname => $option) {
$newSubdefOptionsWebM[$optionname] = $option->getValue();
@@ -192,7 +192,7 @@ class patch_370alpha6a implements patchInterface
$newSubdefOptionsOgg['vcodec'] = 'libtheora';
$newSubdefOptionsOgg['acodec'] = 'libvorbis';
- $root->set_subdef($groupname, $baseSubdef->get_name() . '_webM', $baseSubdef->get_class(), false, $newSubdefOptionsWebM, array());
- $root->set_subdef($groupname, $baseSubdef->get_name() . '_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg, array());
+ $root->set_subdef($groupname, $baseSubdef->get_name() . '_webM', $baseSubdef->get_class(), false, $newSubdefOptionsWebM, []);
+ $root->set_subdef($groupname, $baseSubdef->get_name() . '_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg, []);
}
}
diff --git a/lib/classes/patch/370alpha7a.php b/lib/classes/patch/370alpha7a.php
index 2a6a1a8875..a34f3e247c 100644
--- a/lib/classes/patch/370alpha7a.php
+++ b/lib/classes/patch/370alpha7a.php
@@ -32,7 +32,7 @@ class patch_370alpha7a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
diff --git a/lib/classes/patch/370alpha8a.php b/lib/classes/patch/370alpha8a.php
index d2786e8ad6..e4c714712e 100644
--- a/lib/classes/patch/370alpha8a.php
+++ b/lib/classes/patch/370alpha8a.php
@@ -29,7 +29,7 @@ class patch_370alpha8a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
@@ -65,7 +65,7 @@ class patch_370alpha8a implements patchInterface
*/
public function apply(base $appbox, Application $app)
{
- $ttasks = array();
+ $ttasks = [];
$conn = $appbox->get_connection();
$sql = 'SELECT task_id, active, name, class, settings FROM task2 WHERE class=\'task_period_workflow01\'';
if (($stmt = $conn->prepare($sql)) !== FALSE) {
@@ -74,11 +74,11 @@ class patch_370alpha8a implements patchInterface
$stmt->closeCursor();
}
- $tdom = array(); // key = period
- $taskstodel = array();
+ $tdom = []; // key = period
+ $taskstodel = [];
foreach ($ttasks as $task) {
$active = true;
- $warning = array();
+ $warning = [];
/*
* migrating task 'workflow01'
@@ -95,7 +95,7 @@ class patch_370alpha8a implements patchInterface
$ts->appendChild($dom->createElement('period'))->appendChild($dom->createTextNode(60 * $period));
$ts->appendChild($dom->createElement('logsql'))->appendChild($dom->createTextNode('1'));
$tasks = $ts->appendChild($dom->createElement('tasks'));
- $tdom['_' . $period] = array('dom' => $dom, 'tasks' => $tasks);
+ $tdom['_' . $period] = ['dom' => $dom, 'tasks' => $tasks];
} else {
$dom = &$tdom['_' . $period]['dom'];
$tasks = &$tdom['_' . $period]['tasks'];
diff --git a/lib/classes/patch/370alpha9a.php b/lib/classes/patch/370alpha9a.php
index bfe9d95965..802da59f3e 100644
--- a/lib/classes/patch/370alpha9a.php
+++ b/lib/classes/patch/370alpha9a.php
@@ -28,7 +28,7 @@ class patch_370alpha9a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
diff --git a/lib/classes/patch/3715alpha1a.php b/lib/classes/patch/3715alpha1a.php
index 5dff067890..15590a63d9 100644
--- a/lib/classes/patch/3715alpha1a.php
+++ b/lib/classes/patch/3715alpha1a.php
@@ -23,7 +23,7 @@ class patch_3715alpha1a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
diff --git a/lib/classes/patch/371alpha1a.php b/lib/classes/patch/371alpha1a.php
index fff51b8ae3..4065052db1 100644
--- a/lib/classes/patch/371alpha1a.php
+++ b/lib/classes/patch/371alpha1a.php
@@ -28,7 +28,7 @@ class patch_371alpha1a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
*
diff --git a/lib/classes/patch/373alpha1a.php b/lib/classes/patch/373alpha1a.php
index f9f6e0d0a3..26958e1a0f 100644
--- a/lib/classes/patch/373alpha1a.php
+++ b/lib/classes/patch/373alpha1a.php
@@ -28,7 +28,7 @@ class patch_373alpha1a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
@@ -62,7 +62,7 @@ class patch_373alpha1a implements patchInterface
$sql = 'SELECT * FROM registry WHERE `key` = :key';
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
- $Regbinaries = array(
+ $Regbinaries = [
'GV_cli',
'GV_swf_extract',
'GV_pdf2swf',
@@ -72,9 +72,9 @@ class patch_373alpha1a implements patchInterface
'GV_ffprobe',
'GV_mp4box',
'GV_pdftotext',
- );
+ ];
- $mapping = array(
+ $mapping = [
'GV_cli' => 'php_binary',
'GV_swf_extract' => 'swf_extract_binary',
'GV_pdf2swf' => 'pdf2swf_binary',
@@ -84,12 +84,12 @@ class patch_373alpha1a implements patchInterface
'GV_ffprobe' => 'ffprobe_binary',
'GV_mp4box' => 'mp4box_binary',
'GV_pdftotext' => 'pdftotext_binary',
- );
+ ];
- $binaries = array('ghostscript_binary' => null);
+ $binaries = ['ghostscript_binary' => null];
foreach ($Regbinaries as $name) {
- $stmt->execute(array(':key' => $name));
+ $stmt->execute([':key' => $name]);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
$value = is_executable($row['value']) ? $row['value'] : null;
@@ -105,14 +105,14 @@ class patch_373alpha1a implements patchInterface
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
foreach ($Regbinaries as $name) {
- $stmt->execute(array(':key' => $name));
+ $stmt->execute([':key' => $name]);
}
$stmt->closeCursor();
$sql = 'SELECT value FROM registry WHERE `key` = :key';
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
- $stmt->execute(array(':key'=>'GV_sit'));
+ $stmt->execute([':key'=>'GV_sit']);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -122,7 +122,7 @@ class patch_373alpha1a implements patchInterface
$sql = 'DELETE FROM registry WHERE `key` = :key';
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
- $stmt->execute(array(':key'=>'GV_sit'));
+ $stmt->execute([':key'=>'GV_sit']);
$stmt->closeCursor();
return true;
diff --git a/lib/classes/patch/379alpha1a.php b/lib/classes/patch/379alpha1a.php
index f5e04ee247..ae8081c36f 100644
--- a/lib/classes/patch/379alpha1a.php
+++ b/lib/classes/patch/379alpha1a.php
@@ -23,7 +23,7 @@ class patch_379alpha1a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
*
diff --git a/lib/classes/patch/380alpha10a.php b/lib/classes/patch/380alpha10a.php
index 0a77d138fe..86d24c1104 100644
--- a/lib/classes/patch/380alpha10a.php
+++ b/lib/classes/patch/380alpha10a.php
@@ -17,7 +17,7 @@ class patch_380alpha10a implements patchInterface
private $release = '3.8.0-alpha.10';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
@@ -58,10 +58,10 @@ class patch_380alpha10a implements patchInterface
$stmt = $appbox->get_connection()->prepare($sql);
foreach ($rs as $row) {
- $stmt->execute(array(
+ $stmt->execute([
':usage' => strip_tags($row['usage']),
':id' => $row['id'],
- ));
+ ]);
}
$stmt->closeCursor();
diff --git a/lib/classes/patch/380alpha11a.php b/lib/classes/patch/380alpha11a.php
index a6390d38a9..fce0e78819 100644
--- a/lib/classes/patch/380alpha11a.php
+++ b/lib/classes/patch/380alpha11a.php
@@ -19,7 +19,7 @@ class patch_380alpha11a implements patchInterface
private $release = '3.8.0-alpha.11';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/380alpha13a.php b/lib/classes/patch/380alpha13a.php
index 05034de70c..3c71683878 100644
--- a/lib/classes/patch/380alpha13a.php
+++ b/lib/classes/patch/380alpha13a.php
@@ -17,7 +17,7 @@ class patch_380alpha13a implements patchInterface
private $release = '3.8.0-alpha.13';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
@@ -59,22 +59,22 @@ class patch_380alpha13a implements patchInterface
$config['xsendfile']['type'] = $config['xsendfile']['enabled'] ? 'nginx' : '';
if (null !== $xsendfilePath && null !== $xsendfileMountPoint) {
- $config['xsendfile']['mapping'] = array(array(
+ $config['xsendfile']['mapping'] = [[
'directory' => $xsendfilePath,
'mount-point' => $xsendfileMountPoint,
- ));
+ ]];
}
$app['configuration']->setConfig($config);
- $toRemove = array('GV_X_Accel_Redirect', 'GV_X_Accel_Redirect_mount_point', 'GV_modxsendfile');
+ $toRemove = ['GV_X_Accel_Redirect', 'GV_X_Accel_Redirect_mount_point', 'GV_modxsendfile'];
$sql = 'DELETE FROM registry WHERE `key` = :k';
$stmt = $appbox->get_connection()->prepare($sql);
foreach ($toRemove as $registryKey) {
- $stmt->execute(array(
+ $stmt->execute([
':k' => $registryKey
- ));
+ ]);
}
$stmt->closeCursor();
diff --git a/lib/classes/patch/380alpha14a.php b/lib/classes/patch/380alpha14a.php
index c138ec7cd1..b94ce3235f 100644
--- a/lib/classes/patch/380alpha14a.php
+++ b/lib/classes/patch/380alpha14a.php
@@ -17,7 +17,7 @@ class patch_380alpha14a implements patchInterface
private $release = '3.8.0-alpha.14';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/380alpha15a.php b/lib/classes/patch/380alpha15a.php
index 1854a3bb5a..8a541c8b6f 100644
--- a/lib/classes/patch/380alpha15a.php
+++ b/lib/classes/patch/380alpha15a.php
@@ -17,7 +17,7 @@ class patch_380alpha15a implements patchInterface
private $release = '3.8.0-alpha.15';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/380alpha16a.php b/lib/classes/patch/380alpha16a.php
index 5ac1ebadcc..33b54816a6 100644
--- a/lib/classes/patch/380alpha16a.php
+++ b/lib/classes/patch/380alpha16a.php
@@ -17,7 +17,7 @@ class patch_380alpha16a implements patchInterface
private $release = '3.8.0-alpha.16';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
@@ -51,17 +51,17 @@ class patch_380alpha16a implements patchInterface
$xsendfile = $app['configuration']['xsendfile'];
if (!isset($xsendfile['mapping'])) {
- $xsendfile['mapping'] = array();
+ $xsendfile['mapping'] = [];
}
- $xsendfile['mapping'][] = array(
+ $xsendfile['mapping'][] = [
'directory' => $app['root.path'] . '/tmp/lazaret/',
'mount-point' => '/lazaret/',
- );
- $xsendfile['mapping'][] = array(
+ ];
+ $xsendfile['mapping'][] = [
'directory' => $app['root.path'] . '/tmp/download/',
'mount-point' => '/download/',
- );
+ ];
$app['configuration']['xsendfile'] = $xsendfile;
diff --git a/lib/classes/patch/380alpha17a.php b/lib/classes/patch/380alpha17a.php
index 250344d209..810373e371 100644
--- a/lib/classes/patch/380alpha17a.php
+++ b/lib/classes/patch/380alpha17a.php
@@ -17,7 +17,7 @@ class patch_380alpha17a implements patchInterface
private $release = '3.8.0-alpha.17';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/380alpha18a.php b/lib/classes/patch/380alpha18a.php
index 7a666d027b..11725c566e 100644
--- a/lib/classes/patch/380alpha18a.php
+++ b/lib/classes/patch/380alpha18a.php
@@ -18,7 +18,7 @@ class patch_380alpha18a implements patchInterface
private $release = '3.8.0-alpha.18';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/380alpha2a.php b/lib/classes/patch/380alpha2a.php
index 279422b470..327c2cc31b 100644
--- a/lib/classes/patch/380alpha2a.php
+++ b/lib/classes/patch/380alpha2a.php
@@ -28,7 +28,7 @@ class patch_380alpha2a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
diff --git a/lib/classes/patch/380alpha2b.php b/lib/classes/patch/380alpha2b.php
index a6a627a2c6..ffdb4def3f 100644
--- a/lib/classes/patch/380alpha2b.php
+++ b/lib/classes/patch/380alpha2b.php
@@ -28,7 +28,7 @@ class patch_380alpha2b implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
diff --git a/lib/classes/patch/380alpha3a.php b/lib/classes/patch/380alpha3a.php
index d31caa8c91..ce033d518e 100644
--- a/lib/classes/patch/380alpha3a.php
+++ b/lib/classes/patch/380alpha3a.php
@@ -29,7 +29,7 @@ class patch_380alpha3a implements patchInterface
*
* @var Array
*/
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
*
diff --git a/lib/classes/patch/380alpha3b.php b/lib/classes/patch/380alpha3b.php
index cc4fefc55b..94ec26f94c 100644
--- a/lib/classes/patch/380alpha3b.php
+++ b/lib/classes/patch/380alpha3b.php
@@ -29,7 +29,7 @@ class patch_380alpha3b implements patchInterface
*
* @var Array
*/
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
*
diff --git a/lib/classes/patch/380alpha4a.php b/lib/classes/patch/380alpha4a.php
index 8391adc65f..e256520661 100644
--- a/lib/classes/patch/380alpha4a.php
+++ b/lib/classes/patch/380alpha4a.php
@@ -18,7 +18,7 @@ class patch_380alpha4a implements patchInterface
private $release = '3.8.0-alpha.4';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/380alpha6a.php b/lib/classes/patch/380alpha6a.php
index 617658d7e1..e1c5f8db0e 100644
--- a/lib/classes/patch/380alpha6a.php
+++ b/lib/classes/patch/380alpha6a.php
@@ -17,7 +17,7 @@ class patch_380alpha6a implements patchInterface
private $release = '3.8.0-alpha.6';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/380alpha8a.php b/lib/classes/patch/380alpha8a.php
index 4772ba6d1a..8681218cfb 100644
--- a/lib/classes/patch/380alpha8a.php
+++ b/lib/classes/patch/380alpha8a.php
@@ -17,7 +17,7 @@ class patch_380alpha8a implements patchInterface
private $release = '3.8.0-alpha.8';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/380alpha9a.php b/lib/classes/patch/380alpha9a.php
index 1282b3f366..4fd9a97d8a 100644
--- a/lib/classes/patch/380alpha9a.php
+++ b/lib/classes/patch/380alpha9a.php
@@ -17,7 +17,7 @@ class patch_380alpha9a implements patchInterface
private $release = '3.8.0-alpha.9';
/** @var array */
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/381alpha1a.php b/lib/classes/patch/381alpha1a.php
index c8919b9fc3..47c01c5915 100644
--- a/lib/classes/patch/381alpha1a.php
+++ b/lib/classes/patch/381alpha1a.php
@@ -17,7 +17,7 @@ class patch_381alpha1a implements patchInterface
private $release = '3.8.1-alpha.1';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
@@ -56,13 +56,13 @@ class patch_381alpha1a implements patchInterface
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $sbasData = array();
+ $sbasData = [];
$sbas_id = null;
- $reorder = array();
+ $reorder = [];
foreach ($rs as $row) {
- $sbasData[$row['sbas_id']][] = array('base_id' => $row['base_id']);
+ $sbasData[$row['sbas_id']][] = ['base_id' => $row['base_id']];
if ($sbas_id !== $row['sbas_id']) {
- $orders = array();
+ $orders = [];
}
$sbas_id = $row['sbas_id'];
if (in_array($row['ord'], $orders, true)) {
@@ -78,7 +78,7 @@ class patch_381alpha1a implements patchInterface
foreach ($reorder as $sbas_id) {
$i = 1;
foreach ($sbasData[$sbas_id] as $data) {
- $stmt->execute(array('base_id' => $data['base_id'], 'ord' => $i++));
+ $stmt->execute(['base_id' => $data['base_id'], 'ord' => $i++]);
}
}
$stmt->closeCursor();
diff --git a/lib/classes/patch/381alpha1b.php b/lib/classes/patch/381alpha1b.php
index 793c93a38f..921f83b257 100644
--- a/lib/classes/patch/381alpha1b.php
+++ b/lib/classes/patch/381alpha1b.php
@@ -17,7 +17,7 @@ class patch_381alpha1b implements patchInterface
private $release = '3.8.1-alpha.1';
/** @var array */
- private $concern = array(base::DATA_BOX);
+ private $concern = [base::DATA_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/381alpha2a.php b/lib/classes/patch/381alpha2a.php
index 73ba680e32..06ae412c32 100644
--- a/lib/classes/patch/381alpha2a.php
+++ b/lib/classes/patch/381alpha2a.php
@@ -17,7 +17,7 @@ class patch_381alpha2a implements patchInterface
private $release = '3.8.1-alpha.2';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/381alpha3a.php b/lib/classes/patch/381alpha3a.php
index 4d391c529c..26fcc42673 100644
--- a/lib/classes/patch/381alpha3a.php
+++ b/lib/classes/patch/381alpha3a.php
@@ -17,7 +17,7 @@ class patch_381alpha3a implements patchInterface
private $release = '3.8.1-alpha.3';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
@@ -48,7 +48,7 @@ class patch_381alpha3a implements patchInterface
*/
public function apply(base $appbox, Application $app)
{
- $propSql = $propArgs = array();
+ $propSql = $propArgs = [];
$n = 0;
foreach (\User_Adapter::$def_values as $prop => $value) {
diff --git a/lib/classes/patch/381alpha4a.php b/lib/classes/patch/381alpha4a.php
index ddc8c3f273..157c965829 100644
--- a/lib/classes/patch/381alpha4a.php
+++ b/lib/classes/patch/381alpha4a.php
@@ -17,7 +17,7 @@ class patch_381alpha4a implements patchInterface
private $release = '3.8.1-alpha.4';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
@@ -69,7 +69,7 @@ class patch_381alpha4a implements patchInterface
$value = substr($value, 0, -1);
}
- $stmt->execute(array(':value' => $value, ':usr_id' => $row['usr_id'], ':prop' => $row['prop']));
+ $stmt->execute([':value' => $value, ':usr_id' => $row['usr_id'], ':prop' => $row['prop']]);
}
$stmt->closeCursor();
diff --git a/lib/classes/patch/390alpha1a.php b/lib/classes/patch/390alpha1a.php
index b7f49420c4..013ad6d67f 100644
--- a/lib/classes/patch/390alpha1a.php
+++ b/lib/classes/patch/390alpha1a.php
@@ -18,7 +18,7 @@ class patch_390alpha1a implements patchInterface
private $release = '3.9.0-alpha.1';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/390alpha1b.php b/lib/classes/patch/390alpha1b.php
index faca65af83..247578c577 100644
--- a/lib/classes/patch/390alpha1b.php
+++ b/lib/classes/patch/390alpha1b.php
@@ -20,7 +20,7 @@ class patch_390alpha1b implements patchInterface
private $release = '3.9.0-alpha.1';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
@@ -76,7 +76,7 @@ class patch_390alpha1b implements patchInterface
$sql = 'SELECT count(id) as todo FROM order_elements WHERE deny = NULL AND order_id = :id';
$stmt = $conn->prepare($sql);
- $stmt->execute(array(':id' => $row['id']));
+ $stmt->execute([':id' => $row['id']]);
$todo = $stmt->fetch(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -94,7 +94,7 @@ class patch_390alpha1b implements patchInterface
FROM order_elements
WHERE order_id = :id';
$stmt = $conn->prepare($sql);
- $stmt->execute(array(':id' => $row['id']));
+ $stmt->execute([':id' => $row['id']]);
$elements = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
diff --git a/lib/classes/patch/390alpha2a.php b/lib/classes/patch/390alpha2a.php
index b236c93e54..297fdbb6ce 100644
--- a/lib/classes/patch/390alpha2a.php
+++ b/lib/classes/patch/390alpha2a.php
@@ -20,7 +20,7 @@ class patch_390alpha2a implements patchInterface
private $release = '3.9.0-alpha.2';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/390alpha3a.php b/lib/classes/patch/390alpha3a.php
index a1c8aadef4..e8b152d35d 100644
--- a/lib/classes/patch/390alpha3a.php
+++ b/lib/classes/patch/390alpha3a.php
@@ -18,7 +18,7 @@ class patch_390alpha3a implements patchInterface
private $release = '3.9.0-alpha.3';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/390alpha4a.php b/lib/classes/patch/390alpha4a.php
index 0b9d583b4c..cf7b918532 100644
--- a/lib/classes/patch/390alpha4a.php
+++ b/lib/classes/patch/390alpha4a.php
@@ -18,7 +18,7 @@ class patch_390alpha4a implements patchInterface
private $release = '3.9.0-alpha.4';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/390alpha5a.php b/lib/classes/patch/390alpha5a.php
index 8ea831e1c6..f46842e37d 100644
--- a/lib/classes/patch/390alpha5a.php
+++ b/lib/classes/patch/390alpha5a.php
@@ -18,7 +18,7 @@ class patch_390alpha5a implements patchInterface
private $release = '3.9.0-alpha.5';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patch/390alpha6a.php b/lib/classes/patch/390alpha6a.php
index 4c2b54669b..91baaf310b 100644
--- a/lib/classes/patch/390alpha6a.php
+++ b/lib/classes/patch/390alpha6a.php
@@ -20,7 +20,7 @@ class patch_390alpha6a implements patchInterface
private $release = '3.9.0-alpha.6';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
@@ -114,7 +114,7 @@ class patch_390alpha6a implements patchInterface
$em->persist($export);
- $stmt->execute(array('export_id' => $row['id']));
+ $stmt->execute(['export_id' => $row['id']]);
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
foreach ($rs as $element) {
diff --git a/lib/classes/patch/390alpha7a.php b/lib/classes/patch/390alpha7a.php
index 4af5ad9e3a..5c2fdeb583 100644
--- a/lib/classes/patch/390alpha7a.php
+++ b/lib/classes/patch/390alpha7a.php
@@ -23,7 +23,7 @@ class patch_390alpha7a implements patchInterface
private $release = '3.9.0-alpha.7';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
@@ -132,7 +132,7 @@ class patch_390alpha7a implements patchInterface
$feed->setUpdatedOn(new \DateTime($row['updated_on']));
$feed->setCollection($row['base_id'] ? collection::get_from_base_id($app, $row['base_id']) : null);
- $fpStmt->execute(array(':feed_id' => $row['id']));
+ $fpStmt->execute([':feed_id' => $row['id']]);
$fpRes = $fpStmt->fetchAll(\PDO::FETCH_ASSOC);
foreach ($fpRes as $fpRow) {
@@ -143,7 +143,7 @@ class patch_390alpha7a implements patchInterface
$feedPublisher->setIsOwner((Boolean) $fpRow['owner']);
$feedPublisher->setUsrId($fpRow['usr_id']);
- $feStmt->execute(array(':feed_id' => $row['id'], ':publisher_id' => $fpRow['id']));
+ $feStmt->execute([':feed_id' => $row['id'], ':publisher_id' => $fpRow['id']]);
$feRes = $feStmt->fetchAll(\PDO::FETCH_ASSOC);
foreach ($feRes as $feRow) {
@@ -158,7 +158,7 @@ class patch_390alpha7a implements patchInterface
$feedEntry->setCreatedOn(new \DateTime($feRow['created_on']));
$feedEntry->setUpdatedOn(new \DateTime($feRow['updated_on']));
- $fiStmt->execute(array(':entry_id' => $feRow['id']));
+ $fiStmt->execute([':entry_id' => $feRow['id']]);
$fiRes = $fiStmt->fetchAll(\PDO::FETCH_ASSOC);
foreach ($fiRes as $fiRow) {
@@ -176,7 +176,7 @@ class patch_390alpha7a implements patchInterface
$em->persist($feedPublisher);
}
- $ftStmt->execute(array(':feed_id' => $row['id']));
+ $ftStmt->execute([':feed_id' => $row['id']]);
$ftRes = $ftStmt->fetchAll(\PDO::FETCH_ASSOC);
foreach ($ftRes as $ftRow) {
diff --git a/lib/classes/patch/390alpha8a.php b/lib/classes/patch/390alpha8a.php
index d2fef15b04..7b9f137213 100644
--- a/lib/classes/patch/390alpha8a.php
+++ b/lib/classes/patch/390alpha8a.php
@@ -18,7 +18,7 @@ class patch_390alpha8a implements patchInterface
private $release = '3.9.0-alpha.8';
/** @var array */
- private $concern = array(base::APPLICATION_BOX);
+ private $concern = [base::APPLICATION_BOX];
/**
* {@inheritdoc}
diff --git a/lib/classes/patchthesaurus/100.php b/lib/classes/patchthesaurus/100.php
index 1e4ee8ed92..66e83d4a25 100644
--- a/lib/classes/patchthesaurus/100.php
+++ b/lib/classes/patchthesaurus/100.php
@@ -25,7 +25,7 @@ class patchthesaurus_100 implements patchthesaurus_interface
$te0 = $te->item(0);
$th->setAttribute("nextid", $te0->getAttribute("nextid"));
$te = $xp->query("te", $te0);
- $te1 = array();
+ $te1 = [];
for ($i = 0; $i < $te->length; $i ++) {
$te1[] = $te->item($i);
}
@@ -61,7 +61,7 @@ class patchthesaurus_100 implements patchthesaurus_interface
if ($tenode->getAttribute("nextid") == "")
$tenode->setAttribute("nextid", "0");
// $tenode->setAttribute("id", "0.".$tenode->getAttribute("id"));
- $todel = array();
+ $todel = [];
for ($n = $tenode->firstChild; $n; $n = $n->nextSibling) {
if ($n->nodeName == "ta")
$todel[] = $n;
diff --git a/lib/classes/patchthesaurus/202.php b/lib/classes/patchthesaurus/202.php
index 2b43a35229..c2d036d56c 100644
--- a/lib/classes/patchthesaurus/202.php
+++ b/lib/classes/patchthesaurus/202.php
@@ -29,7 +29,7 @@ class patchthesaurus_202 implements patchthesaurus_interface
$sql = "UPDATE pref SET thesaurus_moddate = :date1, cterms_moddate = :date2";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':date1' => $th->getAttribute("modification_date"), ':date2' => $ct->getAttribute("modification_date")));
+ $stmt->execute([':date1' => $th->getAttribute("modification_date"), ':date2' => $ct->getAttribute("modification_date")]);
$stmt->closeCursor();
$ct->setAttribute("version", $version = "2.0.3");
diff --git a/lib/classes/patchthesaurus/203.php b/lib/classes/patchthesaurus/203.php
index fc88598a59..16b17e3aa5 100644
--- a/lib/classes/patchthesaurus/203.php
+++ b/lib/classes/patchthesaurus/203.php
@@ -45,7 +45,7 @@ class patchthesaurus_203 implements patchthesaurus_interface
$xp = new DOMXPath($domct);
$nodes = $xp->query("//te[not(starts-with(@id, 'R')) and count(te[starts-with(@id, 'R')])=0]");
- $nodestodel = array();
+ $nodestodel = [];
for ($i = 0; $i < $nodes->length; $i ++ )
$nodestodel[] = $nodes->item($i);
$ctdel = 0;
@@ -53,7 +53,7 @@ class patchthesaurus_203 implements patchthesaurus_interface
$sql2 = "DELETE FROM thit WHERE value LIKE :like";
$stmt = $connbas->prepare($sql2);
- $stmt->execute(array(':like' => str_replace(".", "d", $node->getAttribute("id")) . "d%"));
+ $stmt->execute([':like' => str_replace(".", "d", $node->getAttribute("id")) . "d%"]);
$stmt->closeCursor();
$node->parentNode->removeChild($node);
@@ -115,7 +115,7 @@ class patchthesaurus_203 implements patchthesaurus_interface
$sql = "UPDATE thit SET value = :newid WHERE value = :oldid";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':newid' => $newid, ':oldid' => $id));
+ $stmt->execute([':newid' => $newid, ':oldid' => $id]);
$stmt->closeCursor();
}
}
@@ -144,7 +144,7 @@ class patchthesaurus_203 implements patchthesaurus_interface
$sql = "UPDATE thit SET value = :newid WHERE value = :oldid";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':newid' => $newid, ':oldid' => $id));
+ $stmt->execute([':newid' => $newid, ':oldid' => $id]);
$stmt->closeCursor();
}
}
diff --git a/lib/classes/patchthesaurus/204.php b/lib/classes/patchthesaurus/204.php
index 3719cee4c9..a949c79ead 100644
--- a/lib/classes/patchthesaurus/204.php
+++ b/lib/classes/patchthesaurus/204.php
@@ -45,7 +45,7 @@ class patchthesaurus_204 implements patchthesaurus_interface
$xp = new DOMXPath($domct);
$nodes = $xp->query("//te[not(starts-with(@id, 'R')) and count(te[starts-with(@id, 'R')])=0]");
- $nodestodel = array();
+ $nodestodel = [];
for ($i = 0; $i < $nodes->length; $i ++ )
$nodestodel[] = $nodes->item($i);
$ctdel = 0;
@@ -53,7 +53,7 @@ class patchthesaurus_204 implements patchthesaurus_interface
$sql2 = "DELETE FROM thit WHERE value LIKE :like";
$stmt = $connbas->prepare($sql2);
- $stmt->execute(array(':like' => str_replace(".", "d", $node->getAttribute("id")) . "d%"));
+ $stmt->execute([':like' => str_replace(".", "d", $node->getAttribute("id")) . "d%"]);
$stmt->closeCursor();
$node->parentNode->removeChild($node);
@@ -117,7 +117,7 @@ class patchthesaurus_204 implements patchthesaurus_interface
$sql = "UPDATE thit SET value = :newid WHERE value = :oldid";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':newid' => $newid, ':oldid' => $id));
+ $stmt->execute([':newid' => $newid, ':oldid' => $id]);
$stmt->closeCursor();
}
}
@@ -146,7 +146,7 @@ class patchthesaurus_204 implements patchthesaurus_interface
$sql = "UPDATE thit SET value = :newid WHERE value = :oldid";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':newid' => $newid, ':oldid' => $id));
+ $stmt->execute([':newid' => $newid, ':oldid' => $id]);
$stmt->closeCursor();
}
}
diff --git a/lib/classes/phrasea.php b/lib/classes/phrasea.php
index 911cbb4663..ed00b54ade 100644
--- a/lib/classes/phrasea.php
+++ b/lib/classes/phrasea.php
@@ -52,7 +52,7 @@ class phrasea
}
- self::$_sbas_params = array();
+ self::$_sbas_params = [];
$sql = 'SELECT sbas_id, host, port, user, pwd, dbname FROM sbas';
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
@@ -88,9 +88,9 @@ class phrasea
public static function modulesName($array_modules)
{
- $array = array();
+ $array = [];
- $modules = array(
+ $modules = [
1 => _('admin::monitor: module production'),
2 => _('admin::monitor: module client'),
3 => _('admin::monitor: module admin'),
@@ -99,7 +99,7 @@ class phrasea
6 => _('admin::monitor: module comparateur'),
7 => _('admin::monitor: module validation'),
8 => _('admin::monitor: module upload')
- );
+ ];
foreach ($array_modules as $a) {
if (isset($modules[$a]))
@@ -144,7 +144,7 @@ class phrasea
foreach ($rs as $row) {
if (!isset(self::$_coll2bas[$row['sbas_id']]))
- self::$_coll2bas[$row['sbas_id']] = array();
+ self::$_coll2bas[$row['sbas_id']] = [];
self::$_coll2bas[$row['sbas_id']][$row['server_coll_id']] = (int) $row['base_id'];
}
}
@@ -156,12 +156,12 @@ class phrasea
{
self::$_coll2bas = self::$_bas2coll = self::$_bas_labels = self::$_bas2sbas = null;
$appbox->delete_data_from_cache(
- array(
+ [
self::CACHE_BAS_2_COLL
, self::CACHE_BAS_2_COLL
, self::CACHE_BAS_LABELS
, self::CACHE_SBAS_FROM_BAS
- )
+ ]
);
return;
@@ -171,12 +171,12 @@ class phrasea
{
self::$_sbas_names = self::$_sbas_labels = self::$_sbas_params = self::$_bas2sbas = null;
$appbox->delete_data_from_cache(
- array(
+ [
self::CACHE_SBAS_NAMES,
self::CACHE_SBAS_LABELS,
self::CACHE_SBAS_FROM_BAS,
self::CACHE_SBAS_PARAMS,
- )
+ ]
);
return;
@@ -223,12 +223,12 @@ class phrasea
self::$_sbas_labels = $app['phraseanet.appbox']->get_data_from_cache(self::CACHE_SBAS_LABELS);
} catch (Exception $e) {
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
- self::$_sbas_labels[$databox->get_sbas_id()] = array(
+ self::$_sbas_labels[$databox->get_sbas_id()] = [
'fr' => $databox->get_label('fr'),
'en' => $databox->get_label('en'),
'de' => $databox->get_label('de'),
'nl' => $databox->get_label('nl'),
- );
+ ];
}
$app['phraseanet.appbox']->set_data_to_cache(self::$_sbas_labels, self::CACHE_SBAS_LABELS);
}
@@ -249,12 +249,12 @@ class phrasea
} catch (Exception $e) {
foreach ($app['phraseanet.appbox']->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) {
- self::$_bas_labels[$collection->get_base_id()] = array(
+ self::$_bas_labels[$collection->get_base_id()] = [
'fr' => $collection->get_label('fr'),
'en' => $collection->get_label('en'),
'de' => $collection->get_label('de'),
'nl' => $collection->get_label('nl'),
- );
+ ];
}
}
diff --git a/lib/classes/phraseadate.php b/lib/classes/phraseadate.php
index eeee52ae97..c8ac09b0df 100644
--- a/lib/classes/phraseadate.php
+++ b/lib/classes/phraseadate.php
@@ -180,8 +180,8 @@ class phraseadate
*/
public function isodateToDate($isodelimdate, $format)
{
- $tc = array();
- $bal = array();
+ $tc = [];
+ $bal = [];
$isodelimdate = trim($isodelimdate);
while ($isodelimdate != "") {
@@ -198,14 +198,14 @@ class phraseadate
$isodelimdate = "";
}
} else {
- $tc[] = array("char" => $c, "bals" => $bal);
+ $tc[] = ["char" => $c, "bals" => $bal];
$isodelimdate = substr($isodelimdate, 1);
}
}
$strdate = "";
- $paterns = array("YYYY" => 0, "YY" => 2, "MM" => 5,
- "DD" => 8, "HH" => 11, "NN" => 14, "SS" => 17);
+ $paterns = ["YYYY" => 0, "YY" => 2, "MM" => 5,
+ "DD" => 8, "HH" => 11, "NN" => 14, "SS" => 17];
while ($format != "") {
$patfound = false;
@@ -245,12 +245,12 @@ class phraseadate
{
$v_y = $v_m = $v_d = $v_h = $v_n = $v_s = 0;
$v = str_replace(
- array("-", ":", "/", "."), array(" ", " ", " ", " "), trim($strdate)
+ ["-", ":", "/", "."], [" ", " ", " ", " "], trim($strdate)
);
$n = 0;
$format = str_replace(
- array("-", ":", "/", "."), array(" ", " ", " ", " "), $format
+ ["-", ":", "/", "."], [" ", " ", " ", " "], $format
);
$isodelimdate = null;
switch ($format) {
diff --git a/lib/classes/queries.php b/lib/classes/queries.php
index d33fba4f75..f8c6165236 100644
--- a/lib/classes/queries.php
+++ b/lib/classes/queries.php
@@ -189,10 +189,10 @@ class queries
$queries = $app['EM']
->getRepository('Alchemy\Phrasea\Model\Entities\UserQuery')
- ->findBy(array('usrId' => $usrId), array('created' => 'ASC'), 25, 0);
+ ->findBy(['usrId' => $usrId], ['created' => 'ASC'], 25, 0);
foreach ($queries as $query) {
- $history .= '';
@@ -220,7 +220,7 @@ class queries
$t .= '{ ';
$t .= 'label:"' . p4string::MakeString(utf8_decode($subtopic->label), 'js') . '"';
if ($q = $subtopic->query) {
- $q = str_replace(array("\\", "'", "\r", "\n"), array("\\\\", "\\'", "\\r", "\\n"), $subtopic->query);
+ $q = str_replace(["\\", "'", "\r", "\n"], ["\\\\", "\\'", "\\r", "\\n"], $subtopic->query);
$t .= ", query:'" . $q . "'";
} else {
$t .= ', query:null';
@@ -246,7 +246,7 @@ class queries
$l = p4string::MakeString($s, 'html');
$l = '' . $l . '';
if ($subtopic->query) {
- $q = str_replace(array("\\", "\"", "'", "\r", "\n"), array("\\\\", """, "\\'", "\\r", "\\n"), $subtopic->query);
+ $q = str_replace(["\\", "\"", "'", "\r", "\n"], ["\\\\", """, "\\'", "\\r", "\\n"], $subtopic->query);
$q = '' . $l . '';
} else {
$q = $l;
diff --git a/lib/classes/random.php b/lib/classes/random.php
index 38355a689e..3ce11aac57 100644
--- a/lib/classes/random.php
+++ b/lib/classes/random.php
@@ -56,7 +56,7 @@ class random
$sql = 'SELECT * FROM tokens WHERE expire_on < :date
AND datas IS NOT NULL AND (type="download" OR type="email")';
$stmt = $conn->prepare($sql);
- $stmt->execute(array(':date' => $date));
+ $stmt->execute([':date' => $date]);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row) {
@@ -72,7 +72,7 @@ class random
$sql = 'DELETE FROM tokens WHERE expire_on < :date and (type="download" OR type="email")';
$stmt = $conn->prepare($sql);
- $stmt->execute(array(':date' => $date));
+ $stmt->execute([':date' => $date]);
$stmt->closeCursor();
return true;
@@ -95,7 +95,7 @@ class random
throw new Exception_InvalidArgument ();
$password = "";
- if ( ! in_array($possible, array(self::LETTERS_AND_NUMBERS, self::LETTERS, self::NUMBERS)))
+ if ( ! in_array($possible, [self::LETTERS_AND_NUMBERS, self::LETTERS, self::NUMBERS]))
$possible = self::LETTERS_AND_NUMBERS;
$i = 0;
$possible_length = strlen($possible);
@@ -145,7 +145,7 @@ class random
$stmt = $conn->prepare($sql);
while ($n < 100) {
$test = self::generatePassword(16);
- $stmt->execute(array(':test' => $test));
+ $stmt->execute([':test' => $test]);
if ($stmt->rowCount() === 0) {
$token = $test;
break;
@@ -159,13 +159,13 @@ class random
VALUES (null, :token, :type, :usr, NOW(), :end_date, :datas)';
$stmt = $conn->prepare($sql);
- $params = array(
+ $params = [
':token' => $token
, ':type' => $type
, ':usr' => ($usr ? $usr : '-1')
, ':end_date' => ($end_date instanceof DateTime ? $end_date->format(DATE_ISO8601) : null)
, ':datas' => ((trim($datas) != '') ? $datas : null)
- );
+ ];
$stmt->execute($params);
$stmt->closeCursor();
}
@@ -181,7 +181,7 @@ class random
$conn = connection::getPDOConnection($this->app);
$sql = 'DELETE FROM tokens WHERE value = :token';
$stmt = $conn->prepare($sql);
- $stmt->execute(array(':token' => $token));
+ $stmt->execute([':token' => $token]);
$stmt->closeCursor();
return true;
@@ -201,7 +201,7 @@ class random
WHERE value = :token';
$stmt = $conn->prepare($sql);
- $stmt->execute(array(':datas' => $datas, ':token' => $token));
+ $stmt->execute([':datas' => $datas, ':token' => $token]);
$stmt->closeCursor();
return true;
@@ -221,7 +221,7 @@ class random
WHERE value = :token
AND (expire_on > NOW() OR expire_on IS NULL)';
$stmt = $conn->prepare($sql);
- $stmt->execute(array(':token' => $token));
+ $stmt->execute([':token' => $token]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -252,11 +252,11 @@ class random
AND (expire_on > NOW() OR expire_on IS NULL)';
$stmt = $conn->prepare($sql);
- $stmt->execute(array(
+ $stmt->execute([
':type' => self::TYPE_VALIDATE,
':usr_id' => (int) $userId,
':basket_id' => (int) $basketId,
- ));
+ ]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
diff --git a/lib/classes/record/adapter.php b/lib/classes/record/adapter.php
index 5e4030602e..2d5d374ea4 100644
--- a/lib/classes/record/adapter.php
+++ b/lib/classes/record/adapter.php
@@ -201,7 +201,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
, type, originalname, bitly, sha256, mime
FROM record WHERE record_id = :record_id';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->record_id));
+ $stmt->execute([':record_id' => $this->record_id]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -221,7 +221,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$this->sha256 = $row['sha256'];
$this->mime = $row['mime'];
- $datas = array(
+ $datas = [
'mime' => $this->mime
, 'sha256' => $this->sha256
, 'bitly_link' => $this->bitly_link
@@ -232,7 +232,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
, 'modification_date' => $this->modification_date
, 'creation_date' => $this->creation_date
, 'base_id' => $this->base_id
- );
+ ];
$this->set_data_to_cache($datas);
@@ -299,7 +299,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$old_type = $this->get_type();
- if (!in_array($type, array('document', 'audio', 'video', 'image', 'flash', 'map'))) {
+ if (!in_array($type, ['document', 'audio', 'video', 'image', 'flash', 'map'])) {
throw new Exception('unrecognized document type');
}
@@ -307,7 +307,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$sql = 'UPDATE record SET type = :type WHERE record_id = :record_id';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':type' => $type, ':record_id' => $this->get_record_id()));
+ $stmt->execute([':type' => $type, ':record_id' => $this->get_record_id()]);
$stmt->closeCursor();
if ($old_type !== $type)
@@ -489,10 +489,10 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$sql = "UPDATE record SET coll_id = :coll_id WHERE record_id =:record_id";
- $params = array(
+ $params = [
':coll_id' => $collection->get_coll_id(),
':record_id' => $this->get_record_id()
- );
+ ];
$stmt = $this->get_databox()->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -574,7 +574,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$sql = 'SELECT BIN(status) as status FROM record
WHERE record_id = :record_id';
$stmt = $this->get_databox()->get_connection()->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -617,7 +617,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
}
if (!$this->subdefs) {
- $this->subdefs = array();
+ $this->subdefs = [];
}
$substitute = ($name !== 'document');
@@ -634,7 +634,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
*/
public function getSubdfefByDeviceAndMime($devices = null, $mimes = null)
{
- $subdefNames = $subdefs = array();
+ $subdefNames = $subdefs = [];
$availableSubdefs = $this->get_subdefs();
@@ -695,7 +695,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
public function get_subdefs()
{
if (!$this->subdefs) {
- $this->subdefs = array();
+ $this->subdefs = [];
}
$subdefs = $this->get_available_subdefs();
@@ -724,11 +724,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
WHERE s.record_id = r.record_id AND r.record_id = :record_id';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $subdefs = array('preview', 'thumbnail');
+ $subdefs = ['preview', 'thumbnail'];
foreach ($rs as $row) {
$subdefs[] = $row['name'];
@@ -760,11 +760,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
try {
$this->technical_datas = $this->get_data_from_cache(self::CACHE_TECHNICAL_DATAS);
} catch (Exception $e) {
- $this->technical_datas = array();
+ $this->technical_datas = [];
$connbas = $this->get_databox()->get_connection();
$sql = 'SELECT name, value FROM technical_datas WHERE record_id = :record_id';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -847,11 +847,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$meta_id = null;
}
- $metas = array(
+ $metas = [
'meta_struct_id' => $field->get_meta_struct_id()
, 'meta_id' => $meta_id
, 'value' => $original_name
- );
+ ];
$this->set_metadatas($metas, true);
}
@@ -859,10 +859,10 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$sql = 'UPDATE record
SET originalname = :originalname WHERE record_id = :record_id';
- $params = array(
+ $params = [
':originalname' => $original_name
, ':record_id' => $this->get_record_id()
- );
+ ];
$stmt = $this->get_databox()->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -893,17 +893,17 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$fields = $this->get_databox()->get_meta_structure();
- $fields_to_retrieve = array();
+ $fields_to_retrieve = [];
foreach ($fields as $field) {
- if (in_array($field->get_thumbtitle(), array('1', $this->app['locale.I18n']))) {
+ if (in_array($field->get_thumbtitle(), ['1', $this->app['locale.I18n']])) {
$fields_to_retrieve [] = $field->get_name();
}
}
if (count($fields_to_retrieve) > 0) {
$retrieved_fields = $this->get_caption()->get_highlight_fields($highlight, $fields_to_retrieve, $searchEngine);
- $titles = array();
+ $titles = [];
foreach ($retrieved_fields as $key => $value) {
if (trim($value['value'] === ''))
continue;
@@ -1048,10 +1048,10 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$sql = 'UPDATE record SET xml = :xml WHERE record_id= :record_id';
$stmt = $connbas->prepare($sql);
$stmt->execute(
- array(
+ [
':xml' => $dom_doc->saveXML(),
':record_id' => $this->record_id
- )
+ ]
);
$this->reindex();
@@ -1067,7 +1067,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
*/
protected function set_metadata(Array $params, databox $databox)
{
- $mandatoryParams = array('meta_struct_id', 'meta_id', 'value');
+ $mandatoryParams = ['meta_struct_id', 'meta_id', 'value'];
foreach ($mandatoryParams as $param) {
if (!array_key_exists($param, $params)) {
@@ -1178,7 +1178,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$connbas = connection::getPDOConnection($this->app, $this->get_sbas_id());
$sql = 'UPDATE record SET jeton=(jeton | ' . JETON_MAKE_SUBDEF . ') WHERE record_id = :record_id';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
return $this;
}
@@ -1194,7 +1194,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
SET jeton = ' . (JETON_WRITE_META_DOC | JETON_WRITE_META_SUBDEF) . '
WHERE record_id= :record_id';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->record_id));
+ $stmt->execute([':record_id' => $this->record_id]);
return $this;
}
@@ -1210,7 +1210,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$sql = 'UPDATE record SET status = :status WHERE record_id= :record_id';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->record_id, ':status' => bindec($status)));
+ $stmt->execute([':record_id' => $this->record_id, ':status' => bindec($status)]);
$stmt->closeCursor();
$sql = 'REPLACE INTO status (id, record_id, name, value) VALUES (null, :record_id, :name, :value)';
@@ -1219,11 +1219,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$status = strrev($status);
$length = strlen($status);
for ($i = 4; $i < $length; $i++) {
- $stmt->execute(array(
+ $stmt->execute([
':record_id' => $this->get_record_id(),
':name' => $i,
':value' => $status[$i]
- ));
+ ]);
}
$stmt->closeCursor();
@@ -1253,7 +1253,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$stmt = $databox->get_connection()->prepare($sql);
- $stmt->execute(array(
+ $stmt->execute([
':coll_id' => $collection->get_coll_id(),
':parent_record_id' => 1,
':type' => 'unknown',
@@ -1261,7 +1261,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
':uuid' => \uuid::generate_v4(),
':originalname' => null,
':mime' => null,
- ));
+ ]);
$story_id = $databox->get_connection()->lastInsertId();
@@ -1274,11 +1274,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
VALUES (null, :log_id, now(),
:record_id, "add", :coll_id,"")';
$stmt = $databox->get_connection()->prepare($sql);
- $stmt->execute(array(
+ $stmt->execute([
':log_id' => $log_id,
':record_id' => $story_id,
':coll_id' => $collection->get_coll_id()
- ));
+ ]);
$stmt->closeCursor();
} catch (Exception $e) {
unset($e);
@@ -1308,7 +1308,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$stmt = $databox->get_connection()->prepare($sql);
- $stmt->execute(array(
+ $stmt->execute([
':coll_id' => $file->getCollection()->get_coll_id(),
':parent_record_id' => 0,
':type' => $file->getType() ? $file->getType()->getType() : 'unknown',
@@ -1316,7 +1316,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
':uuid' => $file->getUUID(true),
':originalname' => $file->getOriginalName(),
':mime' => $file->getFile()->getMimeType(),
- ));
+ ]);
$record_id = $databox->get_connection()->lastInsertId();
@@ -1329,11 +1329,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
VALUES (null, :log_id, now(),
:record_id, "add", :coll_id,"")';
$stmt = $databox->get_connection()->prepare($sql);
- $stmt->execute(array(
+ $stmt->execute([
':log_id' => $log_id,
':record_id' => $record_id,
':coll_id' => $file->getCollection()->get_coll_id()
- ));
+ ]);
$stmt->closeCursor();
} catch (Exception $e) {
unset($e);
@@ -1384,11 +1384,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
}
}
- $stmt->execute(array(
+ $stmt->execute([
':record_id' => $this->get_record_id()
, ':name' => $name
, ':value' => $value
- ));
+ ]);
}
$stmt->closeCursor();
@@ -1415,7 +1415,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
WHERE sha256 IS NOT NULL
AND sha256 = :sha256";
- $params = array(':sha256' => $sha256);
+ $params = [':sha256' => $sha256];
if (!is_null($record_id)) {
$sql .= ' AND record_id = :record_id';
@@ -1427,7 +1427,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $records = array();
+ $records = [];
foreach ($rs as $row) {
$records[] = new record_adapter($app, $sbas_id, $row['record_id']);
@@ -1451,7 +1451,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$sql = "SELECT record_id FROM record r
WHERE uuid IS NOT NULL AND uuid = :uuid";
- $params = array(':uuid' => $uuid);
+ $params = [':uuid' => $uuid];
if (!is_null($record_id)) {
$sql .= ' AND record_id = :record_id';
@@ -1463,7 +1463,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $records = array();
+ $records = [];
foreach ($rs as $row) {
$records[] = new record_adapter($app, $databox->get_sbas_id(), $row['record_id']);
@@ -1495,7 +1495,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
{
$connbas = $this->get_databox()->get_connection();
- $ftodel = array();
+ $ftodel = [];
foreach ($this->get_subdefs() as $subdef) {
if (!$subdef->is_physically_present())
continue;
@@ -1518,60 +1518,60 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$sql = "DELETE FROM record WHERE record_id = :record_id";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$stmt->closeCursor();
$sql = "DELETE FROM metadatas WHERE record_id = :record_id";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$stmt->closeCursor();
$sql = "DELETE FROM prop WHERE record_id = :record_id";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$stmt->closeCursor();
$sql = "DELETE FROM idx WHERE record_id = :record_id";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$stmt->closeCursor();
$sql = "DELETE FROM permalinks
WHERE subdef_id
IN (SELECT subdef_id FROM subdef WHERE record_id=:record_id)";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$stmt->closeCursor();
$sql = "DELETE FROM subdef WHERE record_id = :record_id";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$stmt->closeCursor();
$sql = "DELETE FROM technical_datas WHERE record_id = :record_id";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$stmt->closeCursor();
$sql = "DELETE FROM thit WHERE record_id = :record_id";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$stmt->closeCursor();
$sql = "DELETE FROM regroup WHERE rid_parent = :record_id";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$stmt->closeCursor();
$sql = "DELETE FROM regroup WHERE rid_child = :record_id";
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$stmt->closeCursor();
$orderElementRepository = $this->app['EM']->getRepository('Alchemy\Phrasea\Model\Entities\OrderElement');
/* @var $repository Alchemy\Phrasea\Model\Repositories\OrderElementRepository */
- foreach ($orderElementRepository->findBy(array('recordId' => $this->get_record_id())) as $order_element) {
+ foreach ($orderElementRepository->findBy(['recordId' => $this->get_record_id()]) as $order_element) {
if ($order_element->getSbasId($this->app) == $this->get_sbas_id()) {
$this->app['EM']->remove($order_element);
}
@@ -1832,12 +1832,12 @@ class record_adapter implements record_Interface, cache_cacheableInterface
VALUES
(null, :log_id, now(), :rec, :referrer, :site)';
- $params = array(
+ $params = [
':log_id' => $log_id
, ':rec' => $this->get_record_id()
, ':referrer' => $referrer
, ':site' => $gv_sit
- );
+ ];
$stmt = $connbas->prepare($sql);
$stmt->execute($params);
$stmt->closeCursor();
@@ -1884,11 +1884,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
, $offset_start, $how_many);
$stmt = $databox->get_connection()->prepare($sql);
- $stmt->execute(array(':original_name' => $original_name));
+ $stmt->execute([':original_name' => $original_name]);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $records = array();
+ $records = [];
foreach ($rs as $row) {
$records[] = $databox->get_record($row['record_id']);
}
@@ -1920,11 +1920,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
ON (g.rid_child = r.record_id AND g.rid_parent = :record_id)
ORDER BY g.ord ASC, dateadd ASC, record_id ASC';
- $params = array(
+ $params = [
':GV_site' => $this->app['configuration']['main']['key'],
':usr_id' => $this->app['authentication']->getUser()->get_id(),
':record_id' => $this->get_record_id(),
- );
+ ];
} else {
$sql = 'SELECT record_id
FROM regroup g
@@ -1932,9 +1932,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface
ON (g.rid_child = r.record_id AND g.rid_parent = :record_id)
ORDER BY g.ord ASC, dateadd ASC, record_id ASC';
- $params = array(
+ $params = [
':record_id' => $this->get_record_id()
- );
+ ];
}
$stmt = $this->get_databox()->get_connection()->prepare($sql);
@@ -1971,11 +1971,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
ON (g.rid_parent = r.record_id)
WHERE rid_child = :record_id';
- $params = array(
+ $params = [
':GV_site' => $this->app['configuration']['main']['key']
, ':usr_id' => $this->app['authentication']->getUser()->get_id()
, ':record_id' => $this->get_record_id()
- );
+ ];
$stmt = $this->get_databox()->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -2010,7 +2010,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':parent_record_id' => $this->get_record_id()));
+ $stmt->execute([':parent_record_id' => $this->get_record_id()]);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
@@ -2023,11 +2023,11 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$sql = 'INSERT INTO regroup (id, rid_parent, rid_child, dateadd, ord)
VALUES (null, :parent_record_id, :record_id, NOW(), :ord)';
- $params = array(
+ $params = [
':parent_record_id' => $this->get_record_id()
, ':record_id' => $record->get_record_id()
, ':ord' => $ord
- );
+ ];
$stmt = $connbas->prepare($sql);
$stmt->execute($params);
@@ -2036,7 +2036,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$sql = 'UPDATE record SET moddate = NOW() WHERE record_id = :record_id';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$stmt->closeCursor();
$this->delete_data_from_cache();
@@ -2055,10 +2055,10 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$sql = "DELETE FROM regroup WHERE rid_parent = :parent_record_id
AND rid_child = :record_id";
- $params = array(
+ $params = [
':parent_record_id' => $this->get_record_id()
, ':record_id' => $record->get_record_id()
- );
+ ];
$stmt = $connbas->prepare($sql);
$stmt->execute($params);
@@ -2066,7 +2066,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$sql = 'UPDATE record SET moddate = NOW() WHERE record_id = :record_id';
$stmt = $connbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$stmt->closeCursor();
$this->delete_data_from_cache();
diff --git a/lib/classes/record/exportElement.php b/lib/classes/record/exportElement.php
index b7f949abfa..962a1d469c 100644
--- a/lib/classes/record/exportElement.php
+++ b/lib/classes/record/exportElement.php
@@ -69,7 +69,7 @@ class record_exportElement extends record_adapter
}
$this->remain_hd = $remain_hd;
- $this->size = array();
+ $this->size = [];
parent::__construct($app, $sbas_id, $record_id);
$this->get_actions($remain_hd);
@@ -83,8 +83,8 @@ class record_exportElement extends record_adapter
*/
protected function get_actions()
{
- $this->downloadable = $downloadable = array();
- $this->orderable = $orderable = array();
+ $this->downloadable = $downloadable = [];
+ $this->orderable = $orderable = [];
$sd = $this->get_subdefs();
@@ -92,7 +92,7 @@ class record_exportElement extends record_adapter
$subdefgroups = $this->app['phraseanet.appbox']->get_databox($sbas_id)->get_subdef_structure();
- $subdefs = array();
+ $subdefs = [];
foreach ($subdefgroups as $subdef_type => $subdefs_obj) {
if ($subdef_type == $this->get_type()) {
@@ -101,11 +101,11 @@ class record_exportElement extends record_adapter
}
}
- $go_dl = array(
+ $go_dl = [
'document' => false,
'preview' => false,
'thumbnail' => true
- );
+ ];
if ($this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($this->get_base_id(), 'candwnldhd')) {
$go_dl['document'] = true;
@@ -123,8 +123,8 @@ class record_exportElement extends record_adapter
$query = new User_Query($this->app);
- $masters = $query->on_base_ids(array($this->base_id))
- ->who_have_right(array('order_master'))
+ $masters = $query->on_base_ids([$this->base_id])
+ ->who_have_right(['order_master'])
->execute()->get_results();
$go_cmd = (count($masters) > 0 && $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($this->base_id, 'cancmd'));
@@ -137,15 +137,15 @@ class record_exportElement extends record_adapter
if ($this->app['acl']->get($this->app['authentication']->getUser())->is_restricted_download($this->base_id)) {
$this->remain_hd --;
if ($this->remain_hd >= 0)
- $downloadable['document'] = array(
+ $downloadable['document'] = [
'class' => 'document',
'label' => _('document original')
- );
+ ];
} else
- $downloadable['document'] = array(
+ $downloadable['document'] = [
'class' => 'document',
'label' => _('document original')
- );
+ ];
}
if ($go_cmd === true) {
$orderable['document'] = true;
@@ -185,20 +185,20 @@ class record_exportElement extends record_adapter
if ($this->app['acl']->get($this->app['authentication']->getUser())->is_restricted_download($this->base_id)) {
$this->remain_hd --;
if ($this->remain_hd >= 0)
- $downloadable[$name] = array(
+ $downloadable[$name] = [
'class' => $class,
'label' => $subdef_label
- );
+ ];
} else
- $downloadable[$name] = array(
+ $downloadable[$name] = [
'class' => $class,
'label' => $subdef_label
- );
+ ];
} else {
- $downloadable[$name] = array(
+ $downloadable[$name] = [
'class' => $class,
'label' => $subdef_label
- );
+ ];
}
$this->add_count($name, $sd[$name]->get_size());
@@ -209,15 +209,15 @@ class record_exportElement extends record_adapter
$xml = $this->get_caption()->serialize(caption_record::SERIALIZE_XML);
if ($xml) {
- $downloadable['caption'] = array(
+ $downloadable['caption'] = [
'class' => 'caption',
'label' => _('caption XML')
- );
+ ];
$this->add_count('caption', strlen($xml));
- $downloadable['caption-yaml'] = array(
+ $downloadable['caption-yaml'] = [
'class' => 'caption',
'label' => _('caption YAML')
- );
+ ];
$this->add_count('caption-yaml', strlen(strip_tags($xml)));
}
@@ -236,7 +236,7 @@ class record_exportElement extends record_adapter
private function add_count($name, $size)
{
if (! $this->size) {
- $objectsize = array();
+ $objectsize = [];
} else
$objectsize = $this->size;
diff --git a/lib/classes/record/preview.php b/lib/classes/record/preview.php
index e0e119e74f..82c487cd1d 100644
--- a/lib/classes/record/preview.php
+++ b/lib/classes/record/preview.php
@@ -333,7 +333,7 @@ class record_preview extends record_adapter
return $this->short_history;
}
- $tab = array();
+ $tab = [];
$report = $this->app['acl']->get($this->app['authentication']->getUser())->has_right_on_base($this->get_base_id(), 'canreport');
@@ -343,7 +343,7 @@ class record_preview extends record_adapter
FROM log_docs d, log l
WHERE d.log_id = l.id
AND d.record_id = :record_id ';
- $params = array(':record_id' => $this->get_record_id());
+ $params = [':record_id' => $this->get_record_id()];
if (! $report) {
$sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")';
@@ -362,17 +362,17 @@ class record_preview extends record_adapter
$hour = $this->app['date-formatter']->getPrettyString(new DateTime($row['date']));
if ( ! isset($tab[$hour]))
- $tab[$hour] = array();
+ $tab[$hour] = [];
$site = $row['site'];
if ( ! isset($tab[$hour][$site]))
- $tab[$hour][$site] = array();
+ $tab[$hour][$site] = [];
$action = $row['action'];
if ( ! isset($tab[$hour][$site][$action]))
- $tab[$hour][$site][$action] = array();
+ $tab[$hour][$site][$action] = [];
if ( ! isset($tab[$hour][$site][$action][$row['usr_id']])) {
$user = null;
@@ -384,11 +384,11 @@ class record_preview extends record_adapter
}
$tab[$hour][$site][$action][$row['usr_id']] =
- array(
- 'final' => array()
- , 'comment' => array()
+ [
+ 'final' => []
+ , 'comment' => []
, 'user' => $user
- );
+ ];
}
if ( ! in_array($row['final'], $tab[$hour][$site][$action][$row['usr_id']]['final'])) {
@@ -427,7 +427,7 @@ class record_preview extends record_adapter
return $this->view_popularity;
}
- $views = $dwnls = array();
+ $views = $dwnls = [];
$top = 1;
$day = 30;
$min = 0;
@@ -451,10 +451,10 @@ class record_preview extends record_adapter
$connsbas = connection::getPDOConnection($this->app, $this->get_sbas_id());
$stmt = $connsbas->prepare($sql);
$stmt->execute(
- array(
+ [
':record_id' => $this->get_record_id(),
':site' => $this->app['configuration']['main']['key']
- )
+ ]
);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
@@ -525,11 +525,11 @@ class record_preview extends record_adapter
GROUP BY referrer ORDER BY referrer ASC';
$stmt = $connsbas->prepare($sql);
- $stmt->execute(array(':record_id' => $this->get_record_id()));
+ $stmt->execute([':record_id' => $this->get_record_id()]);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
- $referrers = array();
+ $referrers = [];
foreach ($rs as $row) {
if ($row['referrer'] == 'NO REFERRER')
@@ -588,7 +588,7 @@ class record_preview extends record_adapter
return $this->download_popularity;
}
- $views = $dwnls = array();
+ $views = $dwnls = [];
$top = 1;
$day = 30;
@@ -612,10 +612,10 @@ class record_preview extends record_adapter
$connsbas = connection::getPDOConnection($this->app, $this->get_sbas_id());
$stmt = $connsbas->prepare($sql);
$stmt->execute(
- array(
+ [
':record_id' => $this->get_record_id(),
':site' => $this->app['configuration']['main']['key']
- )
+ ]
);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
diff --git a/lib/classes/recordutils/image.php b/lib/classes/recordutils/image.php
index c168c67cb3..b430b159fd 100644
--- a/lib/classes/recordutils/image.php
+++ b/lib/classes/recordutils/image.php
@@ -34,7 +34,7 @@ class recordutils_image extends recordutils
$palette = new RGB();
}
- $xmlToColor = function($attr, $ret = array(255, 255, 255)) use ($palette) {
+ $xmlToColor = function ($attr, $ret = [255, 255, 255]) use ($palette) {
try {
return $palette->color($attr, 0);
} catch (ImagineException $e) {
@@ -134,20 +134,20 @@ class recordutils_image extends recordutils
}
- $tables = array(
- 'TOP' => array('h' => 0, 'rows' => array()),
- 'TOP-OVER' => array('h' => 0, 'rows' => array()),
- 'BOTTOM' => array('h' => 0, 'rows' => array()),
- 'BOTTOM-OVER' => array('h' => 0, 'rows' => array())
- );
+ $tables = [
+ 'TOP' => ['h' => 0, 'rows' => []],
+ 'TOP-OVER' => ['h' => 0, 'rows' => []],
+ 'BOTTOM' => ['h' => 0, 'rows' => []],
+ 'BOTTOM-OVER' => ['h' => 0, 'rows' => []]
+ ];
for ($istamp = 0; $istamp < $stampNodes->length; $istamp++) {
$stamp = $stampNodes->item($istamp);
- $stamp_background = $xmlToColor($stamp->getAttribute('background'), array(255, 255, 255));
+ $stamp_background = $xmlToColor($stamp->getAttribute('background'), [255, 255, 255]);
$stamp_position = strtoupper(trim($stamp->getAttribute('position')));
- if (!in_array($stamp_position, array('TOP', 'TOP-OVER', 'BOTTOM-OVER', 'BOTTOM'))) {
+ if (!in_array($stamp_position, ['TOP', 'TOP-OVER', 'BOTTOM-OVER', 'BOTTOM'])) {
$stamp_position = 'BOTTOM';
}
@@ -232,7 +232,7 @@ class recordutils_image extends recordutils
// compute text blocks
$txth = 0;
- $txtblock = array();
+ $txtblock = [];
$texts = $xpprefs->query('text', $stamp);
$fontsize = "100%";
for ($i = 0; $i < $texts->length; $i++) {
@@ -255,12 +255,12 @@ class recordutils_image extends recordutils
if ($txtline != '') {
$wrap = static::wrap($app['imagine'], $fontsize, 0, __DIR__ . '/arial.ttf', $txtline, $text_width);
- $txtblock[] = array(
+ $txtblock[] = [
'fontsize' => $fontsize,
- 'fontcolor' => $xmlToColor($texts->item($i)->getAttribute('color'), array(0, 0, 0)),
+ 'fontcolor' => $xmlToColor($texts->item($i)->getAttribute('color'), [0, 0, 0]),
'h' => $wrap['toth'],
'lines' => $wrap['l']
- );
+ ];
$txth += $wrap['toth'];
}
}
@@ -305,13 +305,13 @@ class recordutils_image extends recordutils
}
// memo into one of the 4 buffer
- $tables[$stamp_position]['rows'][] = array(
+ $tables[$stamp_position]['rows'][] = [
'x0' => 0,
'y0' => $tables[$stamp_position]['h'],
'w' => $image_width,
'h' => $stampheight,
'img' => $imfg
- );
+ ];
$tables[$stamp_position]['h'] += $stampheight;
}
@@ -336,7 +336,7 @@ class recordutils_image extends recordutils
}
// paste blocks
- foreach (array('TOP', 'TOP-OVER', 'BOTTOM-OVER', 'BOTTOM') as $ta) {
+ foreach (['TOP', 'TOP-OVER', 'BOTTOM-OVER', 'BOTTOM'] as $ta) {
foreach ($tables[$ta]['rows'] as $row) {
if ($row['h'] > 0) {
$image_out->paste($row['img'], new Point($row['x0'], $row['y0']));
@@ -427,10 +427,10 @@ class recordutils_image extends recordutils
$draw->line(new Point(1, $in_h - 1), new Point($in_w - 1, 1), $white);
$fsize = max(8, (int) (max($in_w, $in_h) / 30));
- $fonts = array(
+ $fonts = [
$app['imagine']->font(__DIR__ . '/arial.ttf', $fsize, $black),
$app['imagine']->font(__DIR__ . '/arial.ttf', $fsize, $white)
- );
+ ];
$testbox = $fonts[0]->box($collname, 0);
$tx_w = min($in_w, $testbox->getWidth());
$tx_h = min($in_h, $testbox->getHeight());
@@ -482,21 +482,21 @@ class recordutils_image extends recordutils
$testbox = $font->box("M", $angle); // 1 em
$dy = $testbox->getHeight();
$toth = 0;
- $ret = array();
+ $ret = [];
foreach (explode("\n", $string) as $lig) {
if ($lig == '') {
- $ret[] = array('w' => 0, 'h' => $dy, 't' => '');
+ $ret[] = ['w' => 0, 'h' => $dy, 't' => ''];
$toth += $dy;
} else {
- $twords = array();
+ $twords = [];
$iword = -1;
$lastc = '';
$length = strlen($lig);
for ($i = 0; $i < $length; $i++) {
$c = $lig[$i];
if ($iword == -1 || (ctype_space($c) && !ctype_space($lastc))) {
- $twords[++$iword] = array(($part = 0) => '', 1 => '');
+ $twords[++$iword] = [($part = 0) => '', 1 => ''];
}
if (!ctype_space($c) && $part == 0) {
$part++;
@@ -512,7 +512,7 @@ class recordutils_image extends recordutils
$w = $testbox->getWidth();
$h = $testbox->getHeight();
if ($i > 0 && $testbox->getWidth() > $width) {
- $ret[] = array('w' => $lastw, 'h' => $lasth, 't' => $buff);
+ $ret[] = ['w' => $lastw, 'h' => $lasth, 't' => $buff];
$toth += $lasth;
$buff = $wrd[1];
} else {
@@ -522,13 +522,13 @@ class recordutils_image extends recordutils
$lasth = $h;
}
if ($buff != '') {
- $ret[] = array('w' => $lastw, 'h' => $lasth, 't' => $buff);
+ $ret[] = ['w' => $lastw, 'h' => $lasth, 't' => $buff];
$toth += $lasth;
}
}
}
}
- return array('toth' => $toth, 'l' => $ret, 'h' => $height, 'dy' => $dy);
+ return ['toth' => $toth, 'l' => $ret, 'h' => $height, 'dy' => $dy];
}
}
diff --git a/lib/classes/registry.php b/lib/classes/registry.php
index 37b282999e..6a0bfc4f49 100644
--- a/lib/classes/registry.php
+++ b/lib/classes/registry.php
@@ -67,7 +67,7 @@ class registry implements registryInterface
protected function load()
{
if ($this->cache->fetch('registry_loaded') !== true) {
- $rs = array();
+ $rs = [];
$loaded = false;
try {
$conn = connection::getPDOConnection($this->app);
@@ -81,7 +81,7 @@ class registry implements registryInterface
}
foreach ($rs as $row) {
- if (in_array($row['key'], array('GV_ServerName', 'GV_sit', 'GV_debug'))) {
+ if (in_array($row['key'], ['GV_ServerName', 'GV_sit', 'GV_debug'])) {
continue;
}
@@ -180,7 +180,7 @@ class registry implements registryInterface
$sql = 'REPLACE INTO registry (`id`, `key`, `value`, `type`)
VALUES (null, :key, :value, :type)';
$stmt = $conn->prepare($sql);
- $stmt->execute(array(':key' => $key, ':value' => $sql_value, ':type' => $type));
+ $stmt->execute([':key' => $key, ':value' => $sql_value, ':type' => $type]);
$stmt->closeCursor();
$this->cache->save($key, $value);
@@ -217,7 +217,7 @@ class registry implements registryInterface
$sql = 'DELETE FROM registry WHERE `key` = :key';
$stmt = $conn->prepare($sql);
- $stmt->execute(array(':key' => $key));
+ $stmt->execute([':key' => $key]);
$stmt->closeCursor();
$this->cache->delete($key);
diff --git a/lib/classes/set/abstract.php b/lib/classes/set/abstract.php
index 6ef7b6567f..44e804c23c 100644
--- a/lib/classes/set/abstract.php
+++ b/lib/classes/set/abstract.php
@@ -21,7 +21,7 @@ abstract class set_abstract implements IteratorAggregate
*
* @var Array
*/
- protected $elements = array();
+ protected $elements = [];
/**
*
@@ -175,7 +175,7 @@ abstract class set_abstract implements IteratorAggregate
*/
public function serialize_list()
{
- $basrec = array();
+ $basrec = [];
foreach ($this->elements as $record) {
$basrec[] = $record->get_serialize_key();
}
diff --git a/lib/classes/set/export.php b/lib/classes/set/export.php
index 43d4791cf6..86e15ce8b0 100644
--- a/lib/classes/set/export.php
+++ b/lib/classes/set/export.php
@@ -21,7 +21,7 @@ use Symfony\Component\Filesystem\Filesystem;
class set_export extends set_abstract
{
protected $app;
- protected $storage = array();
+ protected $storage = [];
protected $total_download;
protected $total_order;
protected $total_ftp;
@@ -45,9 +45,9 @@ class set_export extends set_abstract
{
$this->app = $app;
- $download_list = array();
+ $download_list = [];
- $remain_hd = array();
+ $remain_hd = [];
if ($storyWZid) {
$repository = $app['EM']->getRepository('\\Entities\\StoryWZ');
@@ -61,7 +61,7 @@ class set_export extends set_abstract
$Basket = $app['converter.basket']->convert($sstid);
$app['acl.basket']->hasAccess($Basket, $app['authentication']->getUser());
- $this->exportName = str_replace(array(' ', '\\', '/'), '_', $Basket->getName()) . "_" . date("Y-n-d");
+ $this->exportName = str_replace([' ', '\\', '/'], '_', $Basket->getName()) . "_" . date("Y-n-d");
foreach ($Basket->getElements() as $basket_element) {
$base_id = $basket_element->getRecord($this->app)->get_base_id();
@@ -156,8 +156,8 @@ class set_export extends set_abstract
$this->elements = $download_list;
- $display_download = array();
- $display_orderable = array();
+ $display_download = [];
+ $display_orderable = [];
$this->total_download = 0;
$this->total_order = 0;
@@ -172,12 +172,12 @@ class set_export extends set_abstract
foreach ($download_element->get_downloadable() as $name => $properties) {
if (!isset($display_download[$name])) {
- $display_download[$name] = array(
+ $display_download[$name] = [
'size' => 0,
'total' => 0,
'available' => 0,
- 'refused' => array()
- );
+ 'refused' => []
+ ];
}
$display_download[$name]['total']++;
@@ -194,11 +194,11 @@ class set_export extends set_abstract
}
foreach ($download_element->get_orderable() as $name => $properties) {
if (!isset($display_orderable[$name])) {
- $display_orderable[$name] = array(
+ $display_orderable[$name] = [
'total' => 0,
'available' => 0,
- 'refused' => array()
- );
+ 'refused' => []
+ ];
}
$display_orderable[$name]['total']++;
@@ -216,7 +216,7 @@ class set_export extends set_abstract
$display_download[$name]['size'] = (int) $values['size'];
}
- $display_ftp = array();
+ $display_ftp = [];
$hasadminright = $app['acl']->get($app['authentication']->getUser())->has_right('addrecord')
|| $app['acl']->get($app['authentication']->getUser())->has_right('deleterecord')
@@ -224,7 +224,7 @@ class set_export extends set_abstract
|| $app['acl']->get($app['authentication']->getUser())->has_right('coll_manage')
|| $app['acl']->get($app['authentication']->getUser())->has_right('coll_modify_struct');
- $this->ftp_datas = array();
+ $this->ftp_datas = [];
if ($this->app['phraseanet.registry']->get('GV_activeFTP') && ($hasadminright || $this->app['phraseanet.registry']->get('GV_ftp_for_user'))) {
$display_ftp = $display_download;
@@ -245,7 +245,7 @@ class set_export extends set_abstract
)
)
GROUP BY usr_id ";
- $params = array();
+ $params = [];
} elseif ($this->app['phraseanet.registry']->get('GV_ftp_for_user')) {
$sql = "SELECT usr.usr_id,usr_login,usr.usr_mail, FtpCredential.*
FROM (
@@ -260,10 +260,10 @@ class set_export extends set_abstract
)
)
GROUP BY usr_id ";
- $params = array(':usr_id' => $app['authentication']->getUser()->get_id());
+ $params = [':usr_id' => $app['authentication']->getUser()->get_id()];
}
- $datas[] = array(
+ $datas[] = [
'name' => _('export::ftp: reglages manuels'),
'usr_id' => '0',
'address' => '',
@@ -275,7 +275,7 @@ class set_export extends set_abstract
'passive' => false,
'max_retry' => 5,
'sendermail' => $app['authentication']->getUser()->get_email()
- );
+ ];
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute($params);
@@ -283,7 +283,7 @@ class set_export extends set_abstract
$stmt->closeCursor();
foreach ($rs as $row) {
- $datas[] = array(
+ $datas[] = [
'name' => $row["usr_login"],
'usr_id' => $row['usr_id'],
'address' => $row['address'],
@@ -299,7 +299,7 @@ class set_export extends set_abstract
'max_retry' => $row['max_retry'],
'usr_mail' => $row['usr_mail'],
'sender_mail' => $app['authentication']->getUser()->get_email()
- );
+ ];
}
$this->ftp_datas = $datas;
@@ -408,11 +408,11 @@ class set_export extends set_abstract
$includeBusinessFields = !!$includeBusinessFields;
- $files = array();
+ $files = [];
$n_files = 0;
- $file_names = array();
+ $file_names = [];
$size = 0;
@@ -421,13 +421,13 @@ class set_export extends set_abstract
foreach ($this->elements as $download_element) {
$id = count($files);
- $files[$id] = array(
+ $files[$id] = [
'base_id' => $download_element->get_base_id(),
'record_id' => $download_element->get_record_id(),
'original_name' => '',
'export_name' => '',
- 'subdefs' => array()
- );
+ 'subdefs' => []
+ ];
$BF = false;
@@ -466,7 +466,7 @@ class set_export extends set_abstract
if ($properties === false || !in_array($name, $subdefs)) {
continue;
}
- if (!in_array($name, array('caption', 'caption-yaml')) && !isset($sd[$name])) {
+ if (!in_array($name, ['caption', 'caption-yaml']) && !isset($sd[$name])) {
continue;
}
@@ -475,7 +475,7 @@ class set_export extends set_abstract
$n_files++;
- $tmp_pathfile = array('path' => null, 'file' => null);
+ $tmp_pathfile = ['path' => null, 'file' => null];
switch ($properties['class']) {
case 'caption':
@@ -484,25 +484,25 @@ class set_export extends set_abstract
$subdef_alive = true;
break;
case 'thumbnail':
- $tmp_pathfile = array(
+ $tmp_pathfile = [
'path' => $sd[$name]->get_path()
, 'file' => $sd[$name]->get_file()
- );
+ ];
$subdef_export = true;
$subdef_alive = true;
break;
case 'document':
$subdef_export = true;
$path = \recordutils_image::stamp($this->app , $sd[$name]);
- $tmp_pathfile = array(
+ $tmp_pathfile = [
'path' => $sd[$name]->get_path()
, 'file' => $sd[$name]->get_file()
- );
+ ];
if (file_exists($path)) {
- $tmp_pathfile = array(
+ $tmp_pathfile = [
'path' => dirname($path)
, 'file' => basename($path)
- );
+ ];
$subdef_alive = true;
}
break;
@@ -510,19 +510,19 @@ class set_export extends set_abstract
case 'preview':
$subdef_export = true;
- $tmp_pathfile = array(
+ $tmp_pathfile = [
'path' => $sd[$name]->get_path()
, 'file' => $sd[$name]->get_file()
- );
+ ];
if (!$this->app['acl']->get($user)->has_right_on_base($download_element->get_base_id(), "nowatermark")
&& !$this->app['acl']->get($user)->has_preview_grant($download_element)
&& $sd[$name]->get_type() == media_subdef::TYPE_IMAGE) {
$path = recordutils_image::watermark($this->app, $sd[$name]);
if (file_exists($path)) {
- $tmp_pathfile = array(
+ $tmp_pathfile = [
'path' => dirname($path)
, 'file' => basename($path)
- );
+ ];
$subdef_alive = true;
}
} else {
@@ -615,10 +615,10 @@ class set_export extends set_abstract
$i = 0;
$name = utf8_decode($files[$id]["export_name"]);
$tmp_name = "";
- $good_keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
+ $good_keys = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
- '4', '5', '6', '7', '8', '9', '-', '_', '.', '#');
+ '4', '5', '6', '7', '8', '9', '-', '_', '.', '#'];
while (isset($name[$i])) {
if (!in_array(mb_strtolower($name[$i]), $good_keys))
@@ -677,12 +677,12 @@ class set_export extends set_abstract
}
}
- $this->list = array(
+ $this->list = [
'files' => $files,
'names' => $file_names,
'size' => $size,
'count' => $n_files
- );
+ ];
return $this->list;
}
@@ -713,7 +713,7 @@ class set_export extends set_abstract
$app['tokens']->updateToken($token, serialize($list));
- $toRemove = array();
+ $toRemove = [];
foreach ($files as $record) {
if (isset($record["subdefs"])) {
@@ -765,13 +765,13 @@ class set_export extends set_abstract
*/
public static function log_download(Application $app, Array $list, $type, $anonymous = false, $comment = '')
{
- $tmplog = array();
+ $tmplog = [];
$files = $list['files'];
- $event_names = array(
+ $event_names = [
'mail-export' => Session_Logger::EVENT_EXPORTMAIL,
'download' => Session_Logger::EVENT_EXPORTDOWNLOAD
- );
+ ];
$event_name = isset($event_names[$type]) ? $event_names[$type] : Session_Logger::EVENT_EXPORTDOWNLOAD;
@@ -810,11 +810,11 @@ class set_export extends set_abstract
foreach ($list_base as $base_id) {
if ($app['acl']->get($app['authentication']->getUser())->is_restricted_download($base_id)) {
- $params = array(
+ $params = [
':remain_dl' => $app['acl']->get($app['authentication']->getUser())->remaining_download($base_id)
, ':base_id' => $base_id
, ':usr_id' => $app['acl']->get($app['authentication']->getUser())->get_id()
- );
+ ];
$stmt->execute($params);
}
diff --git a/lib/classes/set/selection.php b/lib/classes/set/selection.php
index 8af560da28..0d05b435bf 100644
--- a/lib/classes/set/selection.php
+++ b/lib/classes/set/selection.php
@@ -28,7 +28,7 @@ class set_selection extends set_abstract
public function __construct(Application $app)
{
$this->app = $app;
- $this->elements = array();
+ $this->elements = [];
return $this;
}
@@ -54,9 +54,9 @@ class set_selection extends set_abstract
*
* @return set_selection
*/
- public function grep_authorized(Array $rights = array(), Array $sbas_rights = array())
+ public function grep_authorized(Array $rights = [], Array $sbas_rights = [])
{
- $to_remove = array();
+ $to_remove = [];
foreach ($this->elements as $id => $record) {
$base_id = $record->get_base_id();
@@ -99,7 +99,7 @@ class set_selection extends set_abstract
AND record_id = :record_id';
$stmt = $connsbas->prepare($sql);
- $stmt->execute(array(':record_id' => $record_id));
+ $stmt->execute([':record_id' => $record_id]);
$num_rows = $stmt->rowCount();
$stmt->closeCursor();
@@ -153,7 +153,7 @@ class set_selection extends set_abstract
*/
public function get_distinct_sbas_ids()
{
- $ret = array();
+ $ret = [];
foreach ($this->elements as $record) {
$sbas_id = phrasea::sbasFromBas($this->app, $record->get_base_id());
$ret[$sbas_id] = $sbas_id;
diff --git a/lib/classes/setup.php b/lib/classes/setup.php
index 39c05c3187..083a9357fe 100644
--- a/lib/classes/setup.php
+++ b/lib/classes/setup.php
@@ -24,11 +24,11 @@ use Symfony\Component\Process\ExecutableFinder;
*/
class setup
{
- public static function create_global_values(Application $app, $datas = array())
+ public static function create_global_values(Application $app, $datas = [])
{
$GV = require(__DIR__ . "/../../lib/conf.d/_GV_template.inc");
- $vars = array();
+ $vars = [];
$error = false;
foreach ($GV as $section) {
@@ -94,7 +94,7 @@ class setup
if ($variable['type'] !== 'integer' && $variable['type'] !== 'boolean')
$datas[$variable['name']] = $datas[$variable['name']];
- $vars[$variable['name']] = array('value' => $datas[$variable['name']], 'type' => $type);
+ $vars[$variable['name']] = ['value' => $datas[$variable['name']], 'type' => $type];
}
}
@@ -117,55 +117,55 @@ class setup
$phpFinder = new PhpExecutableFinder();
$finder = new ExecutableFinder();
- return array(
- 'php' => array(
+ return [
+ 'php' => [
'name' => 'PHP CLI',
'binary' => $phpFinder->find()
- ),
- 'phraseanet_indexer' => array(
+ ],
+ 'phraseanet_indexer' => [
'name' => 'Indexeur Phrasea',
'binary' => $finder->find('phraseanet_indexer')
- ),
- 'convert' => array(
+ ],
+ 'convert' => [
'name' => 'ImageMagick (convert)',
'binary' => $finder->find('convert')
- ),
- 'composite' => array(
+ ],
+ 'composite' => [
'name' => 'ImageMagick (composite)',
'binary' => $finder->find('composite')
- ),
- 'pdf2swf' => array(
+ ],
+ 'pdf2swf' => [
'name' => 'PDF 2 SWF',
'binary' => $finder->find('pdf2swf')
- ),
- 'unoconv' => array(
+ ],
+ 'unoconv' => [
'name' => 'Unoconv',
'binary' => $finder->find('unoconv')
- ),
- 'swfextract' => array(
+ ],
+ 'swfextract' => [
'name' => 'SWFextract',
'binary' => $finder->find('swfextract')
- ),
- 'swfrender' => array(
+ ],
+ 'swfrender' => [
'name' => 'SWFrender',
'binary' => $finder->find('swfrender')
- ),
- 'MP4Box' => array(
+ ],
+ 'MP4Box' => [
'name' => 'MP4Box',
'binary' => $finder->find('MP4Box')
- ),
- 'xpdf' => array(
+ ],
+ 'xpdf' => [
'name' => 'XPDF',
'binary' => $finder->find('xpdf')
- ),
- 'ffmpeg' => array(
+ ],
+ 'ffmpeg' => [
'name' => 'FFmpeg',
'binary' => $finder->find('ffmpeg')
- ),
- 'recess' => array(
+ ],
+ 'recess' => [
'name' => 'Recesss',
'binary' => $finder->find('recess')
- ),
- );
+ ],
+ ];
}
}
diff --git a/lib/classes/thesaurus.php b/lib/classes/thesaurus.php
index 5e1992017f..d32d517753 100644
--- a/lib/classes/thesaurus.php
+++ b/lib/classes/thesaurus.php
@@ -5,6 +5,6 @@ class thesaurus
public static function xquery_escape($s)
{
- return(str_replace(array("&", "\"", "'"), array("&", """, "'"), $s));
+ return(str_replace(["&", "\"", "'"], ["&", """, "'"], $s));
}
}
diff --git a/lib/classes/thesaurus/xpath.php b/lib/classes/thesaurus/xpath.php
index 288af8e015..15c9020985 100644
--- a/lib/classes/thesaurus/xpath.php
+++ b/lib/classes/thesaurus/xpath.php
@@ -20,7 +20,7 @@ class thesaurus_xpath extends DOMXPath
*
* @var array
*/
- protected static $r = array();
+ protected static $r = [];
/**
*
diff --git a/lib/classes/unicode.php b/lib/classes/unicode.php
index 12e38f1b93..4b53458fb8 100644
--- a/lib/classes/unicode.php
+++ b/lib/classes/unicode.php
@@ -20,8 +20,8 @@ class unicode
const CONVERT_TO_ND = 'nd'; // no-diacritics
const CONVERT_TO_LCND = 'lcnd'; // lowercase no-diacritics
- protected static $map = array(
- self::CONVERT_TO_LC => array(
+ protected static $map = [
+ self::CONVERT_TO_LC => [
"\x41" => "\x61" , /* U+0041: LATIN CAPITAL LETTER A -> U+0061: LATIN SMALL LETTER A */
"\x42" => "\x62" , /* U+0042: LATIN CAPITAL LETTER B -> U+0062: LATIN SMALL LETTER B */
"\x43" => "\x63" , /* U+0043: LATIN CAPITAL LETTER C -> U+0063: LATIN SMALL LETTER C */
@@ -486,9 +486,9 @@ class unicode
"\xD5\x94" => "\xD6\x84" , /* U+0554: ARMENIAN CAPITAL LETTER KEH -> U+0584: ARMENIAN SMALL LETTER KEH */
"\xD5\x95" => "\xD6\x85" , /* U+0555: ARMENIAN CAPITAL LETTER OH -> U+0585: ARMENIAN SMALL LETTER OH */
"\xD5\x96" => "\xD6\x86" /* U+0556: ARMENIAN CAPITAL LETTER FEH -> U+0586: ARMENIAN SMALL LETTER FEH */
- ),
+ ],
- self::CONVERT_TO_ND => array(
+ self::CONVERT_TO_ND => [
"\xC2\xA0" => "\x20" , /* U+00A0: NO-BREAK SPACE -> U+0020: SPACE */
"\xC2\xA8" => "\x20" , /* U+00A8: DIAERESIS -> U+0020: SPACE */
"\xC2\xAA" => "\x61" , /* U+00AA: FEMININE ORDINAL INDICATOR -> U+0061: LATIN SMALL LETTER A */
@@ -864,9 +864,9 @@ class unicode
"\xD3\xB5" => "\xD1\x87", /* U+04F5: CYRILLIC SMALL LETTER CHE WITH DIAERESIS -> U+0447: CYRILLIC SMALL LETTER CHE */
"\xD3\xB8" => "\xD0\xAB", /* U+04F8: CYRILLIC CAPITAL LETTER YERU WITH DIAERESIS -> U+042B: CYRILLIC CAPITAL LETTER YERU */
"\xD3\xB9" => "\xD1\x8B" /* U+04F9: CYRILLIC SMALL LETTER YERU WITH DIAERESIS -> U+044B: CYRILLIC SMALL LETTER YERU */
- ),
+ ],
- self::CONVERT_TO_LCND => array(
+ self::CONVERT_TO_LCND => [
"\x41" => "\x61" , /* U+0041: LATIN CAPITAL LETTER A -> U+0061: LATIN SMALL LETTER A */
"\x42" => "\x62" , /* U+0042: LATIN CAPITAL LETTER B -> U+0062: LATIN SMALL LETTER B */
"\x43" => "\x63" , /* U+0043: LATIN CAPITAL LETTER C -> U+0063: LATIN SMALL LETTER C */
@@ -1543,8 +1543,8 @@ class unicode
"\xD5\x94" => "\xD6\x84" , /* U+0554: ARMENIAN CAPITAL LETTER KEH -> U+0584: ARMENIAN SMALL LETTER KEH */
"\xD5\x95" => "\xD6\x85" , /* U+0555: ARMENIAN CAPITAL LETTER OH -> U+0585: ARMENIAN SMALL LETTER OH */
"\xD5\x96" => "\xD6\x86" /* U+0556: ARMENIAN CAPITAL LETTER FEH -> U+0586: ARMENIAN SMALL LETTER FEH */
- )
- );
+ ]
+ ];
protected $endCharacters_utf8 = "\t\r\n !\"#\$%&'()+,-./:;<=>@[\]^_`{|}~£§¨°";
@@ -1719,10 +1719,10 @@ class unicode
if (is_null($chars_in)) {
- $chars_in = array();
+ $chars_in = [];
for ($cc = 0; $cc < 32; $cc ++) {
- if (in_array($cc, array(9, 10, 13))) {
+ if (in_array($cc, [9, 10, 13])) {
continue;
}
@@ -1748,7 +1748,7 @@ class unicode
*/
public function parseDate($date)
{
- $date = str_replace(array('-', ':', '/', '.'), ' ', $date);
+ $date = str_replace(['-', ':', '/', '.'], ' ', $date);
$date_yyyy = $date_mm = $date_dd = $date_hh = $date_ii = $date_ss = 0;
switch (sscanf($date, '%d %d %d %d %d %d', $date_yyyy, $date_mm, $date_dd, $date_hh, $date_ii, $date_ss)) {
diff --git a/lib/classes/uuid.php b/lib/classes/uuid.php
index 331cfbd8db..0a6796c992 100644
--- a/lib/classes/uuid.php
+++ b/lib/classes/uuid.php
@@ -22,7 +22,7 @@ class uuid
}
// Get hexadecimal components of namespace
- $nhex = str_replace(array('-', '{', '}'), '', $namespace);
+ $nhex = str_replace(['-', '{', '}'], '', $namespace);
// Binary Value
$nstr = '';
@@ -89,7 +89,7 @@ class uuid
}
// Get hexadecimal components of namespace
- $nhex = str_replace(array('-', '{', '}'), '', $namespace);
+ $nhex = str_replace(['-', '{', '}'], '', $namespace);
// Binary Value
$nstr = '';
diff --git a/lib/conf.d/PhraseaFixture/Basket/LoadOneBasketEnv.php b/lib/conf.d/PhraseaFixture/Basket/LoadOneBasketEnv.php
index c0276751dc..77df0977cb 100644
--- a/lib/conf.d/PhraseaFixture/Basket/LoadOneBasketEnv.php
+++ b/lib/conf.d/PhraseaFixture/Basket/LoadOneBasketEnv.php
@@ -34,12 +34,12 @@ class LoadOneBasketEnv extends \PhraseaFixture\AbstractWZ implements FixtureInte
/**
* @var Array
*/
- protected $participants = array();
+ protected $participants = [];
/**
* @var Array
*/
- protected $basketElements = array();
+ protected $basketElements = [];
public function addParticipant(\User_Adapter $user)
{
diff --git a/lib/conf.d/_GV_template.inc b/lib/conf.d/_GV_template.inc
index 62c401375a..d4a6b228a5 100644
--- a/lib/conf.d/_GV_template.inc
+++ b/lib/conf.d/_GV_template.inc
@@ -13,19 +13,19 @@ return call_user_func_array(function(Application $app) {
$create_api_dailymotion = 'http://www.dailymotion.com/profile/developer';
try {
- $youtube_callback = $app->url('prod_bridge_callback', array('api_name' => 'youtube'));
+ $youtube_callback = $app->url('prod_bridge_callback', ['api_name' => 'youtube']);
} catch (RouteNotFoundException $e) {
$youtube_callback = null;
}
try {
- $flickr_callback = $app->url('prod_bridge_callback', array('api_name' => 'flickr'));
+ $flickr_callback = $app->url('prod_bridge_callback', ['api_name' => 'flickr']);
} catch (RouteNotFoundException $e) {
$flickr_callback = null;
}
try {
- $dailymotion_callback = $app->url('prod_bridge_callback', array('api_name' => 'dailymotion'));
+ $dailymotion_callback = $app->url('prod_bridge_callback', ['api_name' => 'dailymotion']);
} catch (RouteNotFoundException $e) {
$dailymotion_callback = null;
}
@@ -33,638 +33,638 @@ return call_user_func_array(function(Application $app) {
$recaptchaDoc = 'http://www.google.com/recaptcha';
$imagineDoc = 'http://imagine.readthedocs.org/en/latest/usage/introduction.html';
- return array(
- array(
+ return [
+ [
'section' => _('HTTP Server'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_ENUM,
'name' => 'GV_default_lng',
'comment' => _('Default language'),
'default' => 'fr_FR',
'available' => $avLanguages,
'required' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_STATIC_URL',
'end_slash' => false,
'comment' => _('Static URL'),
'help' => _('optional'),
'default' => '',
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Maintenance state'),
'rolled' => true,
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_TEXT,
'name' => 'GV_message',
'comment' => _('Maintenance message'),
'default' => "May the force be with you"
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_message_on',
'comment' => _('Enable maintenance message broadcast'),
'default' => false
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_log_errors',
'comment' => _('Log errors'),
'default' => false
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Webservices connectivity'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_google_api',
'comment' => _('Use Google API'),
'default' => true,
'required' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_i18n_service',
'comment' => _('Geonames server address'),
'default' => 'https://geonames.alchemyasp.com/',
'end_slash' => true,
'required' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_captchas',
'comment' => _('Use recaptcha API'),
'help' => _(sprintf('See documentation at %s', $recaptchaDoc)),
'default' => false,
'required' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_captcha_public_key',
'comment' => _('Recaptcha public key'),
'default' => ''
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_captcha_private_key',
'comment' => _('Recaptcha private key'),
'default' => ''
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Youtube connectivity'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_youtube_api',
'comment' => _('Use youtube API'),
'help' => sprintf(_('Create API account at %s, then use %s as callback URL value'), $youtube_console_url, $youtube_callback),
'default' => false,
'required' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_youtube_client_id',
'comment' => _('Youtube public key'),
'default' => ''
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_youtube_client_secret',
'comment' => _('Youtube secret key'),
'default' => ''
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_youtube_dev_key',
'comment' => _('Youtube developer key'),
'help' => sprintf(_('See %s'), $dashboard_youtube),
'default' => ''
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('FlickR connectivity'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_flickr_api',
'comment' => _('Use Flickr API'),
'help' => sprintf(_('Create API account at %s, then use %s as callback URL value'), $create_api_flickr, $flickr_callback),
'default' => false,
'required' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_flickr_client_id',
'comment' => _('Flickr public key'),
'default' => ''
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_flickr_client_secret',
'comment' => _('Flickr secret key'),
'default' => ''
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Dailymotion connectivity'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_dailymotion_api',
'comment' => _('Use Dailymotion API'),
'help' => sprintf(_('Create API account at %s, then use %s as callback URL value'), $create_api_dailymotion, $dailymotion_callback),
'default' => false,
'required' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_dailymotion_client_id',
'comment' => _('Dailymotion public key'),
'default' => ''
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_dailymotion_client_secret',
'comment' => _('Dailymotion secret key'),
'default' => ''
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Phraseanet client API'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_client_navigator',
'comment' => _('Authorize *Phraseanet Navigator*'),
'help' => _('*Phraseanet Navigator* is a smartphone application that allow user to connect on this instance'),
'default' => true,
'required' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_client_officeplugin',
'comment' => _('Authorize Microsoft Office Plugin to connect.'),
'default' => true,
'required' => true
- ),
- )
- ), array(
+ ],
+ ]
+ ], [
'section' => _('Documents storage'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_base_datapath_noweb',
'end_slash' => true,
'comment' => _('Default path for datas'),
'default' => '',
'required' => true
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Executables settings'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_h264_streaming',
'comment' => _('Enable H264 stream mode'),
'help' => _('Use with mod_token. Attention requires the apache modules and mod_h264_streaming mod_auth_token'),
'default' => false
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_mod_auth_token_directory',
'end_slash' => true,
'comment' => _('Auth_token mount point'),
'default' => false
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_mod_auth_token_directory_path',
'end_slash' => false,
'comment' => _('Auth_token directory path'),
'default' => false
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_mod_auth_token_passphrase',
'comment' => _('Auth_token passphrase'),
'help' => _('Defined in Apache configuration'),
'default' => false
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_PHP_INI',
'comment' => _('php.ini path'),
'help' => _('Empty if not used'),
'default' => ''
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_ENUM,
'name' => 'GV_imagine_driver',
'default' => '',
'comment' => _('Imagine driver'),
'help' => _(sprintf('See documentation at %s', $imagineDoc)),
- 'available' => array(
+ 'available' => [
'' => 'Auto',
'gmagick' => 'GraphicsMagick',
'imagick' => 'ImageMagick',
'gd' => 'GD',
- )
- ),
- array(
+ ]
+ ],
+ [
'type' => \registry::TYPE_INTEGER,
'name' => 'GV_ffmpeg_threads',
'comment' => _('Number of threads to use for FFMpeg'),
'default' => 2
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_INTEGER,
'name' => 'GV_pdfmaxpages',
'comment' => _('Maximum number of pages to be extracted from PDF'),
'default' => 5
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Main configuration'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_adminMail',
'comment' => _('Admin email'),
'default' => 'support@alchemy.fr'
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_view_bas_and_coll',
'comment' => _('Display the name of databases and collections'),
'default' => true,
'required' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_choose_export_title',
'comment' => _('Choose the title of the document to export'),
'default' => false,
'required' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_ENUM,
'name' => 'GV_default_export_title',
'comment' => _('Default export title'),
'default' => 'title',
- 'available' => array(
+ 'available' => [
'title' => _('Document title'),
'original' => _('Original name'),
- )
- ),
- array(
+ ]
+ ],
+ [
'type' => \registry::TYPE_ENUM,
'name' => 'GV_social_tools',
'comment' => _('Enable this setting to share on Facebook and Twitter'),
- 'available' => array(
+ 'available' => [
'none' => _('Disabled'),
'publishers' => _('Publishers'),
'all' => _('Enabled'),
- ),
+ ],
'default' => 'none',
'required' => false
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Homepage'),
'rolled' => true,
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_ENUM,
'name' => 'GV_home_publi',
'comment' => _('Homepage slideshow'),
'default' => 'COOLIRIS',
- 'available' => array(
+ 'available' => [
'DISPLAYx1' => _('Single image'),
'SCROLL' => _('Slide show'),
'COOLIRIS' => 'Cooliris',
'CAROUSEL' => _('Carousel'),
'GALLERIA' => _('Gallery')
- ),
+ ],
'required' => true
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Search engine'),
'rolled' => true,
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_INTEGER,
'name' => 'GV_min_letters_truncation',
'comment' => _('Minimum number of letters before truncation'),
'help' => _('Used in search engine'),
'default' => 1
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_defaultQuery',
'comment' => _('Default query'),
'default' => 'all'
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_ENUM,
'name' => 'GV_defaultQuery_type',
'comment' => _('Default searched type'),
'help' => _('Used when opening the application'),
- 'available' => array(
+ 'available' => [
'0' => _('Documents'),
'1' => _('Stories'),
- ),
+ ],
'default' => '0'
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Report'),
'rolled' => true,
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_anonymousReport',
'comment' => _('Anonymous report'),
'help' => _('Hide information about users'),
'default' => false,
'required' => true
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Additionnal modules'),
'rolled' => true,
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_thesaurus',
'comment' => _('Enable thesaurus'),
'default' => true
- ), array(
+ ], [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_multiAndReport',
'comment' => _('Enable multi-doc mode'),
'default' => true
- ), array(
+ ], [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_seeOngChgDoc',
'comment' => _('Enable HD substitution'),
'default' => false
- ), array(
+ ], [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_seeNewThumb',
'comment' => _('Enable thumbnail substitution'),
'default' => false
- )
- )
- )
- , array(
+ ]
+ ]
+ ]
+ , [
'section' => _('Emails'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_defaulmailsenderaddr',
'comment' => _('Default mail sender address'),
'default' => 'phraseanet@example.com'
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_email_prefix',
'comment' => _('Prefix for notification emails'),
'default' => ''
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_smtp',
'comment' => _('Use a SMTP server'),
'default' => false
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_smtp_auth',
'comment' => _('Enable SMTP authentication'),
'default' => false
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_smtp_host',
'comment' => _('SMTP host'),
'default' => ''
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_smtp_port',
'comment' => _('SMTP port'),
'default' => ''
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_ENUM,
'name' => 'GV_smtp_secure',
'comment' => _('SMTP encryption'),
'default' => 'tls',
- 'available' => array(
+ 'available' => [
'none' => _('None'),
'ssl' => 'SSL',
'tls' => 'TLS'
- ),
- ),
- array(
+ ],
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_smtp_user',
'comment' => _('SMTP user'),
'default' => ''
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_smtp_password',
'comment' => _('SMTP password'),
'default' => ''
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('FTP Export'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_activeFTP',
'comment' => _('Enable FTP export'),
'help' => _('Available in multi-export tab'),
'default' => false
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_ftp_for_user',
'comment' => _('Enable FTP for users'),
'help' => _('By default it is available for admins'),
'default' => false
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Client'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_INTEGER,
'name' => 'GV_download_max',
'comment' => _('Maximum megabytes allowed for download'),
'help' => _('If request is bigger, then mail is still available'),
'default' => 120
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_INTEGER,
'name' => 'GV_ong_search',
'comment' => _('Search tab position'),
'default' => 1
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_INTEGER,
'name' => 'GV_ong_advsearch',
'comment' => _('Advanced search tab position'),
'default' => 2
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_INTEGER,
'name' => 'GV_ong_topics',
'comment' => _('Topics tab position'),
'default' => 0
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_INTEGER,
'name' => 'GV_ong_actif',
'comment' => _('Active tab position'),
'default' => 1
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_ENUM,
'name' => 'GV_client_render_topics',
'comment' => _('Topics display mode'),
- 'available' => array(
+ 'available' => [
'tree' => _('Trees'),
'popups' => _('Drop-down'),
- ),
+ ],
'default' => 'tree'
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_rollover_reg_preview',
'comment' => _('Enable roll-over on stories'),
'default' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_rollover_chu',
'comment' => _('Enable roll-over on basket elements'),
'default' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_ENUM,
'name' => 'GV_client_coll_ckbox',
'comment' => _('Collections display mode'),
'default' => 'checkbox',
- 'available' => array(
+ 'available' => [
'popup' => _('Drop-down'),
'checkbox' => _('Check-box'),
- )
- ),
- array(
+ ]
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_viewSizeBaket',
'comment' => _('Display the total size of the document basket'),
'default' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_clientAutoShowProposals',
'comment' => _('Display proposals tab'),
'default' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_needAuth2DL',
'comment' => _('Require authentication to download documents'),
'help' => _('Used for guest account'),
'default' => true
- ),
- array(
+ ],
+ [
'type' => 'boolean',
'name' => 'GV_requireTOUValidationForExport',
'comment' => _('Users must accept Terms of Use for each export'),
'default' => false
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Registration'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_autoselectDB',
'comment' => _('Auto select databases'),
'help' => _('This option disables the selecting of the databases on which a user can register himself, and registration is made on all granted databases.'),
'default' => true
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_autoregister',
'comment' => _('Enable auto registration'),
'default' => false
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Push configuration'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_INTEGER,
'name' => 'GV_validation_reminder',
'comment' => _('Number of days before the end of the validation to send a reminder email'),
'default' => 2
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_INTEGER,
'name' => 'GV_val_expiration',
'comment' => _('Default validation links duration'),
'help' => _('If set to 0, duration is permanent'),
'default' => 10
- )
- )
- ), array(
+ ]
+ ]
+ ], [
'section' => _('Robot indexing'),
- 'vars' => array(
- array(
+ 'vars' => [
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_homeTitle',
'comment' => _('Application title'),
'default' => 'Phraseanet'
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_metaKeywords',
'comment' => _('Keywords used for indexing purposes by search engines robots'),
'default' => ''
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_TEXT,
'name' => 'GV_metaDescription',
'comment' => _('Application description'),
'default' => ''
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_STRING,
'name' => 'GV_googleAnalytics',
'comment' => _('Google Analytics identifier'),
'default' => ''
- ),
- array(
+ ],
+ [
'type' => \registry::TYPE_BOOLEAN,
'name' => 'GV_allow_search_engine',
'comment' => _('Allow the website to be indexed by search engines like Google'),
'default' => true
- ),
- )
- )
- );
-}, array($app));
+ ],
+ ]
+ ]
+ ];
+}, [$app]);
diff --git a/lib/conf.d/minifyGroupsConfig.php b/lib/conf.d/minifyGroupsConfig.php
index 727d5a35be..587e5672da 100644
--- a/lib/conf.d/minifyGroupsConfig.php
+++ b/lib/conf.d/minifyGroupsConfig.php
@@ -8,19 +8,19 @@
* You may wish to use the Minify URI Builder app to suggest
* changes. http://yourdomain/min/builder/
* */
-$groups = array(
- 'authentication_css' => array(
+$groups = [
+ 'authentication_css' => [
'//assets/normalize-css/normalize.css',
'//assets/build/login.css',
'//assets/font-awesome/css/font-awesome.css',
'//assets/jquery.ui/themes/base/jquery.ui.autocomplete.css'
- ),
- 'authentication' => array(
+ ],
+ 'authentication' => [
'//assets/modernizr/modernizr.js',
'//assets/requirejs/require.js',
'//scripts/apps/login/home/config.js'
- ),
- 'client' => array(
+ ],
+ 'client' => [
'//assets/swfobject/swfobject.js'
, '//assets/jquery.ui/i18n/jquery-ui-i18n.js'
, '//assets/jquery.cookie/jquery.cookie.js'
@@ -33,8 +33,8 @@ $groups = array(
, '//include/jquery.tooltip.js'
, '//include/jquery.p4.preview.js'
, '//include/jquery.image_enhancer.js'
- , '//include/jslibs/jquery.contextmenu_scroll.js'),
- 'admin' => array(
+ , '//include/jslibs/jquery.contextmenu_scroll.js'],
+ 'admin' => [
'//assets/modernizr/modernizr.js'
, '//assets/underscore-amd/underscore.js'
, '//assets/jquery.cookie/jquery.cookie.js'
@@ -51,8 +51,8 @@ $groups = array(
, '//assets/blueimp-load-image/load-image.js'
, '//assets/jquery-file-upload/jquery.iframe-transport.js'
, '//assets/jquery-file-upload/jquery.fileupload.js'
- ),
- 'report' => array(
+ ],
+ 'report' => [
'//assets/jquery.ui/i18n/jquery-ui-i18n.js'
, '//assets/jquery.cookie/jquery.cookie.js'
, '//include/jquery.common.js'
@@ -62,11 +62,11 @@ $groups = array(
, '//include/jslibs/jquery.cluetip.js'
, '//include/jquery.nicoslider.js'
, '//skins/report/report.js'
- ),
- 'modalBox' => array(
+ ],
+ 'modalBox' => [
'//assets/jquery.ui/i18n/jquery-ui-i18n.js'
- ),
- 'prod' => array(
+ ],
+ 'prod' => [
'//assets/swfobject/swfobject.js'
, '//assets/underscore-amd/underscore.js'
, '//assets/json2/json2.js'
@@ -105,8 +105,8 @@ $groups = array(
, '//include/jquery.image_enhancer.js'
, '//include/jslibs/jquery.contextmenu_scroll.js'
, '//include/jslibs/jquery-treeview/jquery.treeview.js'
- , '//include/jslibs/jquery-treeview/jquery.treeview.async.js'),
- 'thesaurus' => array(
+ , '//include/jslibs/jquery-treeview/jquery.treeview.async.js'],
+ 'thesaurus' => [
'//assets/jquery.cookie/jquery.cookie.js'
, '//include/jslibs/jquery.contextmenu_scroll.js'
, '//include/jquery.common.js'
@@ -114,8 +114,8 @@ $groups = array(
, '//skins/thesaurus/xmlhttp.js'
, '//skins/thesaurus/thesaurus.js'
, '//skins/thesaurus/sprintf.js'
- ),
- 'lightbox' => array(
+ ],
+ 'lightbox' => [
'//include/jslibs/jquery.mousewheel.js'
, '//include/jquery.tooltip.js'
, '//assets/swfobject/swfobject.js'
@@ -126,8 +126,8 @@ $groups = array(
, '//skins/prod/jquery.Dialog.js'
, '//skins/lightbox/jquery.lightbox.js'
, '//include/jslibs/flowplayer/flowplayer-3.2.11.min.js'
- ),
- 'lightboxie6' => array(
+ ],
+ 'lightboxie6' => [
'//include/jslibs/jquery.mousewheel.js'
, '//include/jquery.tooltip.js'
, '//assets/swfobject/swfobject.js'
@@ -138,11 +138,11 @@ $groups = array(
, '//skins/prod/jquery.Dialog.js'
, '//skins/lightbox/jquery.lightbox.ie6.js'
, '//include/jslibs/flowplayer/flowplayer-3.2.11.min.js'
- ),
- 'uploadflash' => array(
+ ],
+ 'uploadflash' => [
'//include/jslibs/SWFUpload/swfupload.js'
, '//include/jslibs/SWFUpload/plugins/swfupload.queue.js'
- )
-);
+ ]
+];
return $groups;
diff --git a/lib/conf.d/plugins/twig-paths.php b/lib/conf.d/plugins/twig-paths.php
index 76caea049b..1244a18051 100644
--- a/lib/conf.d/plugins/twig-paths.php
+++ b/lib/conf.d/plugins/twig-paths.php
@@ -3,5 +3,4 @@
// This file is automatically generated, please do not edit it.
// To update configuration, use bin/console plugins:* commands.
-return array(
-);
+return [];
diff --git a/localesToLaunchPad.php b/localesToLaunchPad.php
index d48541ec9d..5d21120950 100755
--- a/localesToLaunchPad.php
+++ b/localesToLaunchPad.php
@@ -22,9 +22,9 @@ $finder
->files()
->name('phraseanet.po')
->in(
- array(
+ [
__DIR__ . '/locale',
- )
+ ]
)
;
diff --git a/tests/Alchemy/Tests/Phrasea/Application/ApiAbstract.php b/tests/Alchemy/Tests/Phrasea/Application/ApiAbstract.php
index 0cae88a02f..91102f7e14 100644
--- a/tests/Alchemy/Tests/Phrasea/Application/ApiAbstract.php
+++ b/tests/Alchemy/Tests/Phrasea/Application/ApiAbstract.php
@@ -49,9 +49,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
* @var \API_OAuth2_Application
*/
protected static $adminApplication;
- protected static $databoxe_ids = array();
+ protected static $databoxe_ids = [];
- abstract public function getParameters(array $parameters = array());
+ abstract public function getParameters(array $parameters = []);
abstract public function unserialize($data);
@@ -144,7 +144,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
});
$this->setToken(self::$token);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$this->assertEquals(1, $preEvent);
}
@@ -153,26 +153,26 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
{
$this->assertCount(0, self::$DI['app']['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Session')->findAll());
$this->setToken(self::$token);
- self::$DI['client']->request('GET', '/api/v1/databoxes/list/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', '/api/v1/databoxes/list/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$this->assertCount(0, self::$DI['app']['EM']->getRepository('Alchemy\Phrasea\Model\Entities\Session')->findAll());
}
public function provideEventNames()
{
- return array(
- array(PhraseaEvents::PRE_AUTHENTICATE, 'Alchemy\Phrasea\Core\Event\PreAuthenticate', '/api/v1/databoxes/list/', Context::CONTEXT_OAUTH2_TOKEN),
- array(PhraseaEvents::API_OAUTH2_START, 'Alchemy\Phrasea\Core\Event\ApiOAuth2StartEvent', '/api/v1/databoxes/list/', null),
- array(PhraseaEvents::API_OAUTH2_END, 'Alchemy\Phrasea\Core\Event\ApiOAuth2EndEvent', '/api/v1/databoxes/list/', null),
- array(PhraseaEvents::API_RESULT, 'Alchemy\Phrasea\Core\Event\ApiResultEvent', '/api/v1/databoxes/list/', null),
- array(PhraseaEvents::API_RESULT, 'Alchemy\Phrasea\Core\Event\ApiResultEvent', '/api/v1/no-route', null),
- );
+ return [
+ [PhraseaEvents::PRE_AUTHENTICATE, 'Alchemy\Phrasea\Core\Event\PreAuthenticate', '/api/v1/databoxes/list/', Context::CONTEXT_OAUTH2_TOKEN],
+ [PhraseaEvents::API_OAUTH2_START, 'Alchemy\Phrasea\Core\Event\ApiOAuth2StartEvent', '/api/v1/databoxes/list/', null],
+ [PhraseaEvents::API_OAUTH2_END, 'Alchemy\Phrasea\Core\Event\ApiOAuth2EndEvent', '/api/v1/databoxes/list/', null],
+ [PhraseaEvents::API_RESULT, 'Alchemy\Phrasea\Core\Event\ApiResultEvent', '/api/v1/databoxes/list/', null],
+ [PhraseaEvents::API_RESULT, 'Alchemy\Phrasea\Core\Event\ApiResultEvent', '/api/v1/no-route', null],
+ ];
}
public function testRouteNotFound()
{
$route = '/api/v1/nothinghere';
$this->setToken(self::$token);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponseNotFound(self::$DI['client']->getResponse());
@@ -187,7 +187,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
public function testDataboxListRoute()
{
$this->setToken(self::$token);
- self::$DI['client']->request('GET', '/api/v1/databoxes/list/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', '/api/v1/databoxes/list/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -223,7 +223,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$account = \API_OAuth2_Account::create(self::$DI['app'], self::$DI['user'], $nativeApp);
$token = $account->get_token()->get_value();
$this->setToken($token);
- self::$DI['client']->request('GET', '/api/v1/databoxes/list/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', '/api/v1/databoxes/list/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
if (403 != $content['meta']['http_code']) {
@@ -247,31 +247,31 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
{
$this->setToken(self::$token);
- self::$DI['client']->request('GET', '/api/v1/monitor/tasks/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', '/api/v1/monitor/tasks/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->assertEquals(401, $content['meta']['http_code']);
- self::$DI['client']->request('GET', '/api/v1/monitor/scheduler/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', '/api/v1/monitor/scheduler/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->assertEquals(401, $content['meta']['http_code']);
- self::$DI['client']->request('GET', '/api/v1/monitor/task/1/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', '/api/v1/monitor/task/1/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->assertEquals(401, $content['meta']['http_code']);
- self::$DI['client']->request('POST', '/api/v1/monitor/task/1/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', '/api/v1/monitor/task/1/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->assertEquals(401, $content['meta']['http_code']);
- self::$DI['client']->request('POST', '/api/v1/monitor/task/1/start/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', '/api/v1/monitor/task/1/start/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->assertEquals(401, $content['meta']['http_code']);
- self::$DI['client']->request('POST', '/api/v1/monitor/task/1/stop/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', '/api/v1/monitor/task/1/stop/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->assertEquals(401, $content['meta']['http_code']);
- self::$DI['client']->request('GET', '/api/v1/monitor/phraseanet/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', '/api/v1/monitor/phraseanet/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->assertEquals(401, $content['meta']['http_code']);
}
@@ -289,9 +289,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$adminToken);
$route = '/api/v1/monitor/tasks/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -318,9 +318,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$adminToken);
$route = '/api/v1/monitor/scheduler/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -373,10 +373,10 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->assertInternalType('integer', $task['pid']);
}
- $av_states = array(
+ $av_states = [
Task::STATUS_STARTED,
Task::STATUS_STOPPED,
- );
+ ];
$this->assertContains($task['state'], $av_states);
$this->assertInternalType('string', $task['name']);
@@ -409,9 +409,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$idTask = $tasks[0]->getId();
$route = '/api/v1/monitor/task/' . $idTask . '/';
- $this->evaluateMethodNotAllowedRoute($route, array('PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
$this->evaluateMeta200($content);
@@ -441,11 +441,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$idTask = $tasks[0]->getId();
$route = '/api/v1/monitor/task/' . $idTask . '/';
- $this->evaluateMethodNotAllowedRoute($route, array('PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['PUT', 'DELETE']);
$title = 'newTitle' . mt_rand();
- self::$DI['client']->request('POST', $route, $this->getParameters(array('title' => $title)), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters(['title' => $title]), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
$this->evaluateMeta200($content);
@@ -466,7 +466,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
}
$this->setToken(self::$adminToken);
self::$DI['client']->followRedirects();
- self::$DI['client']->request('GET', '/api/v1/monitor/task/0/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', '/api/v1/monitor/task/0/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateMetaNotFound($content);
}
@@ -492,9 +492,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$idTask = $tasks[0]->getId();
$route = '/api/v1/monitor/task/' . $idTask . '/start/';
- $this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['GET', 'PUT', 'DELETE']);
- self::$DI['client']->request('POST', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
$this->evaluateMeta200($content);
@@ -527,9 +527,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$idTask = $tasks[0]->getId();
$route = '/api/v1/monitor/task/' . $idTask . '/stop/';
- $this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['GET', 'PUT', 'DELETE']);
- self::$DI['client']->request('POST', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
$this->evaluateMeta200($content);
@@ -556,7 +556,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$adminToken);
- self::$DI['client']->request('GET', '/api/v1/monitor/phraseanet/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', '/api/v1/monitor/phraseanet/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -579,8 +579,8 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$token);
$route = '/api/v1/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -589,11 +589,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->evaluateGoodRecord($content['response']['record']);
$route = '/api/v1/records/1234567890/1/';
- $this->evaluateNotFoundRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateNotFoundRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
$route = '/api/v1/records/kjslkz84spm/sfsd5qfsd5/';
- $this->evaluateBadRequestRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateBadRequestRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
}
/**
@@ -613,8 +613,8 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
self::$DI['app']['session']->remove('usr_id');
$route = '/api/v1/stories/' . self::$DI['record_story_1']->get_sbas_id() . '/' . self::$DI['record_story_1']->get_record_id() . '/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -624,11 +624,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->assertGreaterThan(0, $content['response']['story']['records']);
$route = '/api/v1/stories/1234567890/1/';
- $this->evaluateNotFoundRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateNotFoundRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
$route = '/api/v1/stories/kjslkz84spm/sfsd5qfsd5/';
- $this->evaluateBadRequestRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateBadRequestRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
}
/**
@@ -641,9 +641,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$token);
foreach (static::$databoxe_ids as $databox_id) {
$route = '/api/v1/databoxes/' . $databox_id . '/collections/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- $crawler = self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
$this->evaluateMeta200($content);
@@ -669,11 +669,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
}
}
$route = '/api/v1/databoxes/24892534/collections/';
- $this->evaluateNotFoundRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateNotFoundRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
$route = '/api/v1/databoxes/any_bad_id/collections/';
- $this->evaluateBadRequestRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateBadRequestRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
}
/**
@@ -687,9 +687,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$databox = self::$DI['app']['phraseanet.appbox']->get_databox($databox_id);
$ref_status = $databox->get_statusbits();
$route = '/api/v1/databoxes/' . $databox_id . '/status/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- $crawler = self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
$this->evaluateMeta200($content);
@@ -722,11 +722,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
}
}
$route = '/api/v1/databoxes/24892534/status/';
- $this->evaluateNotFoundRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateNotFoundRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
$route = '/api/v1/databoxes/any_bad_id/status/';
- $this->evaluateBadRequestRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateBadRequestRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
}
/**
@@ -749,9 +749,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
}
$route = '/api/v1/databoxes/' . $databox_id . '/metadatas/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- $crawler = self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
$this->evaluateMeta200($content);
@@ -782,14 +782,14 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->assertTrue((strlen($metadatas['name']) > 0));
$this->assertTrue(is_string($metadatas['separator']));
- $this->assertEquals(array('fr', 'en', 'de', 'nl'), array_keys($metadatas['labels']));
+ $this->assertEquals(['fr', 'en', 'de', 'nl'], array_keys($metadatas['labels']));
if ($metadatas['multivalue']) {
$this->assertTrue((strlen($metadatas['separator']) > 0));
}
$this->assertTrue(is_string($metadatas['thesaurus_branch']));
- $this->assertTrue(in_array($metadatas['type'], array(\databox_field::TYPE_DATE, \databox_field::TYPE_STRING, \databox_field::TYPE_NUMBER, \databox_field::TYPE_TEXT)));
+ $this->assertTrue(in_array($metadatas['type'], [\databox_field::TYPE_DATE, \databox_field::TYPE_STRING, \databox_field::TYPE_NUMBER, \databox_field::TYPE_TEXT]));
$this->assertTrue(is_bool($metadatas['indexable']));
$this->assertTrue(is_bool($metadatas['multivalue']));
$this->assertTrue(is_bool($metadatas['readonly']));
@@ -810,11 +810,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
}
}
$route = '/api/v1/databoxes/24892534/metadatas/';
- $this->evaluateNotFoundRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateNotFoundRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
$route = '/api/v1/databoxes/any_bad_id/metadatas/';
- $this->evaluateBadRequestRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateBadRequestRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
}
/**
@@ -827,9 +827,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$token);
foreach (static::$databoxe_ids as $databox_id) {
$route = '/api/v1/databoxes/' . $databox_id . '/termsOfUse/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
$this->evaluateMeta200($content);
@@ -838,16 +838,16 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
foreach ($content['response']['termsOfUse'] as $terms) {
$this->assertTrue(is_array($terms), 'Une bloc cgu est un objet');
$this->assertArrayHasKey('locale', $terms);
- $this->assertTrue(in_array($terms['locale'], array('fr_FR', 'nl_NL', 'en_GB', 'ar_SA', 'de_DE', 'es_ES')));
+ $this->assertTrue(in_array($terms['locale'], ['fr_FR', 'nl_NL', 'en_GB', 'ar_SA', 'de_DE', 'es_ES']));
$this->assertArrayHasKey('terms', $terms);
}
}
$route = '/api/v1/databoxes/24892534/termsOfUse/';
- $this->evaluateNotFoundRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateNotFoundRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
$route = '/api/v1/databoxes/any_bad_id/termsOfUse/';
- $this->evaluateBadRequestRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateBadRequestRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
}
/**
@@ -858,7 +858,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
public function testSearchRoute()
{
$this->setToken(self::$token);
- $crawler = self::$DI['client']->request('POST', '/api/v1/search/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request('POST', '/api/v1/search/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -894,7 +894,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
self::$DI['record_story_1'];
- $crawler = self::$DI['client']->request('POST', '/api/v1/search/', $this->getParameters(array('search_type' => 1)), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request('POST', '/api/v1/search/', $this->getParameters(['search_type' => 1]), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -926,7 +926,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
public function testRecordsSearchRoute()
{
$this->setToken(self::$token);
- $crawler = self::$DI['client']->request('POST', '/api/v1/records/search/', $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request('POST', '/api/v1/records/search/', $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -956,12 +956,12 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
->disableOriginalConstructor()
->getMock()
));
- $crawler = self::$DI['client']->request($method, '/api/v1/records/search/', $this->getParameters(array('query' => 'koala')), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request($method, '/api/v1/records/search/', $this->getParameters(['query' => 'koala']), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
}
public function provideAvailableSearchMethods()
{
- return array(array('POST'), array('GET'));
+ return [['POST'], ['GET']];
}
/**
@@ -974,9 +974,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->injectMetadatas(self::$DI['record_1']);
$route = '/api/v1/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/caption/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -985,11 +985,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->evaluateRecordsCaptionResponse($content);
$route = '/api/v1/records/24892534/51654651553/caption/';
- $this->evaluateNotFoundRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateNotFoundRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
$route = '/api/v1/records/any_bad_id/sfsd5qfsd5/caption/';
- $this->evaluateBadRequestRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateBadRequestRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
}
/**
@@ -1001,9 +1001,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$token);
$route = '/api/v1/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/metadatas/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1012,11 +1012,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->evaluateRecordsMetadataResponse($content);
$route = '/api/v1/records/24892534/51654651553/metadatas/';
- $this->evaluateNotFoundRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateNotFoundRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
$route = '/api/v1/records/any_bad_id/sfsd5qfsd5/metadatas/';
- $this->evaluateBadRequestRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateBadRequestRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
}
/**
@@ -1027,9 +1027,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$token);
$route = '/api/v1/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/status/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1038,11 +1038,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->evaluateRecordsStatusResponse(self::$DI['record_1'], $content);
$route = '/api/v1/records/24892534/51654651553/status/';
- $this->evaluateNotFoundRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateNotFoundRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
$route = '/api/v1/records/any_bad_id/sfsd5qfsd5/status/';
- $this->evaluateBadRequestRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateBadRequestRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
}
/**
@@ -1057,9 +1057,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$keys = array_keys($this->record->get_subdefs());
$route = '/api/v1/records/' . $this->record->get_sbas_id() . '/' . $this->record->get_record_id() . '/embed/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1071,11 +1071,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->checkEmbed($embed, $this->record);
}
$route = '/api/v1/records/24892534/51654651553/embed/';
- $this->evaluateNotFoundRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateNotFoundRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
$route = '/api/v1/records/any_bad_id/sfsd5qfsd5/embed/';
- $this->evaluateBadRequestRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateBadRequestRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
}
/**
@@ -1095,9 +1095,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$keys = array_keys($story->get_subdefs());
$route = '/api/v1/stories/' . $story->get_sbas_id() . '/' . $story->get_record_id() . '/embed/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1109,11 +1109,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->checkEmbed($embed, $story);
}
$route = '/api/v1/stories/24892534/51654651553/embed/';
- $this->evaluateNotFoundRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateNotFoundRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
$route = '/api/v1/stories/any_bad_id/sfsd5qfsd5/embed/';
- $this->evaluateBadRequestRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateBadRequestRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
$story->delete();
}
@@ -1126,7 +1126,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$route = '/api/v1/records/' . $this->record->get_sbas_id() . '/' . $this->record->get_record_id() . '/embed/';
- self::$DI['client']->request('GET', $route, $this->getParameters(array('mimes' => array('image/jpg', 'image/jpeg'))), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(['mimes' => ['image/jpg', 'image/jpeg']]), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->assertArrayHasKey('embed', $content['response']);
@@ -1145,7 +1145,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$route = '/api/v1/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/embed/';
- self::$DI['client']->request('GET', $route, $this->getParameters(array('devices' => array('nodevice'))), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(['devices' => ['nodevice']]), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->assertEquals(0, count($content['response']['embed']));
@@ -1159,9 +1159,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$token);
$route = '/api/v1/records/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/related/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1173,11 +1173,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
}
$route = '/api/v1/records/24892534/51654651553/related/';
- $this->evaluateNotFoundRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateNotFoundRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
$route = '/api/v1/records/any_bad_id/sfsd5qfsd5/related/';
- $this->evaluateBadRequestRoute($route, array('GET'));
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateBadRequestRoute($route, ['GET']);
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
}
/**
@@ -1195,7 +1195,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$route = '/api/v1/records/' . $record->get_sbas_id() . '/' . $record->get_record_id() . '/setmetadatas/';
$caption = $record->get_caption();
- $toupdate = array();
+ $toupdate = [];
foreach ($record->get_databox()->get_meta_structure()->get_elements() as $field) {
try {
@@ -1206,16 +1206,16 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$meta_id = null;
}
- $toupdate[$field->get_id()] = array(
+ $toupdate[$field->get_id()] = [
'meta_id' => $meta_id
, 'meta_struct_id' => $field->get_id()
, 'value' => 'podom pom pom ' . $field->get_id()
- );
+ ];
}
- $this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['GET', 'PUT', 'DELETE']);
- self::$DI['client']->request('POST', $route, $this->getParameters(array('metadatas' => $toupdate)), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters(['metadatas' => $toupdate]), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1256,13 +1256,13 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$record_status = strrev(self::$DI['record_1']->get_status());
$status_bits = self::$DI['record_1']->get_databox()->get_statusbits();
- $tochange = array();
+ $tochange = [];
foreach ($status_bits as $n => $datas) {
$tochange[$n] = substr($record_status, ($n - 1), 1) == '0' ? '1' : '0';
}
- $this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['GET', 'PUT', 'DELETE']);
- $crawler = self::$DI['client']->request('POST', $route, $this->getParameters(array('status' => $tochange)), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request('POST', $route, $this->getParameters(['status' => $tochange]), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
/**
@@ -1284,7 +1284,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$tochange[$n] = $value == '0' ? '1' : '0';
}
- $crawler = self::$DI['client']->request('POST', $route, $this->getParameters(array('status' => $tochange)), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request('POST', $route, $this->getParameters(['status' => $tochange]), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
/**
@@ -1326,9 +1326,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->markTestSkipped('No collection');
}
- $this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['GET', 'PUT', 'DELETE']);
- self::$DI['client']->request('POST', $route, $this->getParameters(array('base_id' => $base_id)), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters(['base_id' => $base_id]), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1346,13 +1346,13 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
{
$this->insertFiveBasket();
$this->insertOneValidationBasket();
- self::$DI['client'] = new Client(self::$DI['app'], array());
+ self::$DI['client'] = new Client(self::$DI['app'], []);
$this->setToken(self::$adminToken);
$route = '/api/v1/baskets/list/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1374,9 +1374,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$route = '/api/v1/baskets/add/';
- $this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['GET', 'PUT', 'DELETE']);
- self::$DI['client']->request('POST', $route, $this->getParameters(array('name' => 'un Joli Nom')), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters(['name' => 'un Joli Nom']), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1402,9 +1402,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$route = '/api/v1/baskets/' . $basket->getId() . '/content/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1441,9 +1441,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$route = '/api/v1/baskets/' . $basket->getId() . '/setname/';
- $this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['GET', 'PUT', 'DELETE']);
- $crawler = self::$DI['client']->request('POST', $route, $this->getParameters(array('name' => 'un Joli Nom')), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request('POST', $route, $this->getParameters(['name' => 'un Joli Nom']), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1455,7 +1455,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->assertEquals($content['response']['basket']['name'], 'un Joli Nom');
- $crawler = self::$DI['client']->request('POST', $route, $this->getParameters(array('name' => 'un Joli Nom')), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request('POST', $route, $this->getParameters(['name' => 'un Joli Nom']), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1469,7 +1469,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->assertEquals($content['response']['basket']['name'], 'un Joli Nom');
- $crawler = self::$DI['client']->request('POST', $route, $this->getParameters(array('name' => 'aéaa')), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request('POST', $route, $this->getParameters(['name' => 'aéaa']), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1494,9 +1494,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$route = '/api/v1/baskets/' . $basket->getId() . '/setdescription/';
- $this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['GET', 'PUT', 'DELETE']);
- self::$DI['client']->request('POST', $route, $this->getParameters(array('description' => 'une belle desc')), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters(['description' => 'une belle desc']), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1520,9 +1520,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$route = '/api/v1/baskets/' . $baskets[0]->getId() . '/delete/';
- $this->evaluateMethodNotAllowedRoute($route, array('GET', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['GET', 'PUT', 'DELETE']);
- self::$DI['client']->request('POST', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1552,7 +1552,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$params = $this->getAddRecordParameters();
$params['status'] = '0b10000';
- self::$DI['client']->request('POST', $route, $this->getParameters($params), $this->getAddRecordFile(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters($params), $this->getAddRecordFile(), ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1575,7 +1575,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$params = $this->getAddRecordParameters();
$params['forceBehavior'] = '0';
- self::$DI['client']->request('POST', $route, $this->getParameters($params), $this->getAddRecordFile(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters($params), $this->getAddRecordFile(), ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1604,7 +1604,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$params = $this->getAddRecordParameters();
$params['forceBehavior'] = '1';
- self::$DI['client']->request('POST', $route, $this->getParameters($params), $this->getAddRecordFile(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters($params), $this->getAddRecordFile(), ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1631,7 +1631,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$params = $this->getAddRecordParameters();
$params['forceBehavior'] = '2';
- self::$DI['client']->request('POST', $route, $this->getParameters($params), $this->getAddRecordFile(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters($params), $this->getAddRecordFile(), ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponseBadRequest(self::$DI['client']->getResponse());
@@ -1649,7 +1649,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$params = $this->getAddRecordParameters();
$params['base_id'] = self::$DI['collection_no_access']->get_base_id();
- self::$DI['client']->request('POST', $route, $this->getParameters($params), $this->getAddRecordFile(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters($params), $this->getAddRecordFile(), ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponseForbidden(self::$DI['client']->getResponse());
@@ -1667,7 +1667,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$params = $this->getAddRecordParameters();
unset($params['base_id']);
- self::$DI['client']->request('POST', $route, $this->getParameters($params), $this->getAddRecordFile(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters($params), $this->getAddRecordFile(), ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponseBadRequest(self::$DI['client']->getResponse());
@@ -1682,12 +1682,12 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$token);
$route = '/api/v1/records/add/';
- $file = array(
+ $file = [
new \Symfony\Component\HttpFoundation\File\UploadedFile(__FILE__, 'upload.txt'),
new \Symfony\Component\HttpFoundation\File\UploadedFile(__FILE__, 'upload.txt'),
- );
+ ];
- self::$DI['client']->request('POST', $route, $this->getParameters($this->getAddRecordParameters()), array('file' => $file), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters($this->getAddRecordParameters()), ['file' => $file], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponseBadRequest(self::$DI['client']->getResponse());
@@ -1699,7 +1699,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$token);
$route = '/api/v1/records/add/';
- self::$DI['client']->request('POST', $route, $this->getParameters($this->getAddRecordParameters()), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('POST', $route, $this->getParameters($this->getAddRecordParameters()), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponseBadRequest(self::$DI['client']->getResponse());
@@ -1719,9 +1719,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$token);
$route = '/api/v1/feeds/list/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1777,9 +1777,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$token);
$route = '/api/v1/feeds/content/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1832,9 +1832,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$token);
$route = '/api/v1/feeds/entry/' . $created_entry->getId() . '/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1873,9 +1873,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$adminToken);
$route = '/api/v1/feeds/entry/' . $created_entry->getId() . '/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponseForbidden(self::$DI['client']->getResponse());
@@ -1909,9 +1909,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->setToken(self::$token);
$route = '/api/v1/feeds/' . $created_feed->getId() . '/content/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponse200(self::$DI['client']->getResponse());
@@ -1950,9 +1950,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$quarantineItemId = $this->getQuarantineItem()->getId();
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->assertArrayHasKey('offset_start', $content['response']);
@@ -1983,9 +1983,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$quarantineItemId = $this->getQuarantineItem()->getId();
$route = '/api/v1/quarantine/item/' . $quarantineItemId . '/';
- $this->evaluateMethodNotAllowedRoute($route, array('POST', 'PUT', 'DELETE'));
+ $this->evaluateMethodNotAllowedRoute($route, ['POST', 'PUT', 'DELETE']);
- self::$DI['client']->request('GET', $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request('GET', $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->assertArrayHasKey('quarantine_item', $content['response']);
@@ -2091,9 +2091,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
protected function getAddRecordParameters()
{
- return array(
+ return [
'base_id' => self::$DI['collection']->get_base_id()
- );
+ ];
}
protected function getAddRecordFile()
@@ -2101,9 +2101,9 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$file = tempnam(sys_get_temp_dir(), 'upload');
copy(__DIR__ . '/../../../../files/iphone_pic.jpg', $file);
- return array(
+ return [
'file' => new \Symfony\Component\HttpFoundation\File\UploadedFile($file, 'upload.jpg')
- );
+ ];
}
protected function checkLazaretFile($file)
@@ -2147,7 +2147,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
protected function evaluateNotFoundRoute($route, $methods)
{
foreach ($methods as $method) {
- $crawler = self::$DI['client']->request($method, $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request($method, $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponseNotFound(self::$DI['client']->getResponse());
@@ -2262,7 +2262,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
protected function evaluateMethodNotAllowedRoute($route, $methods)
{
foreach ($methods as $method) {
- $crawler = self::$DI['client']->request($method, $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ $crawler = self::$DI['client']->request($method, $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->assertTrue(self::$DI['client']->getResponse()->headers->has('Allow'));
$this->evaluateResponseMethodNotAllowed(self::$DI['client']->getResponse());
@@ -2273,7 +2273,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
protected function evaluateBadRequestRoute($route, $methods)
{
foreach ($methods as $method) {
- self::$DI['client']->request($method, $route, $this->getParameters(), array(), array('HTTP_Accept' => $this->getAcceptMimeType()));
+ self::$DI['client']->request($method, $route, $this->getParameters(), [], ['HTTP_Accept' => $this->getAcceptMimeType()]);
$content = $this->unserialize(self::$DI['client']->getResponse()->getContent());
$this->evaluateResponseBadRequest(self::$DI['client']->getResponse());
$this->evaluateMetaBadRequest($content);
@@ -2408,7 +2408,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->assertArrayHasKey('technical_informations', $record);
$this->assertArrayHasKey('phrasea_type', $record);
$this->assertTrue(is_string($record['phrasea_type']));
- $this->assertTrue(in_array($record['phrasea_type'], array('audio', 'document', 'image', 'video', 'flash', 'unknown')));
+ $this->assertTrue(in_array($record['phrasea_type'], ['audio', 'document', 'image', 'video', 'flash', 'unknown']));
$this->assertArrayHasKey('uuid', $record);
$this->assertTrue(\uuid::is_valid($record['uuid']));
@@ -2538,7 +2538,7 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$this->assertArrayHasKey('labels', $meta);
$this->assertTrue(is_array($meta['labels']));
- $this->assertEquals(array('fr', 'en', 'de', 'nl'), array_keys($meta['labels']));
+ $this->assertEquals(['fr', 'en', 'de', 'nl'], array_keys($meta['labels']));
if (is_array($meta['value'])) {
foreach ($meta['value'] as $val) {
@@ -2581,11 +2581,11 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
$meta_id = null;
}
- $toupdate[$field->get_id()] = array(
+ $toupdate[$field->get_id()] = [
'meta_id' => $meta_id
, 'meta_struct_id' => $field->get_id()
, 'value' => 'podom pom pom ' . $field->get_id()
- );
+ ];
}
$record->set_metadatas($toupdate);
diff --git a/tests/Alchemy/Tests/Phrasea/Application/ApiJSONPTest.php b/tests/Alchemy/Tests/Phrasea/Application/ApiJSONPTest.php
index 71fa87ae1b..c3b340f6db 100644
--- a/tests/Alchemy/Tests/Phrasea/Application/ApiJSONPTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Application/ApiJSONPTest.php
@@ -31,7 +31,7 @@ class ApiJSONPApplication extends ApiAbstract
$this->assertEquals(200, $response->getStatusCode(), 'Test status code 405 ' . $response->getContent());
}
- public function getParameters(array $parameters = array())
+ public function getParameters(array $parameters = [])
{
$parameters['callback'] = 'jsFunction';
diff --git a/tests/Alchemy/Tests/Phrasea/Application/ApiJsonTest.php b/tests/Alchemy/Tests/Phrasea/Application/ApiJsonTest.php
index a817e84f18..2ebc1eb223 100644
--- a/tests/Alchemy/Tests/Phrasea/Application/ApiJsonTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Application/ApiJsonTest.php
@@ -5,7 +5,7 @@ namespace Alchemy\Tests\Phrasea\Application;
class ApiJsonApplication extends ApiAbstract
{
- public function getParameters(array $parameters = array())
+ public function getParameters(array $parameters = [])
{
return $parameters;
}
diff --git a/tests/Alchemy/Tests/Phrasea/Application/ApiYamlTest.php b/tests/Alchemy/Tests/Phrasea/Application/ApiYamlTest.php
index 39ac6a3f2a..fc185682ea 100644
--- a/tests/Alchemy/Tests/Phrasea/Application/ApiYamlTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Application/ApiYamlTest.php
@@ -5,7 +5,7 @@ namespace Alchemy\Tests\Phrasea\Application;
class ApiYamlApplication extends ApiAbstract
{
- public function getParameters(array $parameters = array())
+ public function getParameters(array $parameters = [])
{
return $parameters;
}
diff --git a/tests/Alchemy/Tests/Phrasea/Application/ConsoleAPITest.php b/tests/Alchemy/Tests/Phrasea/Application/ConsoleAPITest.php
index 8451a40646..a3f8d299b1 100644
--- a/tests/Alchemy/Tests/Phrasea/Application/ConsoleAPITest.php
+++ b/tests/Alchemy/Tests/Phrasea/Application/ConsoleAPITest.php
@@ -19,10 +19,10 @@ class ConsoleAPITest extends \PHPUnit_Framework_TestCase
public function provideConsoleNames()
{
- return array(
- array('console'),
- array('setup'),
- array('developer'),
- );
+ return [
+ ['console'],
+ ['setup'],
+ ['developer'],
+ ];
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Application/LightboxTest.php b/tests/Alchemy/Tests/Phrasea/Application/LightboxTest.php
index 1086d272b8..ca2060614e 100644
--- a/tests/Alchemy/Tests/Phrasea/Application/LightboxTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Application/LightboxTest.php
@@ -273,7 +273,7 @@ class LightboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$crawler = self::$DI['client']->request(
'POST'
, '/lightbox/ajax/SET_NOTE/' . $validationBasketElement->getId() . '/'
- , array('note' => 'une jolie note')
+ , ['note' => 'une jolie note']
);
$this->assertEquals(200, self::$DI['client']->getResponse()->getStatusCode(), sprintf('set note to element %s ', $validationBasketElement->getId()));
@@ -299,7 +299,7 @@ class LightboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$crawler = self::$DI['client']->request(
'POST'
, '/lightbox/ajax/SET_ELEMENT_AGREEMENT/' . $validationBasketElement->getId() . '/'
- , array('agreement' => 1)
+ , ['agreement' => 1]
);
$this->assertEquals(200, self::$DI['client']->getResponse()->getStatusCode(), sprintf('set note to element %s ', $validationBasketElement->getId()));
diff --git a/tests/Alchemy/Tests/Phrasea/Application/OAuth2Test.php b/tests/Alchemy/Tests/Phrasea/Application/OAuth2Test.php
index 93cacaa99d..26e71c9daa 100644
--- a/tests/Alchemy/Tests/Phrasea/Application/OAuth2Test.php
+++ b/tests/Alchemy/Tests/Phrasea/Application/OAuth2Test.php
@@ -51,13 +51,13 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
$environment = 'test';
self::$DI['app'] = require __DIR__ . '/../../../../../lib/Alchemy/Phrasea/Application/Api.php';
- $this->queryParameters = array(
+ $this->queryParameters = [
"response_type" => "code",
"client_id" => self::$appli->get_client_id(),
"redirect_uri" => self::$appli->get_redirect_uri(),
"scope" => "",
"state" => "valueTest"
- );
+ ];
}
public static function deleteInsertedRow(\appbox $appbox, \API_OAuth2_Application $app)
@@ -67,7 +67,7 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
DELETE FROM api_applications
WHERE application_id = :id
';
- $t = array(':id' => $app->get_id());
+ $t = [':id' => $app->get_id()];
$stmt = $conn->prepare($sql);
$stmt->execute($t);
$sql = '
@@ -75,7 +75,7 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
WHERE api_account_id = :id
';
$acc = self::getAccount();
- $t = array(':id' => $acc->get_id());
+ $t = [':id' => $acc->get_id()];
$stmt = $conn->prepare($sql);
$stmt->execute($t);
}
@@ -103,18 +103,18 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
public function provideEventNames()
{
- return array(
- array(false, 'POST', PhraseaEvents::PRE_AUTHENTICATE, 'Alchemy\Phrasea\Core\Event\PreAuthenticate'),
- array(true, 'POST', PhraseaEvents::PRE_AUTHENTICATE, 'Alchemy\Phrasea\Core\Event\PreAuthenticate'),
- array(false, 'GET', PhraseaEvents::PRE_AUTHENTICATE, 'Alchemy\Phrasea\Core\Event\PreAuthenticate'),
- array(true, 'GET', PhraseaEvents::PRE_AUTHENTICATE, 'Alchemy\Phrasea\Core\Event\PreAuthenticate'),
- );
+ return [
+ [false, 'POST', PhraseaEvents::PRE_AUTHENTICATE, 'Alchemy\Phrasea\Core\Event\PreAuthenticate'],
+ [true, 'POST', PhraseaEvents::PRE_AUTHENTICATE, 'Alchemy\Phrasea\Core\Event\PreAuthenticate'],
+ [false, 'GET', PhraseaEvents::PRE_AUTHENTICATE, 'Alchemy\Phrasea\Core\Event\PreAuthenticate'],
+ [true, 'GET', PhraseaEvents::PRE_AUTHENTICATE, 'Alchemy\Phrasea\Core\Event\PreAuthenticate'],
+ ];
}
public static function getApp($rowId)
{
$sql = "SELECT * FROM api_applications WHERE application_id = :app_id";
- $t = array(":app_id" => $rowId);
+ $t = [":app_id" => $rowId];
$conn = self::$DI['app']['phraseanet.appbox']->get_connection();
$stmt = $conn->prepare($sql);
$stmt->execute($t);
@@ -126,7 +126,7 @@ class oauthv2_application_test extends \PhraseanetWebTestCaseAuthenticatedAbstra
public static function getAccount()
{
$sql = "SELECT api_account_id FROM api_accounts WHERE application_id = :app_id AND usr_id = :usr_id";
- $t = array(":app_id" => self::$appli->get_id(), ":usr_id" => self::$DI['user']->get_id());
+ $t = [":app_id" => self::$appli->get_id(), ":usr_id" => self::$DI['user']->get_id()];
$conn = self::$DI['app']['phraseanet.appbox']->get_connection();
$stmt = $conn->prepare($sql);
$stmt->execute($t);
diff --git a/tests/Alchemy/Tests/Phrasea/Application/OverviewTest.php b/tests/Alchemy/Tests/Phrasea/Application/OverviewTest.php
index 2d9d1d0904..54f06d15e0 100644
--- a/tests/Alchemy/Tests/Phrasea/Application/OverviewTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Application/OverviewTest.php
@@ -83,33 +83,33 @@ class OverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function testPermalinkAuthenticated()
{
$this->assertTrue(self::$DI['app']['authentication']->isAuthenticated());
- $this->get_a_permalinkBCcompatibility(array("Content-Type" => "image/jpeg"));
- $this->get_a_permaviewBCcompatibility(array("Content-Type" => "text/html; charset=UTF-8"));
- $this->get_a_permalink(array("Content-Type" => "image/jpeg"));
- $this->get_a_permaview(array("Content-Type" => "text/html; charset=UTF-8"));
+ $this->get_a_permalinkBCcompatibility(["Content-Type" => "image/jpeg"]);
+ $this->get_a_permaviewBCcompatibility(["Content-Type" => "text/html; charset=UTF-8"]);
+ $this->get_a_permalink(["Content-Type" => "image/jpeg"]);
+ $this->get_a_permaview(["Content-Type" => "text/html; charset=UTF-8"]);
}
public function testPermalinkNotAuthenticated()
{
self::$DI['app']['authentication']->closeAccount();
$this->assertFalse(self::$DI['app']['authentication']->isAuthenticated());
- $this->get_a_permalinkBCcompatibility(array("Content-Type" => "image/jpeg"));
- $this->get_a_permaviewBCcompatibility(array("Content-Type" => "text/html; charset=UTF-8"));
- $this->get_a_permalink(array("Content-Type" => "image/jpeg"));
- $this->get_a_permaview(array("Content-Type" => "text/html; charset=UTF-8"));
+ $this->get_a_permalinkBCcompatibility(["Content-Type" => "image/jpeg"]);
+ $this->get_a_permaviewBCcompatibility(["Content-Type" => "text/html; charset=UTF-8"]);
+ $this->get_a_permalink(["Content-Type" => "image/jpeg"]);
+ $this->get_a_permaview(["Content-Type" => "text/html; charset=UTF-8"]);
}
public function testCaptionAuthenticated()
{
$this->assertTrue(self::$DI['app']['authentication']->isAuthenticated());
- $this->get_a_caption(array("Content-Type" => "application/json"));
+ $this->get_a_caption(["Content-Type" => "application/json"]);
}
public function testCaptionNotAuthenticated()
{
self::$DI['app']['authentication']->closeAccount();
$this->assertFalse(self::$DI['app']['authentication']->isAuthenticated());
- $this->get_a_caption(array("Content-Type" => "application/json"));
+ $this->get_a_caption(["Content-Type" => "application/json"]);
}
public function testCaptionWithaWrongToken()
@@ -167,7 +167,7 @@ class OverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, $response->getStatusCode());
}
- protected function get_a_caption(array $headers = array())
+ protected function get_a_caption(array $headers = [])
{
$token = self::$DI['record_1']->get_thumbnail()->get_permalink()->get_token();
$url = '/permalink/v1/' . self::$DI['record_1']->get_sbas_id() . "/" . self::$DI['record_1']->get_record_id() . '/caption/?token='.$token;
@@ -184,7 +184,7 @@ class OverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, $response->getStatusCode());
}
- protected function get_a_permalinkBCcompatibility(array $headers = array())
+ protected function get_a_permalinkBCcompatibility(array $headers = [])
{
$token = self::$DI['record_1']->get_preview()->get_permalink()->get_token();
$url = '/permalink/v1/whateverIwannt/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/' . $token . '/preview/';
@@ -210,7 +210,7 @@ class OverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, self::$DI['client']->getResponse()->getStatusCode());
}
- protected function get_a_permaviewBCcompatibility(array $headers = array())
+ protected function get_a_permaviewBCcompatibility(array $headers = [])
{
$token = self::$DI['record_1']->get_preview()->get_permalink()->get_token();
$url = '/permalink/v1/whateverIwannt/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/' . $token . '/preview/';
@@ -226,7 +226,7 @@ class OverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, $response->getStatusCode());
}
- protected function get_a_permalink(array $headers = array())
+ protected function get_a_permalink(array $headers = [])
{
$token = self::$DI['record_1']->get_preview()->get_permalink()->get_token();
$url = '/permalink/v1/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/preview/whateverIwannt.jpg?token=' . $token . '';
@@ -242,7 +242,7 @@ class OverviewTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$this->assertEquals(200, $response->getStatusCode());
}
- protected function get_a_permaview(array $headers = array())
+ protected function get_a_permaview(array $headers = [])
{
$token = self::$DI['record_1']->get_preview()->get_permalink()->get_token();
$url = '/permalink/v1/' . self::$DI['record_1']->get_sbas_id() . '/' . self::$DI['record_1']->get_record_id() . '/preview/?token=' . $token . '';
diff --git a/tests/Alchemy/Tests/Phrasea/Application/RootApplicationTest.php b/tests/Alchemy/Tests/Phrasea/Application/RootApplicationTest.php
index 3dbba0d8ec..3cd426adbc 100644
--- a/tests/Alchemy/Tests/Phrasea/Application/RootApplicationTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Application/RootApplicationTest.php
@@ -17,11 +17,11 @@ class RootApplicationTest extends \PHPUnit_Framework_TestCase
public function provideEnvironments()
{
- return array(
- array(Application::ENV_PROD),
- array(Application::ENV_TEST),
- array(Application::ENV_DEV),
- );
+ return [
+ [Application::ENV_PROD],
+ [Application::ENV_TEST],
+ [Application::ENV_DEV],
+ ];
}
public function testWebProfilerDisableInProdEnv()
diff --git a/tests/Alchemy/Tests/Phrasea/ApplicationTest.php b/tests/Alchemy/Tests/Phrasea/ApplicationTest.php
index 39bc0543b4..7c86b232ac 100644
--- a/tests/Alchemy/Tests/Phrasea/ApplicationTest.php
+++ b/tests/Alchemy/Tests/Phrasea/ApplicationTest.php
@@ -100,10 +100,10 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
public function provideDisabledRoutes()
{
- return array(
- array(true, '/api/v1/'),
- array(false, '/'),
- );
+ return [
+ [true, '/api/v1/'],
+ [false, '/'],
+ ];
}
/**
@@ -111,7 +111,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
*/
public function testCookieLocale()
{
- foreach (array('fr_FR', 'en_GB', 'de_DE') as $locale) {
+ foreach (['fr_FR', 'en_GB', 'de_DE'] as $locale) {
$client = $this->getClientWithCookie( $this->getAppThatReturnLocale(), $locale);
$client->request('GET', '/');
@@ -128,7 +128,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
$this->mockRegistryAndReturnLocale($app, 'en_USA');
$client = $this->getClientWithCookie($app, null);
- $client->request('GET', '/', array(), array(), array('HTTP_ACCEPT_LANGUAGE' => ''));
+ $client->request('GET', '/', [], [], ['HTTP_ACCEPT_LANGUAGE' => '']);
$this->assertEquals('en_USA', $client->getResponse()->getContent());
}
@@ -142,7 +142,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
$this->mockRegistryAndReturnLocale($app, 'en_USA');
$client = $this->getClientWithCookie($app, 'de_PL');
- $client->request('GET', '/', array(), array(), array('HTTP_ACCEPT_LANGUAGE' => ''));
+ $client->request('GET', '/', [], [], ['HTTP_ACCEPT_LANGUAGE' => '']);
$this->assertEquals('en_USA', $client->getResponse()->getContent());
}
@@ -160,7 +160,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
$client = new Client($app);
- $client->request('POST', '/prod/upload/', array('php_session_id'=>'123456'), array(), array('HTTP_USER_AGENT'=>'flash'));
+ $client->request('POST', '/prod/upload/', ['php_session_id'=>'123456'], [], ['HTTP_USER_AGENT'=>'flash']);
$this->assertEquals('123456', $sessionId);
}
@@ -178,7 +178,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
$generator->expects($this->once())
->method('generate')
- ->with($this->equalTo($route), $this->equalTo(array()), $this->equalTo(UrlGenerator::ABSOLUTE_PATH))
+ ->with($this->equalTo($route), $this->equalTo([]), $this->equalTo(UrlGenerator::ABSOLUTE_PATH))
->will($this->returnValue($ret));
$this->assertEquals($ret, $app->path($route));
@@ -198,7 +198,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
$generator->expects($this->once())
->method('generate')
- ->with($this->equalTo($route), $this->equalTo(array()), $this->equalTo(UrlGenerator::ABSOLUTE_URL))
+ ->with($this->equalTo($route), $this->equalTo([]), $this->equalTo(UrlGenerator::ABSOLUTE_URL))
->will($this->returnValue($ret));
$this->assertEquals($ret, $app->url($route));
@@ -216,8 +216,8 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
->getMock();
$type = $this->getMock('Symfony\Component\Form\FormTypeInterface');
- $data = array('some' => 'data');
- $options = array();
+ $data = ['some' => 'data'];
+ $options = [];
$parent = $this->getMockBuilder('Symfony\Component\Form\FormBuilder')
->disableOriginalConstructor()
@@ -235,11 +235,11 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
{
$app = new Application('test');
- $this->assertEquals(array(), $app->getFlash('info'));
- $this->assertEquals(array('BOUM'), $app->getFlash('info', array('BOUM')));
+ $this->assertEquals([], $app->getFlash('info'));
+ $this->assertEquals(['BOUM'], $app->getFlash('info', ['BOUM']));
$app->addFlash('success', 'BAMBA');
- $this->assertEquals(array('BAMBA'), $app->getFlash('success'));
+ $this->assertEquals(['BAMBA'], $app->getFlash('success'));
}
/**
@@ -298,7 +298,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
$app['configuration']->expects($this->once())
->method('offsetGet')
->with('main')
- ->will($this->returnValue(array('servername' => 'https://cat.turbocat.com/')));
+ ->will($this->returnValue(['servername' => 'https://cat.turbocat.com/']));
$this->assertEquals('https', $app['url_generator']->getContext()->getScheme());
$this->assertEquals('cat.turbocat.com', $app['url_generator']->getContext()->getHost());
@@ -384,7 +384,7 @@ class ApplicationTest extends \PhraseanetPHPUnitAbstract
$cookieJar->set(new BrowserCookie('locale', $locale));
}
- return new Client($app, array(), null, $cookieJar);
+ return new Client($app, [], null, $cookieJar);
}
}
@@ -400,6 +400,6 @@ class TestExceptionHandlerSubscriber implements EventSubscriberInterface
*/
public static function getSubscribedEvents()
{
- return array(KernelEvents::EXCEPTION => array('onSilexError', 0));
+ return [KernelEvents::EXCEPTION => ['onSilexError', 0]];
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/AccountCreatorTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/AccountCreatorTest.php
index 19f87aea71..9411f924f5 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/AccountCreatorTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/AccountCreatorTest.php
@@ -14,17 +14,17 @@ class AccountCreatorTest extends \PhraseanetPHPUnitAbstract
$random = $this->createRandomMock();
$appbox = $this->createAppboxMock();
- $creator = new AccountCreator($random, $appbox, $enabled, array());
+ $creator = new AccountCreator($random, $appbox, $enabled, []);
$this->assertSame($enabled, $creator->isEnabled());
}
public function provideEnabledOptions()
{
- return array(
- array(true),
- array(false),
- );
+ return [
+ [true],
+ [false],
+ ];
}
/**
@@ -35,7 +35,7 @@ class AccountCreatorTest extends \PhraseanetPHPUnitAbstract
$random = $this->createRandomMock();
$appbox = $this->createAppboxMock();
- $creator = new AccountCreator($random, $appbox, true, array());
+ $creator = new AccountCreator($random, $appbox, true, []);
$creator->create(self::$DI['app'], self::$DI['app']['tokens']->generatePassword(), self::$DI['user']->get_email());
}
@@ -47,13 +47,13 @@ class AccountCreatorTest extends \PhraseanetPHPUnitAbstract
$random = $this->createRandomMock();
$appbox = $this->createAppboxMock();
- $creator = new AccountCreator($random, $appbox, false, array());
+ $creator = new AccountCreator($random, $appbox, false, []);
$creator->create(self::$DI['app'], self::$DI['app']['tokens']->generatePassword());
}
public function testCreateWithoutTemplates()
{
- $creator = new AccountCreator(self::$DI['app']['tokens'], self::$DI['app']['phraseanet.appbox'], true, array());
+ $creator = new AccountCreator(self::$DI['app']['tokens'], self::$DI['app']['phraseanet.appbox'], true, []);
$user = $creator->create(self::$DI['app'], self::$DI['app']['tokens']->generatePassword());
$this->assertInstanceOf('User_Adapter', $user);
@@ -70,8 +70,8 @@ class AccountCreatorTest extends \PhraseanetPHPUnitAbstract
$template3 = \User_Adapter::create(self::$DI['app'], 'template' . $random->generatePassword(), $random->generatePassword(), null, false);
$template3->set_template(self::$DI['user']);
- $templates = array($template1, $template2);
- $extra = array($template3);
+ $templates = [$template1, $template2];
+ $extra = [$template3];
$creator = new AccountCreator($random, self::$DI['app']['phraseanet.appbox'], true, $templates);
$user = $creator->create(self::$DI['app'], self::$DI['app']['tokens']->generatePassword(), null, $extra);
@@ -85,7 +85,7 @@ class AccountCreatorTest extends \PhraseanetPHPUnitAbstract
public function testCreateWithAlreadyExistingLogin()
{
- $creator = new AccountCreator(self::$DI['app']['tokens'], self::$DI['app']['phraseanet.appbox'], true, array());
+ $creator = new AccountCreator(self::$DI['app']['tokens'], self::$DI['app']['phraseanet.appbox'], true, []);
$user = $creator->create(self::$DI['app'], self::$DI['user']->get_login());
$this->assertInstanceOf('User_Adapter', $user);
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/AuthenticatorTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/AuthenticatorTest.php
index c58cb1010a..0bc71f39d1 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/AuthenticatorTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/AuthenticatorTest.php
@@ -94,7 +94,7 @@ class AuthenticatorTest extends \PhraseanetPHPUnitAbstract
->getMock();
$acl->expects($this->once())
->method('get_granted_sbas')
- ->will($this->returnValue(array()));
+ ->will($this->returnValue([]));
$aclProvider = $this->getMockBuilder('Alchemy\Phrasea\Authentication\ACLProvider')
->disableOriginalConstructor()
@@ -151,7 +151,7 @@ class AuthenticatorTest extends \PhraseanetPHPUnitAbstract
$repo->expects($this->once())
->method('findOneBy')
- ->with($this->equalTo(array('id' => $session->getId())))
+ ->with($this->equalTo(['id' => $session->getId()]))
->will($this->returnValue($session));
$em->expects($this->once())
@@ -193,7 +193,7 @@ class AuthenticatorTest extends \PhraseanetPHPUnitAbstract
$repo->expects($this->once())
->method('findOneBy')
- ->with($this->equalTo(array('id' => $session->getId())))
+ ->with($this->equalTo(['id' => $session->getId()]))
->will($this->returnValue(null));
$em->expects($this->once())
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/ManagerTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/ManagerTest.php
index 257c2c0104..5393ca82ce 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/ManagerTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/ManagerTest.php
@@ -38,7 +38,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
$providers = $this->getProvidersMock();
$providerName = 'roro-provider';
- $parameters = array('key' => 'value');
+ $parameters = ['key' => 'value'];
$provider = $this->getMock('Alchemy\Phrasea\Authentication\Provider\ProviderInterface');
$providers->expects($this->once())
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/PersistentCookie/ManagerTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/PersistentCookie/ManagerTest.php
index e373c2f98c..ab2255d474 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/PersistentCookie/ManagerTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/PersistentCookie/ManagerTest.php
@@ -36,7 +36,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
$repo->expects($this->once())
->method('findOneBy')
- ->with($this->equalTo(array('token' => $tokenValue)))
+ ->with($this->equalTo(['token' => $tokenValue]))
->will($this->returnValue($session));
$em->expects($this->once())
@@ -81,7 +81,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
$repo->expects($this->once())
->method('findOneBy')
- ->with($this->equalTo(array('token' => $tokenValue)))
+ ->with($this->equalTo(['token' => $tokenValue]))
->will($this->returnValue($session));
$em->expects($this->once())
@@ -114,7 +114,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
$repo->expects($this->once())
->method('findOneBy')
- ->with($this->equalTo(array('token' => $tokenValue)))
+ ->with($this->equalTo(['token' => $tokenValue]))
->will($this->returnValue(null));
$em->expects($this->once())
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/FailureManagerTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/FailureManagerTest.php
index ba63bc3553..7177bfcd55 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/FailureManagerTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/FailureManagerTest.php
@@ -26,10 +26,10 @@ class FailureManagerTest extends \PhraseanetPHPUnitAbstract
->method('getClientIp')
->will($this->returnValue($ip));
- $oldFailures = array(
+ $oldFailures = [
$this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure'),
$this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure')
- );
+ ];
$repo->expects($this->once())
->method('findOldFailures')
@@ -67,7 +67,7 @@ class FailureManagerTest extends \PhraseanetPHPUnitAbstract
$username = 'romainneutron';
- $oldFailures = array();
+ $oldFailures = [];
$repo->expects($this->once())
->method('findLockedFailuresMatching')
@@ -293,7 +293,7 @@ class FailureManagerTest extends \PhraseanetPHPUnitAbstract
private function ArrayIze($failure, $n)
{
- $failures = array();
+ $failures = [];
for ($i = 0; $i != $n; $i++) {
$failures[] = $failure();
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/NativeAuthenticationTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/NativeAuthenticationTest.php
index 9b3665ba53..931830a766 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/NativeAuthenticationTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/NativeAuthenticationTest.php
@@ -25,10 +25,10 @@ class NativeAuthenticationTest extends \PHPUnit_Framework_TestCase
public function provideReservedUsernames()
{
- return array(
- array('autoregister'),
- array('invite'),
- );
+ return [
+ ['autoregister'],
+ ['invite'],
+ ];
}
public function testNotFoundIsNotValid()
@@ -52,13 +52,13 @@ class NativeAuthenticationTest extends \PHPUnit_Framework_TestCase
$encoder = $this->getEncoderMock();
$oldEncoder = $this->getOldEncoderMock();
- $conn = $this->getConnectionMock($username, array(
+ $conn = $this->getConnectionMock($username, [
'nonce' => 'dfqsdgqsd',
'salted_password' => '1',
'mail_locked' => '1',
'usr_id' => '1',
'usr_password' => 'qsdfsqdfqsd',
- ));
+ ]);
$request = $this->getRequestMock();
$auth = new NativeAuthentication($encoder, $oldEncoder, $conn);
@@ -81,13 +81,13 @@ class NativeAuthenticationTest extends \PHPUnit_Framework_TestCase
$encoder = $this->getEncoderMock();
$oldEncoder = $this->getOldEncoderMock();
- $conn = $this->getConnectionMock($username, array(
+ $conn = $this->getConnectionMock($username, [
'nonce' => $nonce,
'salted_password' => '1',
'mail_locked' => '0',
'usr_id' => $usr_id,
'usr_password' => $encoded,
- ));
+ ]);
$request = $this->getRequestMock();
$oldEncoder->expects($this->never())
@@ -113,13 +113,13 @@ class NativeAuthenticationTest extends \PHPUnit_Framework_TestCase
$encoder = $this->getEncoderMock();
$oldEncoder = $this->getOldEncoderMock();
- $conn = $this->getConnectionMock($username, array(
+ $conn = $this->getConnectionMock($username, [
'nonce' => $nonce,
'salted_password' => '1',
'mail_locked' => '0',
'usr_id' => $usr_id,
'usr_password' => $encoded,
- ));
+ ]);
$request = $this->getRequestMock();
$oldEncoder->expects($this->never())
@@ -145,13 +145,13 @@ class NativeAuthenticationTest extends \PHPUnit_Framework_TestCase
$encoder = $this->getEncoderMock();
$oldEncoder = $this->getOldEncoderMock();
- $conn = $this->getConnectionMock($username, array(
+ $conn = $this->getConnectionMock($username, [
'nonce' => $nonce,
'salted_password' => '0',
'mail_locked' => '0',
'usr_id' => $usr_id,
'usr_password' => $encoded,
- ));
+ ]);
$request = $this->getRequestMock();
$oldEncoder->expects($this->once())
@@ -186,17 +186,17 @@ class NativeAuthenticationTest extends \PHPUnit_Framework_TestCase
$statement
->expects($this->once())
->method('execute')
- ->with($this->equalTo(array(':login' => $username)));
+ ->with($this->equalTo([':login' => $username]));
$statement->expects($this->once())
->method('fetch')
->with($this->equalTo(\PDO::FETCH_ASSOC))
- ->will($this->returnValue(array(
+ ->will($this->returnValue([
'nonce' => $nonce,
'salted_password' => '0',
'mail_locked' => '0',
'usr_id' => $usr_id,
'usr_password' => $encoded,
- )));
+ ]));
$catchParameters = $catchTestPassword = null;
@@ -228,11 +228,11 @@ class NativeAuthenticationTest extends \PHPUnit_Framework_TestCase
$encoder->expects($this->once())
->method('isPasswordValid')
->will($this->returnCallback(function ($encoded, $pass, $nonce) use (&$catchTestPassword) {
- $catchTestPassword = array(
+ $catchTestPassword = [
'encoded' => $encoded,
'pass' => $pass,
'nonce' => $nonce,
- );
+ ];
return true;
}));
@@ -255,7 +255,7 @@ class NativeAuthenticationTest extends \PHPUnit_Framework_TestCase
$statement
->expects($this->once())
->method('execute')
- ->with($this->equalTo(array(':login' => $username)));
+ ->with($this->equalTo([':login' => $username]));
$statement->expects($this->once())
->method('fetch')
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/OldPasswordEncoderTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/OldPasswordEncoderTest.php
index 921803ee31..1cfb1448bf 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/OldPasswordEncoderTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/OldPasswordEncoderTest.php
@@ -38,11 +38,11 @@ class OldPasswordEncoderTest extends \PHPUnit_Framework_TestCase
public function providePasswords()
{
- return array(
- array('foo', 'bar', '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'),
- array('foo', 'bar', '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'),
- array('bar', 'foo', 'fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9'),
- array('bar', 'baz', 'fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9'),
- );
+ return [
+ ['foo', 'bar', '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'],
+ ['foo', 'bar', '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'],
+ ['bar', 'foo', 'fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9'],
+ ['bar', 'baz', 'fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9'],
+ ];
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/PasswordEncoderTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/PasswordEncoderTest.php
index bf1d50d3fd..82ad2e2788 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/PasswordEncoderTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Phrasea/PasswordEncoderTest.php
@@ -8,25 +8,25 @@ class PasswordEncoderTest extends \PHPUnit_Framework_TestCase
{
public function providePasswords()
{
- return array(
- array(
+ return [
+ [
'foo-key', 'foo', 'bar',
'116a409f4597bf3ccfe8bc4529c638452c9831d941355f9b49386e6733db31138b228d52fd50409af8960d8059fd03b6c128884efff05055beada86d1ea9a025'
- ),
- array(
+ ],
+ [
'foo-key', 'baz', 'bar',
'f77b2da9276efd3e4ca66503cf50f4399798968731521c3e71758bb412737d57f2370144fd3adc3a740f87bee9b04b4369018d549c221bc28fcf7967c6712302'
- ),
- );
+ ],
+ ];
}
public function provideInvalidKeys()
{
- return array(
- array(null),
- array(''),
- array(' '),
- );
+ return [
+ [null],
+ [''],
+ [' '],
+ ];
}
/**
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/FacebookTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/FacebookTest.php
index a0a7b97f3b..6049732657 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/FacebookTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/FacebookTest.php
@@ -35,9 +35,9 @@ class FacebookTest extends ProviderTestCase
->method('getUser')
->will($this->returnValue(null));
- return array(
- array($provider, $this->getRequestMock())
- );
+ return [
+ [$provider, $this->getRequestMock()]
+ ];
}
public function getProviderForLogout()
@@ -52,9 +52,9 @@ class FacebookTest extends ProviderTestCase
->method('getUser')
->will($this->returnValue('123456'));
- return array(
- array($provider, $this->getRequestMock())
- );
+ return [
+ [$provider, $this->getRequestMock()]
+ ];
}
protected function getProvider()
@@ -76,7 +76,7 @@ class FacebookTest extends ProviderTestCase
$facebook = $this->getMockBuilder('Facebook')
->disableOriginalConstructor()
- ->setMethods(array('getLoginUrl', 'api', 'getUser'))
+ ->setMethods(['getLoginUrl', 'api', 'getUser'])
->getMock();
$facebook->expects($this->any())
@@ -85,13 +85,13 @@ class FacebookTest extends ProviderTestCase
$facebook->expects($this->once())
->method('api')
- ->will($this->returnValue(array(
+ ->will($this->returnValue([
'id' => self::ID,
'username' => self::FIRSTNAME,
'first_name' => self::FIRSTNAME,
'last_name' => self::LASTNAME,
'email' => self::EMAIL,
- )));
+ ]));
$provider->setFacebook($facebook);
@@ -105,21 +105,21 @@ class FacebookTest extends ProviderTestCase
protected function getAvailableFieldsForIdentity()
{
- return array(
+ return [
Identity::PROPERTY_ID => self::ID,
Identity::PROPERTY_USERNAME => self::FIRSTNAME,
Identity::PROPERTY_FIRSTNAME => self::FIRSTNAME,
Identity::PROPERTY_LASTNAME => self::LASTNAME,
Identity::PROPERTY_EMAIL => self::EMAIL,
- );
+ ];
}
protected function getTestOptions()
{
- return array(
+ return [
'app-id' => 'zizi',
'secret' => 's3cr3t',
- );
+ ];
}
protected function getProviderForAuthentication()
@@ -131,7 +131,7 @@ class FacebookTest extends ProviderTestCase
{
$facebook = $this->getMockBuilder('Facebook')
->disableOriginalConstructor()
- ->setMethods(array('getLoginUrl', 'api', 'getUser'))
+ ->setMethods(['getLoginUrl', 'api', 'getUser'])
->getMock();
$facebook->expects($this->any())
@@ -142,9 +142,9 @@ class FacebookTest extends ProviderTestCase
->method('api')
->will($this->returnCallback(function () use ($facebook) {
if (!$facebook->getUser()) {
- throw new \FacebookApiException(array(
+ throw new \FacebookApiException([
'error_msg' => 'Not authenticated'
- ));
+ ]);
}
}));
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/FactoryTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/FactoryTest.php
index fcdf2264b9..c66b50fe92 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/FactoryTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/FactoryTest.php
@@ -24,12 +24,12 @@ class FactoryTest extends \PHPUnit_Framework_TestCase
public function provideNameAndOptions()
{
- return array(
- array('github', array('client-id' => 'id', 'client-secret' => 'secret'), 'Alchemy\Phrasea\Authentication\Provider\Github'),
- array('google-plus', array('client-id' => 'id', 'client-secret' => 'secret'), 'Alchemy\Phrasea\Authentication\Provider\GooglePlus'),
- array('linkedin', array('client-id' => 'id', 'client-secret' => 'secret'), 'Alchemy\Phrasea\Authentication\Provider\Linkedin'),
- array('twitter', array('consumer-key' => 'id', 'consumer-secret' => 'secret'), 'Alchemy\Phrasea\Authentication\Provider\Twitter'),
- array('viadeo', array('client-id' => 'id', 'client-secret' => 'secret'), 'Alchemy\Phrasea\Authentication\Provider\Viadeo'),
- );
+ return [
+ ['github', ['client-id' => 'id', 'client-secret' => 'secret'], 'Alchemy\Phrasea\Authentication\Provider\Github'],
+ ['google-plus', ['client-id' => 'id', 'client-secret' => 'secret'], 'Alchemy\Phrasea\Authentication\Provider\GooglePlus'],
+ ['linkedin', ['client-id' => 'id', 'client-secret' => 'secret'], 'Alchemy\Phrasea\Authentication\Provider\Linkedin'],
+ ['twitter', ['consumer-key' => 'id', 'consumer-secret' => 'secret'], 'Alchemy\Phrasea\Authentication\Provider\Twitter'],
+ ['viadeo', ['client-id' => 'id', 'client-secret' => 'secret'], 'Alchemy\Phrasea\Authentication\Provider\Viadeo'],
+ ];
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/GithubTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/GithubTest.php
index 5d44fd1a10..44ad62cb4c 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/GithubTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/GithubTest.php
@@ -16,12 +16,12 @@ class GithubTest extends ProviderTestCase
$provider->getSession()->set('github.provider.state', $state . mt_rand());
$request = $this->getRequestMock();
- $this->addQueryParameter($request, array('state' => $state));
+ $this->addQueryParameter($request, ['state' => $state]);
- return array(
- array($this->getProvider(), $this->getRequestMock()),
- array($provider, $request),
- );
+ return [
+ [$this->getProvider(), $this->getRequestMock()],
+ [$provider, $request],
+ ];
}
public function getProviderForLogout()
@@ -76,19 +76,19 @@ class GithubTest extends ProviderTestCase
$provider->getSession()->set('github.provider.state', $state);
$request = $this->getRequestMock();
- $this->addQueryParameter($request, array('state' => $state));
+ $this->addQueryParameter($request, ['state' => $state]);
- return array(
- array($provider, $request),
- );
+ return [
+ [$provider, $request],
+ ];
}
public function getTestOptions()
{
- return array(
+ return [
'client-id' => 'github-client-id',
'client-secret' => 'github-client-secret',
- );
+ ];
}
protected function getProviderForAuthentication()
@@ -123,12 +123,12 @@ class GithubTest extends ProviderTestCase
$response->expects($this->any())
->method('getBody')
->with($this->equalTo(true))
- ->will($this->returnValue(json_encode(array(
+ ->will($this->returnValue(json_encode([
'id' => self::ID,
'name' => self::FIRSTNAME . ' ' . self::LASTNAME,
'email' => self::EMAIL,
'avatar_url' => self::IMAGEURL,
- ))));
+ ])));
$requestGet->expects($this->any())
->method('send')
@@ -188,13 +188,13 @@ class GithubTest extends ProviderTestCase
protected function getAvailableFieldsForIdentity()
{
- return array(
+ return [
Identity::PROPERTY_ID => self::ID,
Identity::PROPERTY_FIRSTNAME => self::FIRSTNAME,
Identity::PROPERTY_LASTNAME => self::LASTNAME,
Identity::PROPERTY_EMAIL => self::EMAIL,
Identity::PROPERTY_IMAGEURL => self::IMAGEURL,
- );
+ ];
}
protected function authenticate(ProviderInterface $provider)
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/GooglePlusTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/GooglePlusTest.php
index be5da60285..25f47f653e 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/GooglePlusTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/GooglePlusTest.php
@@ -28,12 +28,12 @@ class GooglePlusTest extends ProviderTestCase
$provider->getSession()->set('google-plus.provider.state', $state . mt_rand());
$request = $this->getRequestMock();
- $this->addQueryParameter($request, array('state' => $state));
+ $this->addQueryParameter($request, ['state' => $state]);
- return array(
- array($this->provideFailingProvider(), $this->getRequestMock()),
- array($provider, $request),
- );
+ return [
+ [$this->provideFailingProvider(), $this->getRequestMock()],
+ [$provider, $request],
+ ];
}
public function getProviderForLogout()
@@ -94,9 +94,9 @@ class GooglePlusTest extends ProviderTestCase
$provider->getSession()->set('google-plus.provider.state', $state);
$request = $this->getRequestMock();
- $this->addQueryParameter($request, array(
+ $this->addQueryParameter($request, [
'state' => $state,
- ));
+ ]);
$ticket = $this->getMockBuilder('Google_LoginTicket')
->disableOriginalConstructor()
@@ -106,17 +106,17 @@ class GooglePlusTest extends ProviderTestCase
->method('verifyIdToken')
->will($this->returnValue($ticket));
- return array(
- array($provider, $request),
- );
+ return [
+ [$provider, $request],
+ ];
}
public function getTestOptions()
{
- return array(
+ return [
'client-id' => 'google-plus-client-id',
'client-secret' => 'google-plus-client-secret',
- );
+ ];
}
protected function getProviderForSuccessIdentity()
@@ -146,9 +146,9 @@ class GooglePlusTest extends ProviderTestCase
$response->expects($this->any())
->method('getBody')
->with($this->equalTo(true))
- ->will($this->returnValue(json_encode(array(
+ ->will($this->returnValue(json_encode([
'email' => self::EMAIL
- ))));
+ ])));
$requestGet->expects($this->any())
->method('send')
@@ -167,16 +167,16 @@ class GooglePlusTest extends ProviderTestCase
$people->expects($this->once())
->method('get')
- ->will($this->returnValue(array(
- 'name' => array(
+ ->will($this->returnValue([
+ 'name' => [
'givenName' => self::FIRSTNAME,
'familyName' => self::LASTNAME,
- ),
+ ],
'id' => self::ID,
- 'image' => array(
+ 'image' => [
'url' => self::IMAGEURL
- )
- )));
+ ]
+ ]));
$provider->getGooglePlusService()->people = $people;
@@ -185,13 +185,13 @@ class GooglePlusTest extends ProviderTestCase
protected function getAvailableFieldsForIdentity()
{
- return array(
+ return [
Identity::PROPERTY_ID => self::ID,
Identity::PROPERTY_FIRSTNAME => self::FIRSTNAME,
Identity::PROPERTY_LASTNAME => self::LASTNAME,
Identity::PROPERTY_EMAIL => self::EMAIL,
Identity::PROPERTY_IMAGEURL => self::IMAGEURL,
- );
+ ];
}
protected function getProviderForFailingIdentity()
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/LinkedinTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/LinkedinTest.php
index cf6c73c14a..0cc23a3477 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/LinkedinTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/LinkedinTest.php
@@ -13,7 +13,7 @@ class LinkedinTest extends ProviderTestCase
$state = md5(mt_rand());
$request = $this->getRequestMock();
- $this->addQueryParameter($request, array('state' => $state));
+ $this->addQueryParameter($request, ['state' => $state]);
$provider1 = $this->getProvider();
$provider1->setGuzzleClient($this->getGuzzleMock(401));
@@ -67,11 +67,11 @@ class LinkedinTest extends ProviderTestCase
$provider2->setGuzzleClient($mock);
$provider2->getSession()->set('linkedin.provider.state', $state);
- return array(
- array($this->getProvider(), $this->getRequestMock()),
- array($provider1, $request),
- array($provider2, $request),
- );
+ return [
+ [$this->getProvider(), $this->getRequestMock()],
+ [$provider1, $request],
+ [$provider2, $request],
+ ];
}
public function getProviderForLogout()
@@ -130,19 +130,19 @@ class LinkedinTest extends ProviderTestCase
$provider->getSession()->set('linkedin.provider.state', $state);
$request = $this->getRequestMock();
- $this->addQueryParameter($request, array('state' => $state));
+ $this->addQueryParameter($request, ['state' => $state]);
- return array(
- array($provider, $request),
- );
+ return [
+ [$provider, $request],
+ ];
}
public function getTestOptions()
{
- return array(
+ return [
'client-id' => 'linkedin-client-id',
'client-secret' => 'linkedin-client-secret',
- );
+ ];
}
protected function getProviderForSuccessIdentity()
@@ -176,23 +176,23 @@ class LinkedinTest extends ProviderTestCase
$response->expects($this->any())
->method('getBody')
->with($this->equalTo(true))
- ->will($this->returnValue(json_encode(array(
- 'positions' => array(
+ ->will($this->returnValue(json_encode([
+ 'positions' => [
'_total' => 1,
- 'values' => array(
- array(
- 'company' => array(
+ 'values' => [
+ [
+ 'company' => [
'name' => self::COMPANY
- )
- )
- )
- ),
+ ]
+ ]
+ ]
+ ],
'emailAddress' => self::EMAIL,
'firstName' => self::FIRSTNAME,
'id' => self::ID,
'pictureUrl' => self::IMAGEURL,
'lastName' => self::LASTNAME,
- ))));
+ ])));
$requestGet->expects($this->any())
->method('send')
@@ -210,14 +210,14 @@ class LinkedinTest extends ProviderTestCase
protected function getAvailableFieldsForIdentity()
{
- return array(
+ return [
Identity::PROPERTY_ID => self::ID,
Identity::PROPERTY_FIRSTNAME => self::FIRSTNAME,
Identity::PROPERTY_LASTNAME => self::LASTNAME,
Identity::PROPERTY_EMAIL => self::EMAIL,
Identity::PROPERTY_IMAGEURL => self::IMAGEURL,
Identity::PROPERTY_COMPANY => self::COMPANY,
- );
+ ];
}
protected function getProviderForFailingIdentity()
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/ProviderTestCase.php b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/ProviderTestCase.php
index 734e2c1e1a..951e02d7d7 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/ProviderTestCase.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/ProviderTestCase.php
@@ -66,7 +66,7 @@ abstract class ProviderTestCase extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
- $this->assertEquals(array(), $provider->getTemplates($identity));
+ $this->assertEquals([], $provider->getTemplates($identity));
}
public function testGetName()
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/Token/IdentityTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/Token/IdentityTest.php
index c1e68e6a08..b6acd72b3a 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/Token/IdentityTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/Token/IdentityTest.php
@@ -16,7 +16,7 @@ class IdentityTest extends \PHPUnit_Framework_TestCase
public function testThatConstructArgumentAreSet()
{
- $identity = new Identity(array(Identity::PROPERTY_IMAGEURL => 'image-uri'));
+ $identity = new Identity([Identity::PROPERTY_IMAGEURL => 'image-uri']);
$this->assertNull($identity->get(Identity::PROPERTY_ID));
$this->assertEquals('image-uri', $identity->get(Identity::PROPERTY_IMAGEURL));
@@ -34,7 +34,7 @@ class IdentityTest extends \PHPUnit_Framework_TestCase
public function testGetFirstname()
{
- $identity = new Identity(array(
+ $identity = new Identity([
Identity::PROPERTY_ID => 'id',
Identity::PROPERTY_IMAGEURL => 'image url',
Identity::PROPERTY_COMPANY => 'company',
@@ -42,7 +42,7 @@ class IdentityTest extends \PHPUnit_Framework_TestCase
Identity::PROPERTY_EMAIL => 'email',
Identity::PROPERTY_FIRSTNAME => 'first name',
Identity::PROPERTY_LASTNAME => 'last name',
- ));
+ ]);
$this->assertEquals($identity->getId(), $identity->get($identity::PROPERTY_ID));
$this->assertEquals($identity->getImageURI(), $identity->get($identity::PROPERTY_IMAGEURL));
@@ -58,9 +58,9 @@ class IdentityTest extends \PHPUnit_Framework_TestCase
public function testHas()
{
- $identity = new Identity(array(
+ $identity = new Identity([
Identity::PROPERTY_IMAGEURL => 'image url',
- ));
+ ]);
$this->assertTrue($identity->has(Identity::PROPERTY_IMAGEURL));
@@ -84,10 +84,10 @@ class IdentityTest extends \PHPUnit_Framework_TestCase
{
$identity = new Identity();
- $this->assertEquals(array(), $identity->all());
+ $this->assertEquals([], $identity->all());
$identity->set(Identity::PROPERTY_IMAGEURL, 'image-uri');
- $this->assertEquals(array('image_url' => 'image-uri'), $identity->all());
+ $this->assertEquals(['image_url' => 'image-uri'], $identity->all());
return $identity;
}
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/Token/TokenTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/Token/TokenTest.php
index 18873b3cf8..c0eb711003 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/Token/TokenTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/Token/TokenTest.php
@@ -48,7 +48,7 @@ class TokenTest extends \PHPUnit_Framework_TestCase
->method('getIdentity')
->will($this->returnValue($identity));
- $templates = array(25, 42);
+ $templates = [25, 42];
$provider->expects($this->once())
->method('getTemplates')
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/TwitterTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/TwitterTest.php
index 1cf3619d76..ec36534746 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/TwitterTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/TwitterTest.php
@@ -51,11 +51,11 @@ class TwitterTest extends ProviderTestCase
$provider->getTwitterClient()->expects($this->once())
->method('request')
->will($this->returncallback(function () use ($provider) {
- $provider->getTwitterClient()->response = array(
- 'response' => array(
+ $provider->getTwitterClient()->response = [
+ 'response' => [
'oauth_token' => 'twitter-oauth-token',
- )
- );
+ ]
+ ];
return 200;
}));
@@ -66,7 +66,7 @@ class TwitterTest extends ProviderTestCase
public function provideDataForFailingCallback()
{
$request = $this->getRequestMock();
- $this->addQueryParameter($request, array());
+ $this->addQueryParameter($request, []);
$provider1 = $this->getProvider();
$provider1->getTwitterClient()->expects($this->once())
@@ -82,11 +82,11 @@ class TwitterTest extends ProviderTestCase
return 401;
} else {
- $provider2->getTwitterClient()->response = array(
- 'response' => array(
+ $provider2->getTwitterClient()->response = [
+ 'response' => [
'oauth_token' => 'twitter-oauth-token',
- )
- );
+ ]
+ ];
$first = false;
@@ -94,10 +94,10 @@ class TwitterTest extends ProviderTestCase
}
}));
- return array(
- array($provider1, $request),
- array($provider2, $request),
- );
+ return [
+ [$provider1, $request],
+ [$provider2, $request],
+ ];
}
public function provideDataForSuccessCallback()
@@ -108,7 +108,7 @@ class TwitterTest extends ProviderTestCase
$provider->getSession()->set('twitter.provider.state', $state);
$request = $this->getRequestMock();
- $this->addQueryParameter($request, array('state' => $state));
+ $this->addQueryParameter($request, ['state' => $state]);
$phpunit = $this;
$provider->getTwitterClient()->expects($this->any())
@@ -116,18 +116,18 @@ class TwitterTest extends ProviderTestCase
->will($this->returnCallback(function ($method) use ($provider, $phpunit) {
switch ($method) {
case 'POST':
- $provider->getTwitterClient()->response = array(
- 'response' => array(
+ $provider->getTwitterClient()->response = [
+ 'response' => [
'oauth_token' => 'twitter-oauth-token',
- )
- );
+ ]
+ ];
break;
case 'GET':
- $provider->getTwitterClient()->response = array(
- 'response' => json_encode(array(
+ $provider->getTwitterClient()->response = [
+ 'response' => json_encode([
'id' => $phpunit::ID,
- ))
- );
+ ])
+ ];
break;
default:
throw new \InvalidArgumentException(sprintf('Invalid method %s', $method));
@@ -139,43 +139,43 @@ class TwitterTest extends ProviderTestCase
$provider->getTwitterClient()->expects($this->once())
->method('extract_params')
- ->will($this->returnValue(array(
+ ->will($this->returnValue([
'oauth_token_secret' => 'token secret',
'oauth_token' => 'token',
- )));
+ ]));
- return array(
- array($provider, $request),
- );
+ return [
+ [$provider, $request],
+ ];
}
public function getTestOptions()
{
- return array(
+ return [
'consumer-key' => 'twitter-consumer-key',
'consumer-secret' => 'twitter-consumer-secret',
- );
+ ];
}
protected function getProviderForSuccessIdentity()
{
$provider = $this->getProvider();
- $provider->getSession()->set('twitter.provider.access_token', array(
+ $provider->getSession()->set('twitter.provider.access_token', [
'oauth_token' => 'twitter token',
'oauth_token_secret' => 'token secret',
- ));
+ ]);
$phpunit = $this;
$provider->getTwitterClient()->expects($this->once())
->method('request')
->will($this->returncallback(function () use ($provider, $phpunit) {
- $provider->getTwitterClient()->response = array(
- 'response' => json_encode(array(
+ $provider->getTwitterClient()->response = [
+ 'response' => json_encode([
'screen_name' => $phpunit::USERNAME,
'profile_image_url_https' => $phpunit::IMAGEURL,
'id' => $phpunit::ID,
- ))
- );
+ ])
+ ];
return 200;
}));
@@ -185,11 +185,11 @@ class TwitterTest extends ProviderTestCase
protected function getAvailableFieldsForIdentity()
{
- return array(
+ return [
Identity::PROPERTY_ID => self::ID,
Identity::PROPERTY_USERNAME => self::USERNAME,
Identity::PROPERTY_IMAGEURL => self::IMAGEURL,
- );
+ ];
}
protected function getProviderForFailingIdentity()
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/ViadeoTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/ViadeoTest.php
index 18778ee067..f937ffbc1d 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/Provider/ViadeoTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/Provider/ViadeoTest.php
@@ -16,12 +16,12 @@ class ViadeoTest extends ProviderTestCase
$provider->getSession()->set('viadeo.provider.state', $state . mt_rand());
$request = $this->getRequestMock();
- $this->addQueryParameter($request, array('state' => $state));
+ $this->addQueryParameter($request, ['state' => $state]);
- return array(
- array($this->getProvider(), $this->getRequestMock()),
- array($provider, $request),
- );
+ return [
+ [$this->getProvider(), $this->getRequestMock()],
+ [$provider, $request],
+ ];
}
public function getProviderForLogout()
@@ -111,19 +111,19 @@ class ViadeoTest extends ProviderTestCase
$provider->getSession()->set('viadeo.provider.state', $state);
$request = $this->getRequestMock();
- $this->addQueryParameter($request, array('state' => $state));
+ $this->addQueryParameter($request, ['state' => $state]);
- return array(
- array($provider, $request),
- );
+ return [
+ [$provider, $request],
+ ];
}
public function getTestOptions()
{
- return array(
+ return [
'client-id' => 'viadeo-client-id',
'client-secret' => 'viadeo-client-secret',
- );
+ ];
}
protected function getProviderForAuthentication()
@@ -168,24 +168,24 @@ class ViadeoTest extends ProviderTestCase
$response1->expects($this->any())
->method('getBody')
->with($this->equalTo(true))
- ->will($this->returnValue(json_encode(array(
+ ->will($this->returnValue(json_encode([
'id' => self::ID,
'first_name' => self::FIRSTNAME,
'last_name' => self::LASTNAME,
'picture_large' => self::IMAGEURL,
'nickname' => self::USERNAME,
- ))));
+ ])));
$response2->expects($this->any())
->method('getBody')
->with($this->equalTo(true))
- ->will($this->returnValue(json_encode(array(
- 'data' => array(
- array(
+ ->will($this->returnValue(json_encode([
+ 'data' => [
+ [
'company_name' => self::COMPANY
- )
- ),
- ))));
+ ]
+ ],
+ ])));
$requestGet1->expects($this->any())
->method('send')
@@ -252,14 +252,14 @@ class ViadeoTest extends ProviderTestCase
protected function getAvailableFieldsForIdentity()
{
- return array(
+ return [
Identity::PROPERTY_ID => self::ID,
Identity::PROPERTY_FIRSTNAME => self::FIRSTNAME,
Identity::PROPERTY_LASTNAME => self::LASTNAME,
Identity::PROPERTY_USERNAME => self::USERNAME,
Identity::PROPERTY_IMAGEURL => self::IMAGEURL,
Identity::PROPERTY_COMPANY => self::COMPANY,
- );
+ ];
}
protected function authenticate(ProviderInterface $provider)
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/ProvidersCollectionTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/ProvidersCollectionTest.php
index 4efad8f3ad..a85a3309c2 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/ProvidersCollectionTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/ProvidersCollectionTest.php
@@ -17,7 +17,7 @@ class ProvidersCollectionTest extends \PHPUnit_Framework_TestCase
$providers = new ProvidersCollection();
$providers->register($provider);
- $expectedIterator = new \ArrayIterator(array('neutron-provider' => $provider));
+ $expectedIterator = new \ArrayIterator(['neutron-provider' => $provider]);
$this->assertEquals($expectedIterator, $providers->getIterator());
}
diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/SuggestionFinderTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/SuggestionFinderTest.php
index 26624c50c1..2d9258ef8d 100644
--- a/tests/Alchemy/Tests/Phrasea/Authentication/SuggestionFinderTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Authentication/SuggestionFinderTest.php
@@ -30,7 +30,7 @@ class SuggestionFinderTest extends \PhraseanetPHPUnitAbstract
protected function getToken($email)
{
- $identity = new Identity(array(Identity::PROPERTY_EMAIL => $email));
+ $identity = new Identity([Identity::PROPERTY_EMAIL => $email]);
$token = $this->getMockBuilder('Alchemy\Phrasea\Authentication\Provider\Token\Token')
->disableOriginalConstructor()
diff --git a/tests/Alchemy/Tests/Phrasea/Border/Attribute/FactoryTest.php b/tests/Alchemy/Tests/Phrasea/Border/Attribute/FactoryTest.php
index be27630f5a..8684f73a98 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/Attribute/FactoryTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/Attribute/FactoryTest.php
@@ -62,7 +62,7 @@ class FactoryTest extends \PhraseanetPHPUnitAbstract
$this->markTestSkipped('No databox field found');
}
- $metafield = new MetaField($databox_field, array('value'));
+ $metafield = new MetaField($databox_field, ['value']);
$attribute = Factory::getFileAttribute(self::$DI['app'], AttributeInterface::NAME_METAFIELD, $metafield->asString());
diff --git a/tests/Alchemy/Tests/Phrasea/Border/Attribute/MetaFieldTest.php b/tests/Alchemy/Tests/Phrasea/Border/Attribute/MetaFieldTest.php
index b9e497ff0d..55529e5c82 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/Attribute/MetaFieldTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/Attribute/MetaFieldTest.php
@@ -29,7 +29,7 @@ class MetaFieldTest extends \PhraseanetPHPUnitAbstract
*/
public function setUp()
{
- $this->value = array("Un éléphant ça trompe");
+ $this->value = ["Un éléphant ça trompe"];
foreach (self::$DI['collection']->get_databox()->get_meta_structure() as $databox_field) {
$this->databox_field = $databox_field;
break;
@@ -58,8 +58,8 @@ class MetaFieldTest extends \PhraseanetPHPUnitAbstract
*/
public function testConstruct()
{
- new MetaField($this->databox_field, array(0.57));
- new MetaField($this->databox_field, array(3));
+ new MetaField($this->databox_field, [0.57]);
+ new MetaField($this->databox_field, [3]);
}
/**
@@ -119,6 +119,6 @@ class MetaFieldTest extends \PhraseanetPHPUnitAbstract
{
\PHPUnit_Framework_Error_Warning::$enabled = false;
\PHPUnit_Framework_Error_Notice::$enabled = false;
- MetaField::loadFromString(self::$DI['app'], serialize(array('Elephant', 'sbas_id' => self::$DI['collection']->get_sbas_id(), 'id' => 0)));
+ MetaField::loadFromString(self::$DI['app'], serialize(['Elephant', 'sbas_id' => self::$DI['collection']->get_sbas_id(), 'id' => 0]));
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Border/Attribute/StatusTest.php b/tests/Alchemy/Tests/Phrasea/Border/Attribute/StatusTest.php
index 680f452042..105fce23e1 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/Attribute/StatusTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/Attribute/StatusTest.php
@@ -25,14 +25,14 @@ class StatusTest extends \PhraseanetPHPUnitAbstract
public function getValidStatuses()
{
- return array(
- array(123, '1111011'),
- array('123', '1111011'),
- array('0b1111011', '1111011'),
- array('1111011', '1111011'),
- array('0x7b', '1111011'),
- array('7b', '1111011'),
- );
+ return [
+ [123, '1111011'],
+ ['123', '1111011'],
+ ['0b1111011', '1111011'],
+ ['1111011', '1111011'],
+ ['0x7b', '1111011'],
+ ['7b', '1111011'],
+ ];
}
/**
@@ -47,11 +47,11 @@ class StatusTest extends \PhraseanetPHPUnitAbstract
public function getInvalidStatuses()
{
- return array(
- array('0b00z2'),
- array('0x00g2'),
- array('g2'),
- );
+ return [
+ ['0b00z2'],
+ ['0x00g2'],
+ ['g2'],
+ ];
}
/**
diff --git a/tests/Alchemy/Tests/Phrasea/Border/Checker/AbstractCheckerTest.php b/tests/Alchemy/Tests/Phrasea/Border/Checker/AbstractCheckerTest.php
index 95eb1a8923..12220c6aa2 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/Checker/AbstractCheckerTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/Checker/AbstractCheckerTest.php
@@ -19,7 +19,7 @@ class AbstractCheckerTest extends \PhraseanetPHPUnitAbstract
parent::setUp();
$this->object = new AbstractCheckerTester(self::$DI['app']);
- $this->file = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', array('getCollection'), array(), 'CheckerTesterMock' . mt_rand(), false);
+ $this->file = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', ['getCollection'], [], 'CheckerTesterMock' . mt_rand(), false);
}
public function tearDown()
@@ -66,14 +66,14 @@ class AbstractCheckerTest extends \PhraseanetPHPUnitAbstract
}
}
- $ret = array(
- array(array($collection->get_databox()), $collection, true),
- array($collection->get_databox(), $collection, true),
- array($collection->get_databox(), null, true),
- );
+ $ret = [
+ [[$collection->get_databox()], $collection, true],
+ [$collection->get_databox(), $collection, true],
+ [$collection->get_databox(), null, true],
+ ];
if ($databox) {
- $ret[] = array($databox, $collection, false);
+ $ret[] = [$databox, $collection, false];
}
return $ret;
@@ -130,13 +130,13 @@ class AbstractCheckerTest extends \PhraseanetPHPUnitAbstract
$collection = \collection::create($app, $databox, $app['phraseanet.appbox'], 'other coll');
}
- return array(
- array(array($collection), $collection, true),
- array($collection, $collection, true),
- array($collection, null, true),
- array($collection, $othercollection, false),
- array(array($collection), $othercollection, false),
- );
+ return [
+ [[$collection], $collection, true],
+ [$collection, $collection, true],
+ [$collection, null, true],
+ [$collection, $othercollection, false],
+ [[$collection], $othercollection, false],
+ ];
}
/**
@@ -194,9 +194,9 @@ class AbstractCheckerTest extends \PhraseanetPHPUnitAbstract
}
}
- return array(
- array($databox, $collection),
- );
+ return [
+ [$databox, $collection],
+ ];
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Border/Checker/ColorspaceTest.php b/tests/Alchemy/Tests/Phrasea/Border/Checker/ColorspaceTest.php
index 914ec57e48..d6722160b7 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/Checker/ColorspaceTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/Checker/ColorspaceTest.php
@@ -19,7 +19,7 @@ class ColorspaceTest extends \PhraseanetPHPUnitAbstract
public function setUp()
{
parent::setUp();
- $this->object = new Colorspace(self::$DI['app'], array('colorspaces' => array('RGB', 'cmyk')));
+ $this->object = new Colorspace(self::$DI['app'], ['colorspaces' => ['RGB', 'cmyk']]);
}
/**
@@ -59,6 +59,6 @@ class ColorspaceTest extends \PhraseanetPHPUnitAbstract
*/
public function testContructorInvalidArgumentException()
{
- new Colorspace(self::$DI['app'], array(array('RGB', 'cmyk')));
+ new Colorspace(self::$DI['app'], [['RGB', 'cmyk']]);
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Border/Checker/DimensionTest.php b/tests/Alchemy/Tests/Phrasea/Border/Checker/DimensionTest.php
index 098c5d0afe..dab2bca660 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/Checker/DimensionTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/Checker/DimensionTest.php
@@ -36,32 +36,32 @@ class DimensionTest extends \PhraseanetPHPUnitAbstract
$File = new File(self::$DI['app'], $media, self::$DI['collection']);
- $object = new Dimension(self::$DI['app'], array('width' => 800));
+ $object = new Dimension(self::$DI['app'], ['width' => 800]);
$response = $object->check(self::$DI['app']['EM'], $File);
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Checker\\Response', $response);
$this->assertFalse($response->isOk());
- $object = new Dimension(self::$DI['app'], array('width' => 500));
+ $object = new Dimension(self::$DI['app'], ['width' => 500]);
$response = $object->check(self::$DI['app']['EM'], $File);
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Checker\\Response', $response);
$this->assertFalse($response->isOk());
- $object = new Dimension(self::$DI['app'], array('width' => 400));
+ $object = new Dimension(self::$DI['app'], ['width' => 400]);
$response = $object->check(self::$DI['app']['EM'], $File);
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Checker\\Response', $response);
$this->assertTrue($response->isOk());
- $object = new Dimension(self::$DI['app'], array('width' => 600, 'height' => 500));
+ $object = new Dimension(self::$DI['app'], ['width' => 600, 'height' => 500]);
$response = $object->check(self::$DI['app']['EM'], $File);
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Checker\\Response', $response);
$this->assertFalse($response->isOk());
- $object = new Dimension(self::$DI['app'], array('width' => 600, 'height' => 400));
+ $object = new Dimension(self::$DI['app'], ['width' => 600, 'height' => 400]);
$response = $object->check(self::$DI['app']['EM'], $File);
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Checker\\Response', $response);
$this->assertTrue($response->isOk());
- $object = new Dimension(self::$DI['app'], array('width' => 200, 'height' => 200));
+ $object = new Dimension(self::$DI['app'], ['width' => 200, 'height' => 200]);
$response = $object->check(self::$DI['app']['EM'], $File);
$this->assertInstanceOf('\\Alchemy\\Phrasea\\Border\\Checker\\Response', $response);
$this->assertTrue($response->isOk());
@@ -83,7 +83,7 @@ class DimensionTest extends \PhraseanetPHPUnitAbstract
$height = $dimensions['height'];
}
- new Dimension(self::$DI['app'], array('width' => $width,'height' => $height));
+ new Dimension(self::$DI['app'], ['width' => $width,'height' => $height]);
$this->fail(sprintf('Exception raised with dimensions %s and %s', $width, $height));
} catch (\InvalidArgumentException $e) {
@@ -93,17 +93,17 @@ class DimensionTest extends \PhraseanetPHPUnitAbstract
public function getWrongDimensions()
{
- return array(
- array('width' => 0),
- array('width' => -1),
- array('width' => 5, 'height' => -4),
- array('width' => 5, 'height' => 'a'),
- array('width' => 'a', 'height' => 5),
- array('width' => 'a', 'height' => 'b'),
- array('width' => 'a'),
- array('width' => 0, 'height' => 35),
- array('width' => 30, 'height' => 0)
- );
+ return [
+ ['width' => 0],
+ ['width' => -1],
+ ['width' => 5, 'height' => -4],
+ ['width' => 5, 'height' => 'a'],
+ ['width' => 'a', 'height' => 5],
+ ['width' => 'a', 'height' => 'b'],
+ ['width' => 'a'],
+ ['width' => 0, 'height' => 35],
+ ['width' => 30, 'height' => 0]
+ ];
}
/**
@@ -119,6 +119,6 @@ class DimensionTest extends \PhraseanetPHPUnitAbstract
*/
public function testContructorInvalidArgumentException()
{
- new Dimension(self::$DI['app'], array('witdh' => 38));
+ new Dimension(self::$DI['app'], ['witdh' => 38]);
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Border/Checker/ExtensionTest.php b/tests/Alchemy/Tests/Phrasea/Border/Checker/ExtensionTest.php
index d597f778ec..5a8e9992d2 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/Checker/ExtensionTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/Checker/ExtensionTest.php
@@ -19,7 +19,7 @@ class ExtensionTest extends \PhraseanetPHPUnitAbstract
public function setUp()
{
parent::setUp();
- $this->object = new Extension(self::$DI['app'], array('extensions' => array('jpg', 'png', 'tiff')));
+ $this->object = new Extension(self::$DI['app'], ['extensions' => ['jpg', 'png', 'tiff']]);
}
/**
@@ -27,16 +27,16 @@ class ExtensionTest extends \PhraseanetPHPUnitAbstract
*/
public function testCheck()
{
- $tests = array(
+ $tests = [
'jpg' => true,
'JPG' => true,
'tiff' => true,
'exe' => false,
- );
+ ];
foreach ($tests as $extension => $result) {
- $spl = $this->getMock('\\Symfony\\Component\\HttpFoundation\\File\\File', array('getExtension'), array(__DIR__ . '/../../../../../files/test001.jpg'));
+ $spl = $this->getMock('\\Symfony\\Component\\HttpFoundation\\File\\File', ['getExtension'], [__DIR__ . '/../../../../../files/test001.jpg']);
$spl->expects($this->any())
->method('getExtension')
@@ -71,6 +71,6 @@ class ExtensionTest extends \PhraseanetPHPUnitAbstract
*/
public function testContructorInvalidArgumentException()
{
- new Extension(self::$DI['app'], array(array('jpg', 'png', 'tiff')));
+ new Extension(self::$DI['app'], [['jpg', 'png', 'tiff']]);
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Border/Checker/FilenameTest.php b/tests/Alchemy/Tests/Phrasea/Border/Checker/FilenameTest.php
index 39af3df279..8cf56ff7fc 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/Checker/FilenameTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/Checker/FilenameTest.php
@@ -55,7 +55,7 @@ class FilenameTest extends \PhraseanetPHPUnitAbstract
*/
public function testCheckNoFile()
{
- $mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', array('getOriginalName'), array(self::$DI['app'], $this->media, self::$DI['collection']));
+ $mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', ['getOriginalName'], [self::$DI['app'], $this->media, self::$DI['collection']]);
$mock
->expects($this->once())
@@ -78,7 +78,7 @@ class FilenameTest extends \PhraseanetPHPUnitAbstract
*/
public function testCheckSensitive()
{
- $mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', array('getOriginalName'), array(self::$DI['app'], $this->media, self::$DI['collection']));
+ $mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', ['getOriginalName'], [self::$DI['app'], $this->media, self::$DI['collection']]);
$mock
->expects($this->any())
@@ -92,7 +92,7 @@ class FilenameTest extends \PhraseanetPHPUnitAbstract
$this->assertFalse($response->isOk());
- $objectSensitive = new Filename(self::$DI['app'], array('sensitive' => true));
+ $objectSensitive = new Filename(self::$DI['app'], ['sensitive' => true]);
$responseSensitive = $objectSensitive->check(self::$DI['app']['EM'], $mock);
$this->assertTrue($responseSensitive->isOk());
diff --git a/tests/Alchemy/Tests/Phrasea/Border/Checker/MediaTypeTest.php b/tests/Alchemy/Tests/Phrasea/Border/Checker/MediaTypeTest.php
index 42d64c6820..809f7effb6 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/Checker/MediaTypeTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/Checker/MediaTypeTest.php
@@ -19,7 +19,7 @@ class MediaTypeTest extends \PhraseanetPHPUnitAbstract
public function setUp()
{
parent::setUp();
- $this->object = new MediaType(self::$DI['app'], array('mediatypes' => array(MediaType::TYPE_IMAGE)));
+ $this->object = new MediaType(self::$DI['app'], ['mediatypes' => [MediaType::TYPE_IMAGE]]);
}
/**
@@ -33,7 +33,7 @@ class MediaTypeTest extends \PhraseanetPHPUnitAbstract
$this->assertTrue($response->isOk());
- $object = new MediaType(self::$DI['app'], array('mediatypes' => array(MediaType::TYPE_VIDEO, MediaType::TYPE_AUDIO)));
+ $object = new MediaType(self::$DI['app'], ['mediatypes' => [MediaType::TYPE_VIDEO, MediaType::TYPE_AUDIO]]);
$media = self::$DI['app']['mediavorus']->guess(__DIR__ . '/../../../../../files/test001.jpg');
$file = new File(self::$DI['app'], $media, self::$DI['collection']);
@@ -55,6 +55,6 @@ class MediaTypeTest extends \PhraseanetPHPUnitAbstract
*/
public function testContructorInvalidArgumentException()
{
- new MediaType(self::$DI['app'], array(array(MediaType::TYPE_IMAGE)));
+ new MediaType(self::$DI['app'], [[MediaType::TYPE_IMAGE]]);
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Border/Checker/ResponseTest.php b/tests/Alchemy/Tests/Phrasea/Border/Checker/ResponseTest.php
index 35de04f622..0a88ca669e 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/Checker/ResponseTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/Checker/ResponseTest.php
@@ -15,7 +15,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase
public function setUp()
{
parent::setUp();
- $this->mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\Checker\\CheckerInterface', array('getMessage', 'check', 'isApplicable'));
+ $this->mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\Checker\\CheckerInterface', ['getMessage', 'check', 'isApplicable']);
$this->object = new Response(true, $this->mock);
}
diff --git a/tests/Alchemy/Tests/Phrasea/Border/Checker/Sha256Test.php b/tests/Alchemy/Tests/Phrasea/Border/Checker/Sha256Test.php
index 4bcef887dc..f77e5b91af 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/Checker/Sha256Test.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/Checker/Sha256Test.php
@@ -43,7 +43,7 @@ class Sha256Test extends \PhraseanetPHPUnitAbstract
self::$DI['app']['border-manager']->process($session, File::buildFromPathfile($this->media->getFile()->getPathname(), self::$DI['collection'], self::$DI['app']), null, Manager::FORCE_RECORD);
- $mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', array('getSha256'), array(self::$DI['app'], $this->media, self::$DI['collection']));
+ $mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', ['getSha256'], [self::$DI['app'], $this->media, self::$DI['collection']]);
$mock
->expects($this->once())
@@ -63,7 +63,7 @@ class Sha256Test extends \PhraseanetPHPUnitAbstract
*/
public function testCheckNoFile()
{
- $mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', array('getSha256'), array(self::$DI['app'], $this->media, self::$DI['collection']));
+ $mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', ['getSha256'], [self::$DI['app'], $this->media, self::$DI['collection']]);
$mock
->expects($this->once())
diff --git a/tests/Alchemy/Tests/Phrasea/Border/Checker/UUIDTest.php b/tests/Alchemy/Tests/Phrasea/Border/Checker/UUIDTest.php
index 553b2eb60d..95ec65168c 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/Checker/UUIDTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/Checker/UUIDTest.php
@@ -49,7 +49,7 @@ class UUIDTest extends \PhraseanetPHPUnitAbstract
*/
public function testCheckNoFile()
{
- $mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', array('getUUID'), array(self::$DI['app'], $this->media, self::$DI['collection']));
+ $mock = $this->getMock('\\Alchemy\\Phrasea\\Border\\File', ['getUUID'], [self::$DI['app'], $this->media, self::$DI['collection']]);
$mock
->expects($this->once())
diff --git a/tests/Alchemy/Tests/Phrasea/Border/FileTest.php b/tests/Alchemy/Tests/Phrasea/Border/FileTest.php
index 40e124da51..ee3135cbe9 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/FileTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/FileTest.php
@@ -160,7 +160,7 @@ class FileTest extends \PhraseanetPHPUnitAbstract
*/
public function testGetAttributes()
{
- $this->assertSame(array(), $this->object->getAttributes());
+ $this->assertSame([], $this->object->getAttributes());
}
/**
@@ -175,16 +175,16 @@ class FileTest extends \PhraseanetPHPUnitAbstract
$attribute1 = new Metadata($metadata1);
$this->object->addAttribute($attribute1);
- $this->assertSame(array($attribute1), $this->object->getAttributes());
+ $this->assertSame([$attribute1], $this->object->getAttributes());
$tag = new Keywords();
- $value = new Multi(array('Later', 'Alligator'));
+ $value = new Multi(['Later', 'Alligator']);
$metadata2 = new PHPExiftoolMetadata($tag, $value);
$attribute2 = new Metadata($metadata2);
$this->object->addAttribute($attribute2);
- $this->assertSame(array($attribute1, $attribute2), $this->object->getAttributes());
+ $this->assertSame([$attribute1, $attribute2], $this->object->getAttributes());
}
/**
diff --git a/tests/Alchemy/Tests/Phrasea/Border/ManagerTest.php b/tests/Alchemy/Tests/Phrasea/Border/ManagerTest.php
index 1e82ca3bc2..2b7a52c373 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/ManagerTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/ManagerTest.php
@@ -75,7 +75,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function testProcess()
{
- $records = array();
+ $records = [];
$postProcessRecord = function ($record) use (&$records) {
$records[] = $record;
@@ -117,7 +117,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testProcessForceLazaret()
{
- $records = array();
+ $records = [];
$postProcessRecord = function ($record) use (&$records) {
$records[] = $record;
@@ -137,7 +137,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testCreateRecord()
{
- $records = array();
+ $records = [];
$postProcessRecord = function ($record) use (&$records) {
$records[] = $record;
@@ -145,7 +145,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$file = File::buildFromPathfile(self::$file1, self::$DI['collection'], self::$DI['app']);
$first = $odd = false;
- $tofetch = array();
+ $tofetch = [];
foreach (self::$DI['collection']->get_databox()->get_meta_structure() as $databox_field) {
if ($databox_field->is_readonly()) {
continue;
@@ -157,7 +157,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
if ($databox_field->is_multi()) {
- $data = array('a', 'Hello Multi ' . $databox_field->get_tag()->getTagname());
+ $data = ['a', 'Hello Multi ' . $databox_field->get_tag()->getTagname()];
$tofetch [$databox_field->get_name()] = $data;
$data[] = null;
@@ -166,7 +166,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$file->addAttribute(new Metadata(new \PHPExiftool\Driver\Metadata\Metadata($databox_field->get_tag(), $value)));
} else {
- $data = array('Hello Mono ' . $databox_field->get_tag()->getTagname());
+ $data = ['Hello Mono ' . $databox_field->get_tag()->getTagname()];
if (!$first) {
if ($odd) {
@@ -178,7 +178,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$value = new \PHPExiftool\Driver\Value\Mono(current($data));
$tofetch [$databox_field->get_name()] = $data;
- $file->addAttribute(new MetaField($databox_field, array(current($data))));
+ $file->addAttribute(new MetaField($databox_field, [current($data)]));
}
}
if ($first) {
@@ -230,7 +230,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
foreach ($tofetch as $name => $values) {
- $found = array();
+ $found = [];
foreach ($record->get_caption()->get_field($name)->get_values() as $value) {
$found[] = $value->getValue();
}
@@ -258,7 +258,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$file = File::buildFromPathfile(self::$file1, self::$DI['collection'], self::$DI['app']);
$odd = false;
- $tofetchMeta = $tofetchField = array();
+ $tofetchMeta = $tofetchField = [];
foreach (self::$DI['collection']->get_databox()->get_meta_structure() as $databox_field) {
if ($databox_field->is_readonly()) {
continue;
@@ -270,7 +270,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
if ($databox_field->is_multi()) {
- $data = array('a', 'Hello Multi ' . $databox_field->get_tag()->getTagname());
+ $data = ['a', 'Hello Multi ' . $databox_field->get_tag()->getTagname()];
$tofetchMeta [$databox_field->get_tag()->getTagname()] = $data;
$value = new \PHPExiftool\Driver\Value\Multi($data);
@@ -278,7 +278,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$file->addAttribute(new Metadata(new \PHPExiftool\Driver\Metadata\Metadata($databox_field->get_tag(), $value)));
} else {
- $data = array('Hello Mono ' . $databox_field->get_tag()->getTagname());
+ $data = ['Hello Mono ' . $databox_field->get_tag()->getTagname()];
if ($odd) {
$value = new \PHPExiftool\Driver\Value\Mono(current($data));
@@ -288,7 +288,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
} else {
$tofetchField [$databox_field->get_name()] = $data;
- $file->addAttribute(new MetaField($databox_field, array(current($data))));
+ $file->addAttribute(new MetaField($databox_field, [current($data)]));
}
}
@@ -308,7 +308,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$story_found = $status_found = false;
- $foundMeta = $foundField = array();
+ $foundMeta = $foundField = [];
/* @var $lazaret \Alchemy\Phrasea\Model\Entities\LazaretFile */
foreach ($lazaret->getAttributes() as $attr) {
@@ -323,7 +323,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$tagname = $attribute->getValue()->getTag()->getTagname();
if (!isset($foundMeta[$tagname])) {
- $foundMeta[$tagname] = array();
+ $foundMeta[$tagname] = [];
}
$foundMeta[$tagname] = array_merge($foundMeta[$tagname], $attribute->getValue()->getValue()->asArray());
@@ -332,7 +332,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$fieldname = $attribute->getField()->get_name();
if (!isset($foundField[$fieldname])) {
- $foundField[$fieldname] = array();
+ $foundField[$fieldname] = [];
}
$foundField[$fieldname] = array_merge($foundField[$fieldname], (array) $attribute->getValue());
@@ -375,7 +375,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$monoData = new \PHPExiftool\Driver\Metadata\Metadata($objectNameTag, $monoValue);
$personInImageTag = new \PHPExiftool\Driver\Tag\XMPIptcExt\PersonInImage();
- $multiValue = new \PHPExiftool\Driver\Value\Multi(array('Babar', 'Celeste'));
+ $multiValue = new \PHPExiftool\Driver\Value\Multi(['Babar', 'Celeste']);
$multiData = new \PHPExiftool\Driver\Metadata\Metadata($personInImageTag, $multiValue);
$file->addAttribute(new Metadata($monoData));
@@ -418,7 +418,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$file = File::buildFromPathfile(__DIR__ . '/../../../../files/HelloWorld.pdf', self::$DI['collection'], self::$DI['app']);
$manager->addMediaAttributesTester($file);
- $toFound = array(
+ $toFound = [
'Phraseanet:tf-width',
'Phraseanet:tf-height',
'Phraseanet:tf-bits',
@@ -430,14 +430,14 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
'Phraseanet:tf-basename',
'Phraseanet:tf-extension',
'Phraseanet:tf-size',
- );
+ ];
foreach ($file->getAttributes() as $attribute) {
if ($attribute->getName() == AttributeInterface::NAME_METADATA) {
$tagname = $attribute->getValue()->getTag()->getTagname();
if (in_array($tagname, $toFound)) {
$previousC = count($toFound);
- $tmp = array();
+ $tmp = [];
foreach ($toFound as $val) {
if ($tagname != $val) {
$tmp[] = $val;
@@ -449,7 +449,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
}
}
- $this->assertEquals(array('Phraseanet:tf-duration'), $toFound);
+ $this->assertEquals(['Phraseanet:tf-duration'], $toFound);
}
/**
@@ -466,7 +466,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$count = count($file->getAttributes());
- $toFound = array(
+ $toFound = [
'Phraseanet:tf-width',
'Phraseanet:tf-height',
'Phraseanet:tf-bits',
@@ -477,14 +477,14 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
'Phraseanet:tf-basename',
'Phraseanet:tf-extension',
'Phraseanet:tf-size',
- );
+ ];
foreach ($file->getAttributes() as $attribute) {
if ($attribute->getName() == AttributeInterface::NAME_METADATA) {
$tagname = $attribute->getValue()->getTag()->getTagname();
if (in_array($tagname, $toFound)) {
$previousC = count($toFound);
- $tmp = array();
+ $tmp = [];
foreach ($toFound as $val) {
if ($tagname != $val) {
$tmp[] = $val;
@@ -496,7 +496,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
}
}
- $this->assertEquals(array('Phraseanet:tf-width', 'Phraseanet:tf-height', 'Phraseanet:tf-bits', 'Phraseanet:tf-channels'), $toFound);
+ $this->assertEquals(['Phraseanet:tf-width', 'Phraseanet:tf-height', 'Phraseanet:tf-bits', 'Phraseanet:tf-channels'], $toFound);
}
/**
@@ -513,7 +513,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$count = count($file->getAttributes());
- $toFound = array(
+ $toFound = [
'Phraseanet:tf-width',
'Phraseanet:tf-height',
'Phraseanet:tf-bits',
@@ -524,14 +524,14 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
'Phraseanet:tf-basename',
'Phraseanet:tf-extension',
'Phraseanet:tf-size',
- );
+ ];
foreach ($file->getAttributes() as $attribute) {
if ($attribute->getName() == AttributeInterface::NAME_METADATA) {
$tagname = $attribute->getValue()->getTag()->getTagname();
if (in_array($tagname, $toFound)) {
$previousC = count($toFound);
- $tmp = array();
+ $tmp = [];
foreach ($toFound as $val) {
if ($tagname != $val) {
$tmp[] = $val;
@@ -543,7 +543,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
}
}
- $this->assertEquals(array('Phraseanet:tf-duration'), $toFound);
+ $this->assertEquals(['Phraseanet:tf-duration'], $toFound);
}
/**
@@ -551,7 +551,7 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testGetVisa()
{
- $records = array();
+ $records = [];
$postProcessRecord = function ($record) use (&$records) {
$records[] = $record;
@@ -592,14 +592,14 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testRegisterChecker()
{
- $this->assertEquals(array(), $this->object->getCheckers());
+ $this->assertEquals([], $this->object->getCheckers());
$shaChecker = new Sha256(self::$DI['app']);
$this->object->registerChecker($shaChecker);
$uuidChecker = new UUID(self::$DI['app']);
$this->object->registerChecker($uuidChecker);
- $this->assertEquals(array($shaChecker, $uuidChecker), $this->object->getCheckers());
+ $this->assertEquals([$shaChecker, $uuidChecker], $this->object->getCheckers());
}
/**
@@ -608,13 +608,13 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testRegisterCheckers()
{
- $this->assertEquals(array(), $this->object->getCheckers());
+ $this->assertEquals([], $this->object->getCheckers());
$shaChecker = new Sha256(self::$DI['app']);
$uuidChecker = new UUID(self::$DI['app']);
- $this->object->registerCheckers(array($shaChecker, $uuidChecker));
+ $this->object->registerCheckers([$shaChecker, $uuidChecker]);
- $this->assertEquals(array($shaChecker, $uuidChecker), $this->object->getCheckers());
+ $this->assertEquals([$shaChecker, $uuidChecker], $this->object->getCheckers());
}
/**
@@ -622,17 +622,17 @@ class ManagerTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/
public function testUnregisterChecker()
{
- $this->assertEquals(array(), $this->object->getCheckers());
+ $this->assertEquals([], $this->object->getCheckers());
$shaChecker = new Sha256(self::$DI['app']);
$uuidChecker = new UUID(self::$DI['app']);
$filenameChecker = new Filename(self::$DI['app']);
- $this->object->registerCheckers(array($shaChecker, $uuidChecker, $filenameChecker));
+ $this->object->registerCheckers([$shaChecker, $uuidChecker, $filenameChecker]);
- $this->assertEquals(array($shaChecker, $uuidChecker, $filenameChecker), $this->object->getCheckers());
+ $this->assertEquals([$shaChecker, $uuidChecker, $filenameChecker], $this->object->getCheckers());
$this->object->unregisterChecker($uuidChecker);
- $this->assertEquals(array($shaChecker, $filenameChecker), $this->object->getCheckers());
+ $this->assertEquals([$shaChecker, $filenameChecker], $this->object->getCheckers());
}
/**
diff --git a/tests/Alchemy/Tests/Phrasea/Border/MetaFieldsBagTest.php b/tests/Alchemy/Tests/Phrasea/Border/MetaFieldsBagTest.php
index dc3dd6240d..a5dae53959 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/MetaFieldsBagTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/MetaFieldsBagTest.php
@@ -38,11 +38,11 @@ class MetaFieldsBagTest extends \PhraseanetPHPUnitAbstract
foreach ($structure as $databox_field) {
if (!$monoAdded) {
- $this->object->set($databox_field->get_name(), new MetaField($databox_field, array('mono value')));
+ $this->object->set($databox_field->get_name(), new MetaField($databox_field, ['mono value']));
$monoAdded = $databox_field->get_id();
} elseif (!$multiAdded) {
if ($databox_field->is_multi()) {
- $this->object->set($databox_field->get_name(), new MetaField($databox_field, array('multi', 'value')));
+ $this->object->set($databox_field->get_name(), new MetaField($databox_field, ['multi', 'value']));
$multiAdded = $databox_field->get_id();
}
} else {
@@ -54,22 +54,22 @@ class MetaFieldsBagTest extends \PhraseanetPHPUnitAbstract
$this->markTestSkipped('Unable to find multi value field');
}
- $this->assertEquals(array(
- array(
+ $this->assertEquals([
+ [
'meta_struct_id' => $monoAdded,
'value' => 'mono value',
'meta_id' => null
- ),
- array(
+ ],
+ [
'meta_struct_id' => $multiAdded,
'value' => 'multi',
'meta_id' => null
- ),
- array(
+ ],
+ [
'meta_struct_id' => $multiAdded,
'value' => 'value',
'meta_id' => null
- ),
- ), $this->object->toMetadataArray($structure));
+ ],
+ ], $this->object->toMetadataArray($structure));
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Border/MetadataBagTest.php b/tests/Alchemy/Tests/Phrasea/Border/MetadataBagTest.php
index fcfc20fd12..8361b97914 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/MetadataBagTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/MetadataBagTest.php
@@ -37,7 +37,7 @@ class MetadataBagTest extends \PhraseanetPHPUnitAbstract
$structure = self::$DI['collection']->get_databox()->get_meta_structure();
$valueMono = new Mono('mono value');
- $valueMulti = new Multi(array('multi', 'value'));
+ $valueMulti = new Multi(['multi', 'value']);
$monoAdded = $multiAdded = false;
@@ -59,22 +59,22 @@ class MetadataBagTest extends \PhraseanetPHPUnitAbstract
$this->markTestSkipped('Unable to find multi value field');
}
- $this->assertEquals(array(
- array(
+ $this->assertEquals([
+ [
'meta_struct_id' => $monoAdded,
'value' => 'mono value',
'meta_id' => null
- ),
- array(
+ ],
+ [
'meta_struct_id' => $multiAdded,
'value' => 'multi',
'meta_id' => null
- ),
- array(
+ ],
+ [
'meta_struct_id' => $multiAdded,
'value' => 'value',
'meta_id' => null
- ),
- ), $this->object->toMetadataArray($structure));
+ ],
+ ], $this->object->toMetadataArray($structure));
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Border/VisaTest.php b/tests/Alchemy/Tests/Phrasea/Border/VisaTest.php
index a449d0fd85..e4743a2ff6 100644
--- a/tests/Alchemy/Tests/Phrasea/Border/VisaTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Border/VisaTest.php
@@ -27,14 +27,14 @@ class VisaTest extends \PhraseanetPHPUnitAbstract
{
$visa = new Visa();
- $this->assertEquals(array(), $visa->getResponses());
+ $this->assertEquals([], $visa->getResponses());
$response = new Response(true, new Filename(self::$DI['app']));
$visa->addResponse($response);
$response2 = new Response(false, new Filename(self::$DI['app']));
$visa->addResponse($response2);
- $this->assertSame(array($response, $response2), $visa->getResponses());
+ $this->assertSame([$response, $response2], $visa->getResponses());
}
/**
diff --git a/tests/Alchemy/Tests/Phrasea/Cache/ConnectionFactoryTest.php b/tests/Alchemy/Tests/Phrasea/Cache/ConnectionFactoryTest.php
index 5e6166e7c1..ef7c0bab52 100644
--- a/tests/Alchemy/Tests/Phrasea/Cache/ConnectionFactoryTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Cache/ConnectionFactoryTest.php
@@ -31,7 +31,7 @@ class ConnectionFactoryTest extends \PHPUnit_Framework_TestCase
}
$factory = new ConnectionFactory();
- $redis = $factory->getRedisConnection(array('host' => 'unknown-host', 'port' => 666));
+ $redis = $factory->getRedisConnection(['host' => 'unknown-host', 'port' => 666]);
$this->assertInstanceOf('Redis', $redis);
$this->assertSame($redis, $factory->getRedisConnection());
@@ -61,7 +61,7 @@ class ConnectionFactoryTest extends \PHPUnit_Framework_TestCase
}
$factory = new ConnectionFactory();
- $memcached = $factory->getMemcachedConnection(array('host' => 'unknown-host', 'port' => 666));
+ $memcached = $factory->getMemcachedConnection(['host' => 'unknown-host', 'port' => 666]);
$this->assertInstanceOf('Memcached', $memcached);
$this->assertSame($memcached, $factory->getMemcachedConnection());
@@ -91,7 +91,7 @@ class ConnectionFactoryTest extends \PHPUnit_Framework_TestCase
}
$factory = new ConnectionFactory();
- $memcache = $factory->getMemcacheConnection(array('host' => 'unknown-host', 'port' => 666));
+ $memcache = $factory->getMemcacheConnection(['host' => 'unknown-host', 'port' => 666]);
$this->assertInstanceOf('Memcache', $memcache);
$this->assertSame($memcache, $factory->getMemcacheConnection());
diff --git a/tests/Alchemy/Tests/Phrasea/Cache/FactoryTest.php b/tests/Alchemy/Tests/Phrasea/Cache/FactoryTest.php
index a65287cd8d..e43fc97717 100644
--- a/tests/Alchemy/Tests/Phrasea/Cache/FactoryTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Cache/FactoryTest.php
@@ -17,26 +17,26 @@ class FactoryTest extends \PHPUnit_Framework_TestCase
}
$factory = new Factory(new ConnectionFactory());
- $this->assertInstanceOf($expected, $factory->create($name, array()));
+ $this->assertInstanceOf($expected, $factory->create($name, []));
}
public function provideCacheTypes()
{
- return array(
- array('apc', 'apc', 'Alchemy\Phrasea\Cache\ApcCache'),
- array('apccache', 'apc', 'Alchemy\Phrasea\Cache\ApcCache'),
- array('array', null, 'Alchemy\Phrasea\Cache\ArrayCache'),
- array('arraycache', null, 'Alchemy\Phrasea\Cache\ArrayCache'),
- array('memcache', 'memcache', 'Alchemy\Phrasea\Cache\MemcacheCache'),
- array('memcachecache', 'memcache', 'Alchemy\Phrasea\Cache\MemcacheCache'),
- array('memcached', 'memcached', 'Alchemy\Phrasea\Cache\MemcachedCache'),
- array('memcachecached', 'memcached', 'Alchemy\Phrasea\Cache\MemcachedCache'),
- array('redis', 'redis', 'Alchemy\Phrasea\Cache\RedisCache'),
- array('rediscache', 'redis', 'Alchemy\Phrasea\Cache\RedisCache'),
- array('wincache', 'wincache', 'Alchemy\Phrasea\Cache\WincacheCache'),
- array('wincachecache', 'wincache', 'Alchemy\Phrasea\Cache\WincacheCache'),
- array('xcache', 'xcache', 'Alchemy\Phrasea\Cache\XcacheCache'),
- array('xcachecache', 'xcache', 'Alchemy\Phrasea\Cache\XcacheCache'),
- );
+ return [
+ ['apc', 'apc', 'Alchemy\Phrasea\Cache\ApcCache'],
+ ['apccache', 'apc', 'Alchemy\Phrasea\Cache\ApcCache'],
+ ['array', null, 'Alchemy\Phrasea\Cache\ArrayCache'],
+ ['arraycache', null, 'Alchemy\Phrasea\Cache\ArrayCache'],
+ ['memcache', 'memcache', 'Alchemy\Phrasea\Cache\MemcacheCache'],
+ ['memcachecache', 'memcache', 'Alchemy\Phrasea\Cache\MemcacheCache'],
+ ['memcached', 'memcached', 'Alchemy\Phrasea\Cache\MemcachedCache'],
+ ['memcachecached', 'memcached', 'Alchemy\Phrasea\Cache\MemcachedCache'],
+ ['redis', 'redis', 'Alchemy\Phrasea\Cache\RedisCache'],
+ ['rediscache', 'redis', 'Alchemy\Phrasea\Cache\RedisCache'],
+ ['wincache', 'wincache', 'Alchemy\Phrasea\Cache\WincacheCache'],
+ ['wincachecache', 'wincache', 'Alchemy\Phrasea\Cache\WincacheCache'],
+ ['xcache', 'xcache', 'Alchemy\Phrasea\Cache\XcacheCache'],
+ ['xcachecache', 'xcache', 'Alchemy\Phrasea\Cache\XcacheCache'],
+ ];
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Cache/ManagerTest.php b/tests/Alchemy/Tests/Phrasea/Cache/ManagerTest.php
index a5f39f66ce..32e3311406 100644
--- a/tests/Alchemy/Tests/Phrasea/Cache/ManagerTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Cache/ManagerTest.php
@@ -33,7 +33,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
private function createEmptyRegistry()
{
- file_put_contents($this->file, $this->compiler->compile(array()));
+ file_put_contents($this->file, $this->compiler->compile([]));
}
public function testFactoryCreateOne()
@@ -54,7 +54,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
$cache = $this->getMock('Alchemy\Phrasea\Cache\Cache');
$name = 'array';
- $values = array('option', 'value');
+ $values = ['option', 'value'];
$factory->expects($this->once())
->method('create')
@@ -72,7 +72,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
public function testNoCompilationIfNoChange()
{
- file_put_contents($this->file, $this->compiler->compile(array("custom-type" => "array")));
+ file_put_contents($this->file, $this->compiler->compile(["custom-type" => "array"]));
$compiler = $this->getMockBuilder('Alchemy\Phrasea\Core\Configuration\Compiler')
->disableOriginalConstructor()
@@ -90,7 +90,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
$cache = $this->getMock('Alchemy\Phrasea\Cache\Cache');
$name = 'array';
- $values = array('option', 'value');
+ $values = ['option', 'value'];
$factory->expects($this->once())
->method('create')
@@ -103,11 +103,11 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
public function testNoCompilationIfNoChangeWithMultiple()
{
- file_put_contents($this->file, $this->compiler->compile(array(
+ file_put_contents($this->file, $this->compiler->compile([
"custom-type" => "array",
"another-type" => "array",
"yet-another-type" => "array",
- )));
+ ]));
$compiler = $this->getMockBuilder('Alchemy\Phrasea\Core\Configuration\Compiler')
->disableOriginalConstructor()
@@ -125,7 +125,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
$cache = $this->getMock('Alchemy\Phrasea\Cache\Cache');
$name = 'array';
- $values = array('option', 'value');
+ $values = ['option', 'value'];
$factory->expects($this->exactly(3))
->method('create')
@@ -146,9 +146,9 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
public function testUnknownCacheReturnsArrayCacheAndLogs()
{
- file_put_contents($this->file, $this->compiler->compile(array(
+ file_put_contents($this->file, $this->compiler->compile([
"custom-type" => "unknown",
- )));
+ ]));
$compiler = $this->getMockBuilder('Alchemy\Phrasea\Core\Configuration\Compiler')
->disableOriginalConstructor()
@@ -169,7 +169,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
$cache = $this->getMock('Alchemy\Phrasea\Cache\Cache');
$name = 'unknown';
- $values = array('option', 'value');
+ $values = ['option', 'value'];
$factory->expects($this->at(0))
->method('create')
@@ -178,7 +178,7 @@ class ManagerTest extends \PHPUnit_Framework_TestCase
$factory->expects($this->at(1))
->method('create')
- ->with('array', array())
+ ->with('array', [])
->will($this->returnValue($cache));
$manager = new Manager($compiler, $this->file, $logger, $factory);
diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/BowerInstallTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/BowerInstallTest.php
index 430f811031..da626abb8f 100644
--- a/tests/Alchemy/Tests/Phrasea/Command/Developper/BowerInstallTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Command/Developper/BowerInstallTest.php
@@ -24,7 +24,7 @@ class BowerInstallTest extends \PhraseanetPHPUnitAbstract
->getMock();
$mockedCommand = $this->getMockBuilder('Symfony\Component\Console\Command\Command')
- ->setMethods(array('execute'))
+ ->setMethods(['execute'])
->disableOriginalConstructor()
->getMock();
diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/ComposerInstallTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/ComposerInstallTest.php
index bc6c04b95e..0637e6a616 100644
--- a/tests/Alchemy/Tests/Phrasea/Command/Developper/ComposerInstallTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Command/Developper/ComposerInstallTest.php
@@ -21,7 +21,7 @@ class ComposerInstallTest extends \PhraseanetPHPUnitAbstract
self::$DI['cli']['driver.composer']->expects($this->at(1))
->method('command')
- ->with(array('install', '--optimize-autoloader', '--quiet', '--no-interaction', '--dev'));
+ ->with(['install', '--optimize-autoloader', '--quiet', '--no-interaction', '--dev']);
$command = new ComposerInstall();
$command->setContainer(self::$DI['cli']);
diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/InstallAllTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/InstallAllTest.php
index fffc011946..ae82cbe3ca 100644
--- a/tests/Alchemy/Tests/Phrasea/Command/Developper/InstallAllTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Command/Developper/InstallAllTest.php
@@ -16,12 +16,12 @@ class InstallAllTest extends \PhraseanetPHPUnitAbstract
->getMock();
$n = 0;
- foreach (array(
+ foreach ([
'dependencies:composer',
'dependencies:bower'
- ) as $name) {
+ ] as $name) {
$command = $this->getMockBuilder('Symfony\Component\Console\Command\Command')
- ->setMethods(array('execute'))
+ ->setMethods(['execute'])
->disableOriginalConstructor()
->getMock();
$command->expects($this->once())
diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/BowerDriverTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/BowerDriverTest.php
index 3759fae184..4d7fb73975 100644
--- a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/BowerDriverTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/BowerDriverTest.php
@@ -19,7 +19,7 @@ class BowerDriverTest extends \PHPUnit_Framework_TestCase
$finder = new PhpExecutableFinder();
$php = $finder->find();
- $driver = BowerDriver::create(array('bower.binaries' => $php));
+ $driver = BowerDriver::create(['bower.binaries' => $php]);
$this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\BowerDriver', $driver);
$this->assertEquals($php, $driver->getProcessBuilderFactory()->getBinary());
}
diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/ComposerDriverTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/ComposerDriverTest.php
index 9f9c1c2082..966f8bd515 100644
--- a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/ComposerDriverTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/ComposerDriverTest.php
@@ -19,7 +19,7 @@ class ComposerDriverTest extends \PHPUnit_Framework_TestCase
$finder = new PhpExecutableFinder();
$php = $finder->find();
- $driver = ComposerDriver::create(array('composer.binaries' => $php));
+ $driver = ComposerDriver::create(['composer.binaries' => $php]);
$this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\ComposerDriver', $driver);
$this->assertEquals($php, $driver->getProcessBuilderFactory()->getBinary());
}
diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/GruntDriverTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/GruntDriverTest.php
index ba1bfa01d5..945b4cb4d7 100644
--- a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/GruntDriverTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/GruntDriverTest.php
@@ -19,7 +19,7 @@ class GruntDriverTest extends \PHPUnit_Framework_TestCase
$finder = new PhpExecutableFinder();
$php = $finder->find();
- $driver = GruntDriver::create(array('grunt.binaries' => $php));
+ $driver = GruntDriver::create(['grunt.binaries' => $php]);
$this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\GruntDriver', $driver);
$this->assertEquals($php, $driver->getProcessBuilderFactory()->getBinary());
}
diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/UglifyJsDriverTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/UglifyJsDriverTest.php
index bb68073093..a07503c74e 100644
--- a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/UglifyJsDriverTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/UglifyJsDriverTest.php
@@ -19,7 +19,7 @@ class UglifyJsDriverTest extends \PHPUnit_Framework_TestCase
$finder = new PhpExecutableFinder();
$php = $finder->find();
- $driver = UglifyJsDriver::create(array('uglifyjs.binaries' => $php));
+ $driver = UglifyJsDriver::create(['uglifyjs.binaries' => $php]);
$this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\UglifyJsDriver', $driver);
$this->assertEquals($php, $driver->getProcessBuilderFactory()->getBinary());
}
diff --git a/tests/Alchemy/Tests/Phrasea/Command/Plugin/AddPluginTest.php b/tests/Alchemy/Tests/Phrasea/Command/Plugin/AddPluginTest.php
index 9aabf2f3b0..b42a15c2f4 100644
--- a/tests/Alchemy/Tests/Phrasea/Command/Plugin/AddPluginTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Command/Plugin/AddPluginTest.php
@@ -28,7 +28,7 @@ class AddPluginTest extends PluginCommandTestCase
self::$DI['cli']['temporary-filesystem'] = $this->createTemporaryFilesystemMock();
self::$DI['cli']['plugins.autoloader-generator'] = $this->createPluginsAutoloaderGeneratorMock();
- self::$DI['cli']['plugins.explorer'] = array(self::$DI['cli']['plugins.directory'].'/TestPlugin');
+ self::$DI['cli']['plugins.explorer'] = [self::$DI['cli']['plugins.directory'].'/TestPlugin'];
self::$DI['cli']['plugins.plugins-validator'] = $this->createPluginsValidatorMock();
self::$DI['cli']['filesystem'] = $this->createFilesystemMock();
self::$DI['cli']['plugins.composer-installer'] = $this->createComposerInstallerMock();
@@ -71,7 +71,7 @@ class AddPluginTest extends PluginCommandTestCase
self::$DI['cli']['plugins.autoloader-generator']->expects($this->once())
->method('write')
- ->with(array($manifest));
+ ->with([$manifest]);
$result = $command->execute($input, $output);
diff --git a/tests/Alchemy/Tests/Phrasea/Command/Setup/XSendFileMappingGeneratorTest.php b/tests/Alchemy/Tests/Phrasea/Command/Setup/XSendFileMappingGeneratorTest.php
index a1f5921dcc..c09b628ba2 100644
--- a/tests/Alchemy/Tests/Phrasea/Command/Setup/XSendFileMappingGeneratorTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Command/Setup/XSendFileMappingGeneratorTest.php
@@ -62,9 +62,9 @@ class XSendFileMappingGeneratorTest extends \PhraseanetPHPUnitAbstract
public function provideVariousOptions()
{
- return array(
- array(true),
- array(false),
- );
+ return [
+ [true],
+ [false],
+ ];
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Command/UpgradeDBDatasTest.php b/tests/Alchemy/Tests/Phrasea/Command/UpgradeDBDatasTest.php
index 0b7d84720b..687113974f 100644
--- a/tests/Alchemy/Tests/Phrasea/Command/UpgradeDBDatasTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Command/UpgradeDBDatasTest.php
@@ -29,12 +29,12 @@ class UpgradeDBDatasTest extends \PHPUnit_Framework_TestCase
*/
public function testSetUpgrades()
{
- $this->object->setUpgrades(array());
- $this->assertEquals(array(), $this->object->getUpgrades());
+ $this->object->setUpgrades([]);
+ $this->assertEquals([], $this->object->getUpgrades());
- $upgrades = array(
+ $upgrades = [
new Step31(new Application('test'))
- );
+ ];
$this->object->setUpgrades($upgrades);
$this->assertEquals($upgrades, $this->object->getUpgrades());
}
@@ -44,17 +44,17 @@ class UpgradeDBDatasTest extends \PHPUnit_Framework_TestCase
*/
public function testAddUpgrade()
{
- $this->assertEquals(array(), $this->object->getUpgrades());
+ $this->assertEquals([], $this->object->getUpgrades());
$step31 = new Step31(new Application('test'));
$this->object->addUpgrade($step31);
- $this->assertEquals(array($step31), $this->object->getUpgrades());
+ $this->assertEquals([$step31], $this->object->getUpgrades());
$step35 = new Step35(new Application('test'));
$this->object->addUpgrade($step35);
- $this->assertEquals(array($step31, $step35), $this->object->getUpgrades());
+ $this->assertEquals([$step31, $step35], $this->object->getUpgrades());
}
/**
diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Admin/AdminCollectionTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Admin/AdminCollectionTest.php
index 9e236791a6..52077d2fb3 100644
--- a/tests/Alchemy/Tests/Phrasea/Controller/Admin/AdminCollectionTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Controller/Admin/AdminCollectionTest.php
@@ -9,7 +9,7 @@ use Alchemy\Phrasea\Border\File;
class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
protected $client;
- public static $createdCollections = array();
+ public static $createdCollections = [];
public function tearDown()
{
@@ -28,7 +28,7 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
}
}
- self::$createdCollections = array();
+ self::$createdCollections = [];
// /!\ re enable collection
self::$DI['collection']->enable(self::$DI['app']['phraseanet.appbox']);
@@ -40,7 +40,7 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
self::$DI['app'] = new Application('test');
self::giveRightsToUser(self::$DI['app'], self::$DI['user']);
- self::$DI['app']['acl']->get(self::$DI['user'])->revoke_access_from_bases(array(self::$DI['collection_no_access']->get_base_id()));
+ self::$DI['app']['acl']->get(self::$DI['user'])->revoke_access_from_bases([self::$DI['collection_no_access']->get_base_id()]);
self::$DI['app']['acl']->get(self::$DI['user'])->set_masks_on_base(self::$DI['collection_no_access_by_status']->get_base_id(), '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000', '0000000000000000000000000000000000000000000000000001000000000000');
parent::tearDownAfterClass();
@@ -144,9 +144,9 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
$prefs = '