mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
@@ -31,7 +31,7 @@ trait UserQueryAware
|
||||
*/
|
||||
public function getUserQueryFactory()
|
||||
{
|
||||
if (! is_callable($this->userQueryFactory)) {
|
||||
if (!is_callable($this->userQueryFactory)) {
|
||||
throw new \LogicException('User Query factory was not set');
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ trait UserQueryAware
|
||||
public function createUserQuery()
|
||||
{
|
||||
$userQuery = call_user_func($this->getUserQueryFactory());
|
||||
if (! $userQuery instanceof \User_Query) {
|
||||
if (!$userQuery instanceof \User_Query) {
|
||||
throw new \LogicException(sprintf(
|
||||
'User Query factory does not create %s instance, got "%s" instead',
|
||||
\User_Query::class,
|
||||
|
@@ -19,7 +19,7 @@ class RouteLoader
|
||||
'/admin/dashboard' => Providers\Admin\Dashboard::class,
|
||||
'/admin/databox' => Providers\Admin\Databox::class,
|
||||
'/admin/databoxes' => Providers\Admin\Databoxes::class,
|
||||
'/admin/fields' => Providers\Admin\Fields::class ,
|
||||
'/admin/fields' => Providers\Admin\Fields::class,
|
||||
'/admin/publications' => Providers\Admin\Feeds::class,
|
||||
'/admin/plugins' => Providers\Admin\Plugins::class,
|
||||
'/admin/search-engine' => Providers\Admin\SearchEngine::class,
|
||||
@@ -125,7 +125,7 @@ class RouteLoader
|
||||
list($prefix, $providerKey) = $providerDefinition;
|
||||
}
|
||||
|
||||
if (! $this->isValidProviderDefinition($app, $prefix, $providerKey)) {
|
||||
if (!$this->isValidProviderDefinition($app, $prefix, $providerKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -42,7 +42,7 @@ class Linkedin extends AbstractProvider
|
||||
/**
|
||||
* @param ClientInterface $client
|
||||
*
|
||||
* @return Github
|
||||
* @return Linkedin
|
||||
*/
|
||||
public function setGuzzleClient(ClientInterface $client)
|
||||
{
|
||||
|
@@ -157,7 +157,7 @@ class Identity
|
||||
public function get($property)
|
||||
{
|
||||
if (!array_key_exists($property, $this->data)) {
|
||||
throw new InvalidArgumentException(sprintf('Property %s does not exist', $property));
|
||||
throw new InvalidArgumentException(sprintf('Property %s does not exist', $property));
|
||||
}
|
||||
|
||||
return $this->data[$property];
|
||||
@@ -186,7 +186,7 @@ class Identity
|
||||
public function remove($property)
|
||||
{
|
||||
if (!array_key_exists($property, $this->data)) {
|
||||
throw new InvalidArgumentException(sprintf('Property %s does not exist', $property));
|
||||
throw new InvalidArgumentException(sprintf('Property %s does not exist', $property));
|
||||
}
|
||||
|
||||
$value = $this->data[$property];
|
||||
|
@@ -40,7 +40,7 @@ class SuggestionFinder
|
||||
$infos = $token->getIdentity();
|
||||
|
||||
if ($infos->has(Identity::PROPERTY_EMAIL)) {
|
||||
return $this->repository->findByEmail($infos->get(Identity::PROPERTY_EMAIL));
|
||||
return $this->repository->findByEmail($infos->get(Identity::PROPERTY_EMAIL));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@@ -75,11 +75,11 @@ class Metadata implements AttributeInterface
|
||||
*/
|
||||
public static function loadFromString(Application $app, $string)
|
||||
{
|
||||
if ( ! $metadata = @unserialize($string)) {
|
||||
if (!$metadata = @unserialize($string)) {
|
||||
throw new \InvalidArgumentException('Unable to load metadata from string');
|
||||
}
|
||||
|
||||
if (! $metadata instanceof ExiftoolMeta) {
|
||||
if (!$metadata instanceof ExiftoolMeta) {
|
||||
throw new \InvalidArgumentException('Unable to load metadata from string');
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,7 @@ class Story implements AttributeInterface
|
||||
*/
|
||||
public function __construct(\record_adapter $story)
|
||||
{
|
||||
if ( ! $story->isStory()) {
|
||||
if (!$story->isStory()) {
|
||||
throw new \InvalidArgumentException('Unable to fetch a story from string');
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ class Story implements AttributeInterface
|
||||
throw new \InvalidArgumentException('Unable to fetch a story from string');
|
||||
}
|
||||
|
||||
if ( ! $story->isStory()) {
|
||||
if (!$story->isStory()) {
|
||||
throw new \InvalidArgumentException('Unable to fetch a story from string');
|
||||
}
|
||||
|
||||
|
@@ -58,7 +58,7 @@ abstract class AbstractChecker implements CheckerInterface
|
||||
$this->databoxes = [];
|
||||
|
||||
foreach ($this->toIterator($databoxes) as $databox) {
|
||||
if (! $databox instanceof \databox) {
|
||||
if (!$databox instanceof \databox) {
|
||||
throw new \InvalidArgumentException('Restrict to databoxes only accept databoxes as argument');
|
||||
}
|
||||
$this->databoxes[] = $databox;
|
||||
@@ -86,7 +86,7 @@ abstract class AbstractChecker implements CheckerInterface
|
||||
$this->collections = [];
|
||||
|
||||
foreach ($this->toIterator($collections) as $collection) {
|
||||
if (! $collection instanceof \collection) {
|
||||
if (!$collection instanceof \collection) {
|
||||
throw new \InvalidArgumentException('Restrict to collections only accept collections as argument');
|
||||
}
|
||||
$this->collections[] = $collection;
|
||||
|
@@ -26,7 +26,7 @@ class Colorspace extends AbstractChecker
|
||||
|
||||
public function __construct(Application $app, array $options)
|
||||
{
|
||||
if ( ! isset($options['colorspaces'])) {
|
||||
if (!isset($options['colorspaces'])) {
|
||||
throw new \InvalidArgumentException('Missing "colorspaces" options');
|
||||
}
|
||||
|
||||
@@ -42,7 +42,8 @@ class Colorspace extends AbstractChecker
|
||||
$boolean = true; //bypass color if empty array
|
||||
} elseif (method_exists($file->getMedia(), 'getColorSpace')) {
|
||||
$colorspace = null;
|
||||
switch ($file->getMedia()->getColorSpace()) {
|
||||
switch ($file->getMedia()->getColorSpace())
|
||||
{
|
||||
case \MediaVorus\Media\Image::COLORSPACE_CMYK:
|
||||
$colorspace = self::COLORSPACE_CMYK;
|
||||
break;
|
||||
|
@@ -22,7 +22,7 @@ class Extension extends AbstractChecker
|
||||
|
||||
public function __construct(Application $app, array $options)
|
||||
{
|
||||
if ( ! isset($options['extensions'])) {
|
||||
if (!isset($options['extensions'])) {
|
||||
throw new \InvalidArgumentException('Missing "extensions" options');
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,7 @@ class Filename extends AbstractChecker
|
||||
*/
|
||||
public function __construct(Application $app, array $options = [])
|
||||
{
|
||||
if ( ! isset($options['sensitive'])) {
|
||||
if (!isset($options['sensitive'])) {
|
||||
$options['sensitive'] = false;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class Filename extends AbstractChecker
|
||||
*/
|
||||
public function check(EntityManager $em, File $file)
|
||||
{
|
||||
$boolean = ! count(\record_adapter::get_records_by_originalname(
|
||||
$boolean = !count(\record_adapter::get_records_by_originalname(
|
||||
$file->getCollection()->get_databox(), $file->getOriginalName(), $this->sensitive, 0, 1
|
||||
));
|
||||
|
||||
|
@@ -29,7 +29,7 @@ class MediaType extends AbstractChecker
|
||||
|
||||
public function __construct(Application $app, array $options)
|
||||
{
|
||||
if ( ! isset($options['mediatypes'])) {
|
||||
if (!isset($options['mediatypes'])) {
|
||||
throw new \InvalidArgumentException('Missing "mediatypes" options');
|
||||
}
|
||||
|
||||
|
@@ -66,7 +66,7 @@ class File
|
||||
$this->media = $media;
|
||||
$this->collection = $collection;
|
||||
$this->attributes = [];
|
||||
$this->originalName = $originalName ? : pathinfo($this->media->getFile()->getPathname(), PATHINFO_BASENAME);
|
||||
$this->originalName = $originalName ?: pathinfo($this->media->getFile()->getPathname(), PATHINFO_BASENAME);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +92,7 @@ class File
|
||||
*/
|
||||
public function getUUID($generate = false, $write = false)
|
||||
{
|
||||
if ($this->uuid && ! $write) {
|
||||
if ($this->uuid && !$write) {
|
||||
return $this->uuid;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ class File
|
||||
'Canon:ImageUniqueID',
|
||||
];
|
||||
|
||||
if (! $this->uuid) {
|
||||
if (!$this->uuid) {
|
||||
$metadatas = $this->media->getMetadatas();
|
||||
|
||||
$uuid = null;
|
||||
@@ -119,7 +119,7 @@ class File
|
||||
}
|
||||
}
|
||||
|
||||
if (! $uuid && $generate) {
|
||||
if (!$uuid && $generate) {
|
||||
$uuid = Uuid::uuid4();
|
||||
}
|
||||
|
||||
@@ -152,7 +152,8 @@ class File
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
switch ($this->media->getType()) {
|
||||
switch ($this->media->getType())
|
||||
{
|
||||
case MediaInterface::TYPE_AUDIO:
|
||||
return new Audio();
|
||||
break;
|
||||
@@ -180,7 +181,7 @@ class File
|
||||
*/
|
||||
public function getSha256()
|
||||
{
|
||||
if (! $this->sha256) {
|
||||
if (!$this->sha256) {
|
||||
$this->sha256 = $this->media->getHash('sha256');
|
||||
}
|
||||
|
||||
@@ -194,7 +195,7 @@ class File
|
||||
*/
|
||||
public function getMD5()
|
||||
{
|
||||
if (! $this->md5) {
|
||||
if (!$this->md5) {
|
||||
$this->md5 = $this->media->getHash('md5');
|
||||
}
|
||||
|
||||
|
@@ -77,7 +77,7 @@ class Visa
|
||||
{
|
||||
foreach ($this->responses as $response) {
|
||||
|
||||
if ( ! $response->isOk()) {
|
||||
if (!$response->isOk()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ class ArrayCache extends DoctrineArray implements Cache
|
||||
*/
|
||||
public function get($id)
|
||||
{
|
||||
if ( ! $this->contains($id)) {
|
||||
if (!$this->contains($id)) {
|
||||
throw new Exception(sprintf('Unable to find key %s', $id));
|
||||
}
|
||||
|
||||
|
@@ -82,7 +82,7 @@ class Manager
|
||||
if (isset($options['namespace']) && is_string($options['namespace'])) {
|
||||
$cache->setNamespace($options['namespace']);
|
||||
} else {
|
||||
$cache->setNamespace(md5(gethostname().'-'.__DIR__));
|
||||
$cache->setNamespace(md5(gethostname() . '-' . __DIR__));
|
||||
}
|
||||
|
||||
$this->drivers[$label] = $cache;
|
||||
@@ -95,17 +95,28 @@ class Manager
|
||||
return $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $label
|
||||
*/
|
||||
private function register($name, $label)
|
||||
{
|
||||
$this->registry[$label] = $name;
|
||||
$this->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param string $label
|
||||
*/
|
||||
private function isAlreadyRegistered($name, $label)
|
||||
{
|
||||
return isset($this->registry[$label]) && $name === $this->registry[$label];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $label
|
||||
*/
|
||||
private function isAlreadyLoaded($label)
|
||||
{
|
||||
return isset($this->drivers[$label]);
|
||||
@@ -115,7 +126,7 @@ class Manager
|
||||
{
|
||||
$date = new \DateTime();
|
||||
$data = $this->compiler->compile($this->registry)
|
||||
. "\n// Last Update on ".$date->format(DATE_ISO8601)." \n";
|
||||
. "\n// Last Update on " . $date->format(DATE_ISO8601) . " \n";
|
||||
|
||||
file_put_contents($this->file, $data);
|
||||
}
|
||||
|
@@ -78,8 +78,8 @@ class DbalCollectionRepository implements CollectionRepository
|
||||
}
|
||||
|
||||
$query = self::$selectQuery . ' WHERE coll_id IN (:collectionIds)';
|
||||
$parameters = [ 'collectionIds' => $parameters ];
|
||||
$parameterTypes = [ 'collectionIds' => Connection::PARAM_INT_ARRAY ];
|
||||
$parameters = ['collectionIds' => $parameters];
|
||||
$parameterTypes = ['collectionIds' => Connection::PARAM_INT_ARRAY];
|
||||
|
||||
$rows = $this->databoxConnection->fetchAll($query, $parameters, $parameterTypes);
|
||||
|
||||
@@ -99,7 +99,7 @@ class DbalCollectionRepository implements CollectionRepository
|
||||
}
|
||||
|
||||
$query = self::$selectQuery . ' WHERE coll_id = :collectionId';
|
||||
$row = $this->databoxConnection->fetchAssoc($query, [ ':collectionId' => $reference->getCollectionId() ]);
|
||||
$row = $this->databoxConnection->fetchAssoc($query, [':collectionId' => $reference->getCollectionId()]);
|
||||
|
||||
if ($row !== false) {
|
||||
return $this->collectionFactory->create($this->databoxId, $reference, $row);
|
||||
@@ -122,7 +122,7 @@ class DbalCollectionRepository implements CollectionRepository
|
||||
}
|
||||
|
||||
$query = self::$selectQuery . ' WHERE coll_id = :collectionId';
|
||||
$row = $this->databoxConnection->fetchAssoc($query, [ ':collectionId' => $reference->getCollectionId() ]);
|
||||
$row = $this->databoxConnection->fetchAssoc($query, [':collectionId' => $reference->getCollectionId()]);
|
||||
|
||||
if ($row !== false) {
|
||||
return $this->collectionFactory->create($this->databoxId, $reference, $row);
|
||||
|
@@ -59,8 +59,8 @@ class BuildMissingSubdefs extends Command
|
||||
$subdefGenerator->generateSubdefs($record, $wanted_subdefs);
|
||||
|
||||
foreach ($wanted_subdefs as $subdef) {
|
||||
$this->container['monolog']->addInfo("generate " .$subdef . " for record " . $record->get_record_id());
|
||||
$n ++;
|
||||
$this->container['monolog']->addInfo("generate " . $subdef . " for record " . $record->get_record_id());
|
||||
$n++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,7 @@ class CreateCollection extends Command
|
||||
foreach ($results as $user) {
|
||||
$this->container->getAclForUser($user)->duplicate_right_from_bas($input->getOption('base_id_rights'), $new_collection->get_base_id());
|
||||
}
|
||||
$n+=40;
|
||||
$n += 40;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user