diff --git a/lib/Alchemy/Phrasea/Command/Setup/H264MappingGenerator.php b/lib/Alchemy/Phrasea/Command/Setup/H264MappingGenerator.php index a897bfa88a..c66f94a31c 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/H264MappingGenerator.php +++ b/lib/Alchemy/Phrasea/Command/Setup/H264MappingGenerator.php @@ -46,14 +46,14 @@ class H264MappingGenerator extends Command $factory = new H264Factory($this->container['monolog'], true, $type, $this->computeMapping($paths)); $mode = $factory->createMode(true); - $currentConf = isset($this->container['phraseanet.configuration']['h264-pseudo-streaming']) ? $this->container['phraseanet.configuration']['h264-pseudo-streaming'] : array(); - $currentMapping = (isset($currentConf['mapping']) && is_array($currentConf['mapping'])) ? $currentConf['mapping'] : array(); + $currentConf = isset($this->container['phraseanet.configuration']['h264-pseudo-streaming']) ? $this->container['phraseanet.configuration']['h264-pseudo-streaming'] : []; + $currentMapping = (isset($currentConf['mapping']) && is_array($currentConf['mapping'])) ? $currentConf['mapping'] : []; - $conf = array( + $conf = [ 'enabled' => $enabled, 'type' => $type, 'mapping' => array_replace_recursive($mode->getMapping(), $currentMapping), - ); + ]; if ($input->getOption('write')) { $output->write("Writing configuration ..."); @@ -64,7 +64,7 @@ class H264MappingGenerator extends Command } else { $output->writeln("Configuration will not be written, use --write option to write it"); $output->writeln(""); - $output->writeln(Yaml::dump(array('h264-pseudo-streaming' => $conf), 4)); + $output->writeln(Yaml::dump(['h264-pseudo-streaming' => $conf], 4)); } return 0; @@ -74,7 +74,7 @@ class H264MappingGenerator extends Command { $paths = array_unique($paths); - $ret = array(); + $ret = []; foreach ($paths as $path) { $ret[$path] = $this->pathsToConf($path); @@ -88,12 +88,12 @@ class H264MappingGenerator extends Command static $n = 0; $n++; - return array('mount-point' => 'mp4-videos-'.$n, 'directory' => $path, 'passphrase' => \random::generatePassword(32)); + return ['mount-point' => 'mp4-videos-'.$n, 'directory' => $path, 'passphrase' => \random::generatePassword(32)]; } private function extractPath(\appbox $appbox) { - $paths = array(); + $paths = []; foreach ($appbox->get_databoxes() as $databox) { foreach ($databox->get_subdef_structure() as $group => $subdefs) { diff --git a/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php b/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php index ca6df75ffa..77865a9800 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php @@ -14,7 +14,6 @@ namespace Alchemy\Phrasea\Controller\Admin; use Alchemy\Phrasea\Exception\InvalidArgumentException; use Alchemy\Phrasea\Form\TaskForm; use Alchemy\Phrasea\Model\Entities\Task; -use Alchemy\Phrasea\TaskManager\TaskManagerStatus; use Silex\Application; use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\Request; diff --git a/lib/Alchemy/Phrasea/Controller/Api/V1.php b/lib/Alchemy/Phrasea/Controller/Api/V1.php index de7743cb09..030963df9c 100644 --- a/lib/Alchemy/Phrasea/Controller/Api/V1.php +++ b/lib/Alchemy/Phrasea/Controller/Api/V1.php @@ -36,7 +36,6 @@ use Alchemy\Phrasea\Model\Entities\FeedItem; use Alchemy\Phrasea\Model\Entities\LazaretFile; use Alchemy\Phrasea\Model\Entities\Task; use Alchemy\Phrasea\Model\Entities\User; -use Alchemy\Phrasea\Model\Entities\UserQuery; use Alchemy\Phrasea\Model\Entities\ValidationData; use Silex\Application; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -2093,7 +2092,7 @@ class V1 implements ControllerProviderInterface break; } - return array( + return [ '@entity@' => self::OBJECT_TYPE_USER, 'id' => $user->getId(), 'email' => $user->getEmail() ?: null, @@ -2116,7 +2115,7 @@ class V1 implements ControllerProviderInterface 'created_on' => $user->getCreated() ? $user->getCreated()->format(DATE_ATOM) : null, 'updated_on' => $user->getUpdated() ? $user->getUpdated()->format(DATE_ATOM) : null, 'locale' => $user->getLocale() ?: null, - ); + ]; } private function logout(Application $app) diff --git a/lib/Alchemy/Phrasea/Controller/Client/Root.php b/lib/Alchemy/Phrasea/Controller/Client/Root.php index c13d9b1c56..5e9372b813 100644 --- a/lib/Alchemy/Phrasea/Controller/Client/Root.php +++ b/lib/Alchemy/Phrasea/Controller/Client/Root.php @@ -14,7 +14,6 @@ namespace Alchemy\Phrasea\Controller\Client; use Alchemy\Phrasea\Feed\Aggregate; use Alchemy\Phrasea\SearchEngine\SearchEngineOptions; use Alchemy\Phrasea\Exception\SessionNotFound; -use Alchemy\Phrasea\Model\Entities\UserQuery; use Silex\Application; use Silex\ControllerProviderInterface; use Symfony\Component\Finder\Finder; diff --git a/lib/Alchemy/Phrasea/Controller/Lightbox.php b/lib/Alchemy/Phrasea/Controller/Lightbox.php index f91d948e22..69e48d042d 100644 --- a/lib/Alchemy/Phrasea/Controller/Lightbox.php +++ b/lib/Alchemy/Phrasea/Controller/Lightbox.php @@ -20,7 +20,6 @@ use Silex\ControllerProviderInterface; use Silex\Application as SilexApplication; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class Lightbox implements ControllerProviderInterface { diff --git a/lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php b/lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php index ea6cad0b06..7ae2b21ad4 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/DoDownload.php @@ -17,7 +17,6 @@ use Silex\Application; use Silex\ControllerProviderInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Event\PostResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; diff --git a/lib/Alchemy/Phrasea/Controller/Report/Root.php b/lib/Alchemy/Phrasea/Controller/Report/Root.php index f79cb97b86..db3b440fc1 100644 --- a/lib/Alchemy/Phrasea/Controller/Report/Root.php +++ b/lib/Alchemy/Phrasea/Controller/Report/Root.php @@ -82,29 +82,29 @@ 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 - )))); + ])]); } - $granted = array(); + $granted = []; - foreach($app['acl']->get($app['authentication']->getUser())->get_granted_base(array('canreport')) as $collection) { + foreach ($app['acl']->get($app['authentication']->getUser())->get_granted_base(['canreport']) as $collection) { if (!isset($granted[$collection->get_sbas_id()])) { - $granted[$collection->get_sbas_id()] = array( + $granted[$collection->get_sbas_id()] = [ 'id' => $collection->get_sbas_id(), 'name' => $collection->get_databox()->get_viewname(), - 'collections' => array() - ); + 'collections' => [] + ]; } - $granted[$collection->get_sbas_id()]['collections'][] = array( + $granted[$collection->get_sbas_id()]['collections'][] = [ 'id' => $collection->get_coll_id(), 'base_id' => $collection->get_base_id(), 'name' => $collection->get_name() - ); + ]; } - 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' => null, 'granted_bases' => $granted, @@ -115,7 +115,7 @@ class Root implements ControllerProviderInterface 'g_anal' => $app['conf']->get(['registry', 'general', 'analytics']), 'ajax' => false, 'ajax_chart' => false - )); + ]); } /** diff --git a/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php b/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php index 209c3c16fd..8bd0c4e692 100644 --- a/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php +++ b/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php @@ -411,7 +411,7 @@ class Xmlhttp implements ControllerProviderInterface $data = []; foreach ($app['repo.presets']->findBy(['user' => $user, 'sbasId' => $sbasId], ['creadted' => 'asc']) as $preset) { $presetData = $fields = []; - array_walk($preset->getData(), function($field) use ($fields) { + array_walk($preset->getData(), function ($field) use ($fields) { $fields[$field['name']][] = $field['value']; }); $presetData['id'] = $preset->getId(); @@ -420,6 +420,7 @@ class Xmlhttp implements ControllerProviderInterface $data[] = $presetData; } + return $app['twig']->render('thesaurus/presets.html.twig', ['presets' => $data]); } diff --git a/lib/Alchemy/Phrasea/Core/Connection/ReconnectableConnection.php b/lib/Alchemy/Phrasea/Core/Connection/ReconnectableConnection.php index 3ad3ca25d4..3de9e2d60d 100644 --- a/lib/Alchemy/Phrasea/Core/Connection/ReconnectableConnection.php +++ b/lib/Alchemy/Phrasea/Core/Connection/ReconnectableConnection.php @@ -31,7 +31,7 @@ class ReconnectableConnection implements ConnectionInterface /** * {@inheritdoc} */ - function prepare($prepareString) + public function prepare($prepareString) { return $this->tryMethod(__FUNCTION__, func_get_args()); } @@ -39,7 +39,7 @@ class ReconnectableConnection implements ConnectionInterface /** * {@inheritdoc} */ - function query() + public function query() { return $this->tryMethod(__FUNCTION__, func_get_args()); } @@ -47,7 +47,7 @@ class ReconnectableConnection implements ConnectionInterface /** * {@inheritdoc} */ - function quote($input, $type=\PDO::PARAM_STR) + public function quote($input, $type=\PDO::PARAM_STR) { return $this->tryMethod(__FUNCTION__, func_get_args()); } @@ -55,7 +55,7 @@ class ReconnectableConnection implements ConnectionInterface /** * {@inheritdoc} */ - function exec($statement) + public function exec($statement) { return $this->tryMethod(__FUNCTION__, func_get_args()); } @@ -63,7 +63,7 @@ class ReconnectableConnection implements ConnectionInterface /** * {@inheritdoc} */ - function lastInsertId($name = null) + public function lastInsertId($name = null) { return $this->tryMethod(__FUNCTION__, func_get_args()); } @@ -71,7 +71,7 @@ class ReconnectableConnection implements ConnectionInterface /** * {@inheritdoc} */ - function beginTransaction() + public function beginTransaction() { return $this->tryMethod(__FUNCTION__, func_get_args()); } @@ -79,7 +79,7 @@ class ReconnectableConnection implements ConnectionInterface /** * {@inheritdoc} */ - function commit() + public function commit() { return $this->tryMethod(__FUNCTION__, func_get_args()); } @@ -87,7 +87,7 @@ class ReconnectableConnection implements ConnectionInterface /** * {@inheritdoc} */ - function rollBack() + public function rollBack() { return $this->tryMethod(__FUNCTION__, func_get_args()); } @@ -95,7 +95,7 @@ class ReconnectableConnection implements ConnectionInterface /** * {@inheritdoc} */ - function errorCode() + public function errorCode() { return $this->tryMethod(__FUNCTION__, func_get_args()); } @@ -103,7 +103,7 @@ class ReconnectableConnection implements ConnectionInterface /** * {@inheritdoc} */ - function errorInfo() + public function errorInfo() { return $this->tryMethod(__FUNCTION__, func_get_args()); } diff --git a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php index a64948fa26..b344edbc71 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php @@ -23,7 +23,6 @@ use Alchemy\Phrasea\Authentication\Phrasea\NativeAuthentication; use Alchemy\Phrasea\Authentication\Phrasea\OldPasswordEncoder; use Alchemy\Phrasea\Authentication\Phrasea\PasswordEncoder; use Alchemy\Phrasea\Authentication\SuggestionFinder; -use Alchemy\Phrasea\Authentication\Token\TokenValidator; use Silex\Application; use Silex\ServiceProviderInterface; use Alchemy\Phrasea\Core\Event\Subscriber\PersistentCookieSubscriber; diff --git a/lib/Alchemy/Phrasea/Form/Constraint/PasswordToken.php b/lib/Alchemy/Phrasea/Form/Constraint/PasswordToken.php index d117138aea..f1cc83eb08 100644 --- a/lib/Alchemy/Phrasea/Form/Constraint/PasswordToken.php +++ b/lib/Alchemy/Phrasea/Form/Constraint/PasswordToken.php @@ -15,7 +15,6 @@ use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Model\Manipulator\TokenManipulator; use Doctrine\ORM\EntityRepository; use Symfony\Component\Validator\Constraint; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class PasswordToken extends Constraint { diff --git a/lib/Alchemy/Phrasea/Http/H264PseudoStreaming/Apache.php b/lib/Alchemy/Phrasea/Http/H264PseudoStreaming/Apache.php index 4863d7e3da..9c8d45be50 100644 --- a/lib/Alchemy/Phrasea/Http/H264PseudoStreaming/Apache.php +++ b/lib/Alchemy/Phrasea/Http/H264PseudoStreaming/Apache.php @@ -24,7 +24,7 @@ class Apache extends AbstractServerMode implements H264Interface */ public function setMapping(array $mapping) { - $final = array(); + $final = []; foreach ($mapping as $key => $entry) { if (!is_array($entry)) { @@ -47,11 +47,11 @@ class Apache extends AbstractServerMode implements H264Interface continue; } - $final[$key] = array( + $final[$key] = [ 'directory' => $this->sanitizePath(realpath($entry['directory'])), 'mount-point' => $this->sanitizeMountPoint($entry['mount-point']), 'passphrase' => trim($entry['passphrase']), - ); + ]; } $this->mapping = $final; diff --git a/lib/Alchemy/Phrasea/Http/H264PseudoStreaming/H264Factory.php b/lib/Alchemy/Phrasea/Http/H264PseudoStreaming/H264Factory.php index 87db6205b0..68664f33b6 100644 --- a/lib/Alchemy/Phrasea/Http/H264PseudoStreaming/H264Factory.php +++ b/lib/Alchemy/Phrasea/Http/H264PseudoStreaming/H264Factory.php @@ -70,7 +70,7 @@ class H264Factory /** * Creates a new instance of H264 Factory given a configuration. * - * @param Application $app + * @param Application $app * * @return H264Factory */ @@ -78,7 +78,7 @@ class H264Factory { $conf = $app['phraseanet.configuration']['h264-pseudo-streaming']; - $mapping = array(); + $mapping = []; if (isset($conf['mapping'])) { $mapping = $conf['mapping']; diff --git a/lib/Alchemy/Phrasea/Http/H264PseudoStreaming/Nginx.php b/lib/Alchemy/Phrasea/Http/H264PseudoStreaming/Nginx.php index c521d985ce..2dcc4b3bc2 100644 --- a/lib/Alchemy/Phrasea/Http/H264PseudoStreaming/Nginx.php +++ b/lib/Alchemy/Phrasea/Http/H264PseudoStreaming/Nginx.php @@ -24,7 +24,7 @@ class Nginx extends AbstractServerMode implements H264Interface */ public function setMapping(array $mapping) { - $final = array(); + $final = []; foreach ($mapping as $key => $entry) { if (!is_array($entry)) { @@ -47,11 +47,11 @@ class Nginx extends AbstractServerMode implements H264Interface continue; } - $final[$key] = array( + $final[$key] = [ 'directory' => $this->sanitizePath(realpath($entry['directory'])), 'mount-point' => $this->sanitizeMountPoint($entry['mount-point']), 'passphrase' => trim($entry['passphrase']), - ); + ]; } $this->mapping = $final; @@ -107,7 +107,7 @@ class Nginx extends AbstractServerMode implements H264Interface $path = $entry['mount-point'].substr($pathfile, strlen($entry['directory'])); $expire = time() + 3600; // At which point in time the file should expire. time() + x; would be the usual usage. - $hash = str_replace(array('+', '/', '='), array('-', '_', ''), base64_encode(md5($expire.$path.' '.$entry['passphrase'], true))); + $hash = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode(md5($expire.$path.' '.$entry['passphrase'], true))); return Url::factory($path.'?hash='.$hash.'&expires='.$expire); } diff --git a/lib/Alchemy/Phrasea/Model/Entities/Token.php b/lib/Alchemy/Phrasea/Model/Entities/Token.php index 2bdcd673f1..62ca7260ef 100644 --- a/lib/Alchemy/Phrasea/Model/Entities/Token.php +++ b/lib/Alchemy/Phrasea/Model/Entities/Token.php @@ -62,7 +62,7 @@ class Token /** * Set value * - * @param string $value + * @param string $value * @return Token */ public function setValue($value) @@ -85,7 +85,7 @@ class Token /** * Set type * - * @param string $type + * @param string $type * @return Token */ public function setType($type) @@ -108,7 +108,7 @@ class Token /** * Set data * - * @param string $data + * @param string $data * @return Token */ public function setData($data) @@ -131,7 +131,7 @@ class Token /** * Set created * - * @param \DateTime $created + * @param \DateTime $created * @return Token */ public function setCreated($created) @@ -154,7 +154,7 @@ class Token /** * Set updated * - * @param \DateTime $updated + * @param \DateTime $updated * @return Token */ public function setUpdated($updated) @@ -177,7 +177,7 @@ class Token /** * Set expiration * - * @param \DateTime $updated + * @param \DateTime $updated * @return Token */ public function setExpiration(\DateTime $expiration = null) @@ -200,7 +200,7 @@ class Token /** * Set user * - * @param User $user + * @param User $user * @return Token */ public function setUser(User $user = null) diff --git a/lib/Alchemy/Phrasea/Model/Manipulator/TokenManipulator.php b/lib/Alchemy/Phrasea/Model/Manipulator/TokenManipulator.php index 3d840ab3c7..fbfd9361ae 100644 --- a/lib/Alchemy/Phrasea/Model/Manipulator/TokenManipulator.php +++ b/lib/Alchemy/Phrasea/Model/Manipulator/TokenManipulator.php @@ -17,7 +17,6 @@ use Alchemy\Phrasea\Model\Entities\Token; use Alchemy\Phrasea\Model\Entities\User; use Alchemy\Phrasea\Model\Repositories\TokenRepository; use Doctrine\Common\Persistence\ObjectManager; -use Doctrine\ORM\Query; use RandomLib\Generator; class TokenManipulator implements ManipulatorInterface @@ -48,10 +47,10 @@ class TokenManipulator implements ManipulatorInterface } /** - * @param User|null $user - * @param string $type + * @param User|null $user + * @param string $type * @param \DateTime|null $expiration - * @param mixed|null $data + * @param mixed|null $data * * @return Token */ @@ -84,7 +83,7 @@ class TokenManipulator implements ManipulatorInterface /** * @param Basket $basket - * @param User $user + * @param User $user * * @return Token */ @@ -99,7 +98,7 @@ class TokenManipulator implements ManipulatorInterface /** * @param Basket $basket - * @param User $user + * @param User $user * * @return Token */ @@ -109,7 +108,7 @@ class TokenManipulator implements ManipulatorInterface } /** - * @param User $user + * @param User $user * @param FeedEntry $entry * * @return Token diff --git a/lib/Alchemy/Phrasea/Model/Repositories/TokenRepository.php b/lib/Alchemy/Phrasea/Model/Repositories/TokenRepository.php index 020d9ae678..d979f206ee 100644 --- a/lib/Alchemy/Phrasea/Model/Repositories/TokenRepository.php +++ b/lib/Alchemy/Phrasea/Model/Repositories/TokenRepository.php @@ -4,7 +4,6 @@ namespace Alchemy\Phrasea\Model\Repositories; use Alchemy\Phrasea\Model\Entities\Basket; use Alchemy\Phrasea\Model\Entities\User; -use Alchemy\Phrasea\Model\Entities\ValidationParticipant; use Alchemy\Phrasea\Model\Manipulator\TokenManipulator; use Doctrine\ORM\EntityRepository; diff --git a/lib/Alchemy/Phrasea/Model/Types/BinaryString.php b/lib/Alchemy/Phrasea/Model/Types/BinaryString.php index c9b6788ada..45cb988fc8 100644 --- a/lib/Alchemy/Phrasea/Model/Types/BinaryString.php +++ b/lib/Alchemy/Phrasea/Model/Types/BinaryString.php @@ -11,7 +11,6 @@ namespace Alchemy\Phrasea\Model\Types; -use Alchemy\Phrasea\Exception\RuntimeException; use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Platforms\AbstractPlatform; diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/TokenMigration.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/TokenMigration.php index d7444e81dc..a1c1af09ca 100644 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/TokenMigration.php +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/TokenMigration.php @@ -19,7 +19,7 @@ class TokenMigration extends AbstractMigration { // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - + $this->addSql("CREATE TABLE Tokens (value VARCHAR(16) NOT NULL, user_id INT DEFAULT NULL, type VARCHAR(32) NOT NULL, data LONGTEXT DEFAULT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, expiration DATETIME DEFAULT NULL, INDEX IDX_ADF614B8A76ED395 (user_id), PRIMARY KEY(value)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("ALTER TABLE Tokens ADD CONSTRAINT FK_ADF614B8A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)"); } @@ -28,7 +28,7 @@ class TokenMigration extends AbstractMigration { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - + $this->addSql("DROP TABLE Tokens"); } } diff --git a/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/Upgrade39Tokens.php b/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/Upgrade39Tokens.php index 4055285616..d1f49ff6e2 100644 --- a/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/Upgrade39Tokens.php +++ b/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/Upgrade39Tokens.php @@ -12,11 +12,8 @@ namespace Alchemy\Phrasea\Setup\Version\PreSchemaUpgrade; use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Model\Entities\User; -use Alchemy\Phrasea\Model\Entities\FtpCredential; use Doctrine\DBAL\Migrations\Configuration\Configuration; use Doctrine\ORM\EntityManager; -use Doctrine\ORM\NoResultException; use Doctrine\ORM\Query; use Doctrine\ORM\Query\ResultSetMapping; diff --git a/lib/classes/patch/384alpha1a.php b/lib/classes/patch/384alpha1a.php index 6229b10424..1c69a350d9 100644 --- a/lib/classes/patch/384alpha1a.php +++ b/lib/classes/patch/384alpha1a.php @@ -17,7 +17,7 @@ class patch_384alpha1a implements patchInterface private $release = '3.8.4-alpha.1'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -58,11 +58,11 @@ class patch_384alpha1a implements patchInterface { $config = $app['phraseanet.configuration']->getConfig(); - $config['h264-pseudo-streaming'] = array( + $config['h264-pseudo-streaming'] = [ 'enabled' => false, 'type' => null, - 'mapping' => array(), - ); + 'mapping' => [], + ]; $app['phraseanet.configuration']->setConfig($config); diff --git a/lib/classes/patch/390alpha18a.php b/lib/classes/patch/390alpha18a.php index 97ae8583bb..1e49030204 100644 --- a/lib/classes/patch/390alpha18a.php +++ b/lib/classes/patch/390alpha18a.php @@ -10,8 +10,6 @@ */ use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Model\Entities\Preset; -use Gedmo\Timestampable\TimestampableListener; class patch_390alpha18a extends patchAbstract { diff --git a/lib/classes/patch/390alpha1a.php b/lib/classes/patch/390alpha1a.php index 419520934c..7baacc2c1f 100644 --- a/lib/classes/patch/390alpha1a.php +++ b/lib/classes/patch/390alpha1a.php @@ -16,7 +16,6 @@ use Doctrine\ORM\Query; use Doctrine\ORM\NoResultException; use Gedmo\Timestampable\TimestampableListener; - class patch_390alpha1a extends patchAbstract { /** @var string */ diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Admin/DataboxTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Admin/DataboxTest.php index c779d1945f..7f7d3811d3 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Admin/DataboxTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Admin/DataboxTest.php @@ -25,6 +25,7 @@ class DataboxTest extends \PhraseanetAuthenticatedWebTestCase { if (!self::$createdCollections) { parent::tearDown(); + return; } diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiTestCase.php b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiTestCase.php index 47ee3a9d3a..64ce5e1beb 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiTestCase.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Api/ApiTestCase.php @@ -8,7 +8,6 @@ use Alchemy\Phrasea\Controller\Api\V1; use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Authentication\Context; use Alchemy\Phrasea\Model\Entities\Task; -use Alchemy\Phrasea\Model\Entities\LazaretSession; use Alchemy\Phrasea\Model\Entities\User; use Doctrine\Common\Collections\ArrayCollection; use Guzzle\Common\Exception\GuzzleException; @@ -1783,9 +1782,9 @@ abstract class ApiTestCase extends \PhraseanetWebTestCase $route = '/api/v1/me/'; - $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('user', $content['response']); @@ -1795,7 +1794,7 @@ abstract class ApiTestCase extends \PhraseanetWebTestCase protected function evaluateGoodUserItem($data, User $user) { - foreach (array( + foreach ([ '@entity@' => V1::OBJECT_TYPE_USER, 'id' => $user->getId(), 'email' => $user->getEmail() ?: null, @@ -1817,7 +1816,7 @@ abstract class ApiTestCase extends \PhraseanetWebTestCase 'created_on' => $user->getCreated() ? $user->getCreated()->format(DATE_ATOM) : null, 'updated_on' => $user->getUpdated() ? $user->getUpdated()->format(DATE_ATOM) : null, 'locale' => $user->getLocale() ?: null, - ) as $key => $value) { + ] as $key => $value) { $this->assertArrayHasKey($key, $data, 'Assert key is present '.$key); if ($value) { $this->assertEquals($value, $data[$key], 'Check key '.$key); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Report/RootTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Report/RootTest.php index 18346ae1a5..5539c16271 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Report/RootTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Report/RootTest.php @@ -28,10 +28,10 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase { $this->authenticate(self::$DI['app']); - $this->XMLHTTPRequest('GET', '/report/dashboard', array( + $this->XMLHTTPRequest('GET', '/report/dashboard', [ 'dmin' => $this->dmin->format('Y-m-d'), 'dmax' => $this->dmin->format('Y-m-d'), - )); + ]); $response = self::$DI['client']->getResponse(); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php index 7c4c67393c..7333bd9b47 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Root/AccountTest.php @@ -6,7 +6,6 @@ use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Model\Entities\Registration; use Alchemy\Phrasea\Model\Entities\User; use RandomLib\Factory; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class AccountTest extends \PhraseanetAuthenticatedWebTestCase { diff --git a/tests/Alchemy/Tests/Phrasea/Core/Connection/ConnectionProviderTest.php b/tests/Alchemy/Tests/Phrasea/Core/Connection/ConnectionProviderTest.php index 0581adc449..3f4eb85bbd 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Connection/ConnectionProviderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/Connection/ConnectionProviderTest.php @@ -14,4 +14,4 @@ class ConnectionProviderTest extends \PhraseanetTestCase usleep(1200000); $conn->exec('SHOW DATABASES'); } -} \ No newline at end of file +} diff --git a/tests/Alchemy/Tests/Phrasea/Form/Constraint/PasswordTokenTest.php b/tests/Alchemy/Tests/Phrasea/Form/Constraint/PasswordTokenTest.php index 4c96f702d4..d2b0bc2a91 100644 --- a/tests/Alchemy/Tests/Phrasea/Form/Constraint/PasswordTokenTest.php +++ b/tests/Alchemy/Tests/Phrasea/Form/Constraint/PasswordTokenTest.php @@ -5,7 +5,6 @@ namespace Alchemy\Tests\Phrasea\Form\Constraint; use Alchemy\Phrasea\Form\Constraint\PasswordToken; use Alchemy\Phrasea\Model\Entities\Token; use Alchemy\Phrasea\Model\Manipulator\TokenManipulator; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class PasswordTokenTest extends \PhraseanetTestCase { diff --git a/tests/Alchemy/Tests/Phrasea/Http/H264PseudoStreaming/ApacheTest.php b/tests/Alchemy/Tests/Phrasea/Http/H264PseudoStreaming/ApacheTest.php index 194ced0506..c6fd56f7ca 100644 --- a/tests/Alchemy/Tests/Phrasea/Http/H264PseudoStreaming/ApacheTest.php +++ b/tests/Alchemy/Tests/Phrasea/Http/H264PseudoStreaming/ApacheTest.php @@ -31,16 +31,16 @@ class ApacheTest extends \PhraseanetTestCase touch($file); } - $mapping = array(array( + $mapping = [[ 'directory' => $dir, 'mount-point' => 'mp4-videos', 'passphrase' => '123456', - )); + ]]; - return array( - array(array(), null, '/path/to/file'), - array($mapping, null, '/path/to/file'), - array($mapping, '/^\/mp4-videos\/[a-zA-Z0-9]+\/[0-9a-f]+\/to\/file$/', $file), - ); + return [ + [[], null, '/path/to/file'], + [$mapping, null, '/path/to/file'], + [$mapping, '/^\/mp4-videos\/[a-zA-Z0-9]+\/[0-9a-f]+\/to\/file$/', $file], + ]; } } diff --git a/tests/Alchemy/Tests/Phrasea/Http/H264PseudoStreaming/H264FactoryTest.php b/tests/Alchemy/Tests/Phrasea/Http/H264PseudoStreaming/H264FactoryTest.php index 9af3211f79..f5c3c749d1 100644 --- a/tests/Alchemy/Tests/Phrasea/Http/H264PseudoStreaming/H264FactoryTest.php +++ b/tests/Alchemy/Tests/Phrasea/Http/H264PseudoStreaming/H264FactoryTest.php @@ -66,19 +66,19 @@ class H264FactoryTest extends \PhraseanetTestCase public function provideTypes() { - return array( - array('nginx', $this->getNginxMapping(), 'Alchemy\Phrasea\Http\H264PseudoStreaming\Nginx'), - array('apache', $this->getNginxMapping(), 'Alchemy\Phrasea\Http\H264PseudoStreaming\Apache'), - array('apache2', $this->getNginxMapping(), 'Alchemy\Phrasea\Http\H264PseudoStreaming\Apache'), - ); + return [ + ['nginx', $this->getNginxMapping(), 'Alchemy\Phrasea\Http\H264PseudoStreaming\Nginx'], + ['apache', $this->getNginxMapping(), 'Alchemy\Phrasea\Http\H264PseudoStreaming\Apache'], + ['apache2', $this->getNginxMapping(), 'Alchemy\Phrasea\Http\H264PseudoStreaming\Apache'], + ]; } private function getNginxMapping() { - return array(array( + return [[ 'directory' => __DIR__ . '/../../../../files/', 'mount-point' => '/protected/', 'passphrase' => 'dfdskqhfsfilddsmfmqsdmlfomqs', - )); + ]]; } } diff --git a/tests/Alchemy/Tests/Phrasea/Http/H264PseudoStreaming/NginxTest.php b/tests/Alchemy/Tests/Phrasea/Http/H264PseudoStreaming/NginxTest.php index d75f2c05ff..fe8e85439e 100644 --- a/tests/Alchemy/Tests/Phrasea/Http/H264PseudoStreaming/NginxTest.php +++ b/tests/Alchemy/Tests/Phrasea/Http/H264PseudoStreaming/NginxTest.php @@ -31,16 +31,16 @@ class NginxTest extends \PhraseanetTestCase touch($file); } - $mapping = array(array( + $mapping = [[ 'directory' => $dir, 'mount-point' => 'mp4-videos', 'passphrase' => '123456', - )); + ]]; - return array( - array(array(), null, '/path/to/file'), - array($mapping, null, '/path/to/file'), - array($mapping, '/^\/mp4-videos\/to\/file\?hash=[a-zA-Z0-9-_+]+&expires=[0-9]+/', $file), - ); + return [ + [[], null, '/path/to/file'], + [$mapping, null, '/path/to/file'], + [$mapping, '/^\/mp4-videos\/to\/file\?hash=[a-zA-Z0-9-_+]+&expires=[0-9]+/', $file], + ]; } } diff --git a/tests/Alchemy/Tests/Phrasea/Model/Manipulator/TokenManipulatorTest.php b/tests/Alchemy/Tests/Phrasea/Model/Manipulator/TokenManipulatorTest.php index 1e4dd76e44..9bcc713f18 100644 --- a/tests/Alchemy/Tests/Phrasea/Model/Manipulator/TokenManipulatorTest.php +++ b/tests/Alchemy/Tests/Phrasea/Model/Manipulator/TokenManipulatorTest.php @@ -88,7 +88,7 @@ class TokenManipulatorTest extends \PhraseanetTestCase public function testCreateDownloadToken() { - $data = serialize(array('some' => 'data')); + $data = serialize(['some' => 'data']); $manipulator = new TokenManipulator(self::$DI['app']['EM'], self::$DI['app']['random.low'], self::$DI['app']['repo.tokens']); $token = $manipulator->createDownloadToken(self::$DI['user'], $data); @@ -100,7 +100,7 @@ class TokenManipulatorTest extends \PhraseanetTestCase public function testCreateEmailExportToken() { - $data = serialize(array('some' => 'data')); + $data = serialize(['some' => 'data']); $manipulator = new TokenManipulator(self::$DI['app']['EM'], self::$DI['app']['random.low'], self::$DI['app']['repo.tokens']); $token = $manipulator->createEmailExportToken($data); diff --git a/tests/classes/PhraseanetTestCase.php b/tests/classes/PhraseanetTestCase.php index b6d75e07b2..16cfa774f3 100644 --- a/tests/classes/PhraseanetTestCase.php +++ b/tests/classes/PhraseanetTestCase.php @@ -80,7 +80,7 @@ abstract class PhraseanetTestCase extends WebTestCase ini_set('memory_limit', '4096M'); error_reporting(-1); - + \PHPUnit_Framework_Error_Warning::$enabled = true; \PHPUnit_Framework_Error_Notice::$enabled = true;