mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 03:23:48 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -19,16 +19,9 @@ use Chill\MainBundle\Timeline\TimelineProviderInterface;
|
||||
use Chill\MainBundle\Timeline\TimelineSingleQuery;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use LogicException;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
use function implode;
|
||||
use function in_array;
|
||||
use function strtr;
|
||||
|
||||
class TimelineActivityProvider implements TimelineProviderInterface
|
||||
{
|
||||
private const SUPPORTED_CONTEXTS = ['center', 'person'];
|
||||
@@ -42,7 +35,7 @@ class TimelineActivityProvider implements TimelineProviderInterface
|
||||
protected ActivityACLAwareRepository $aclAwareRepository
|
||||
) {
|
||||
if (!$storage->getToken()->getUser() instanceof User) {
|
||||
throw new RuntimeException('A user should be authenticated !');
|
||||
throw new \RuntimeException('A user should be authenticated !');
|
||||
}
|
||||
|
||||
$this->user = $storage->getToken()->getUser();
|
||||
@@ -61,10 +54,10 @@ class TimelineActivityProvider implements TimelineProviderInterface
|
||||
|
||||
return TimelineSingleQuery::fromArray([
|
||||
'id' => $metadataActivity->getTableName()
|
||||
. '.' . $metadataActivity->getColumnName('id'),
|
||||
.'.'.$metadataActivity->getColumnName('id'),
|
||||
'type' => 'activity',
|
||||
'date' => $metadataActivity->getTableName()
|
||||
. '.' . $metadataActivity->getColumnName('date'),
|
||||
.'.'.$metadataActivity->getColumnName('date'),
|
||||
'FROM' => $this->getFromClausePerson(),
|
||||
'WHERE' => $where,
|
||||
'parameters' => $parameters,
|
||||
@@ -106,17 +99,12 @@ class TimelineActivityProvider implements TimelineProviderInterface
|
||||
/**
|
||||
* Check if the context is supported.
|
||||
*
|
||||
* @throws LogicException if the context is not supported
|
||||
* @throws \LogicException if the context is not supported
|
||||
*/
|
||||
private function checkContext(string $context)
|
||||
{
|
||||
if (false === in_array($context, self::SUPPORTED_CONTEXTS, true)) {
|
||||
throw new LogicException(
|
||||
sprintf(
|
||||
"The context '%s' is not supported. Currently only 'person' is supported",
|
||||
$context
|
||||
)
|
||||
);
|
||||
if (false === \in_array($context, self::SUPPORTED_CONTEXTS, true)) {
|
||||
throw new \LogicException(sprintf("The context '%s' is not supported. Currently only 'person' is supported", $context));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,8 +139,8 @@ class TimelineActivityProvider implements TimelineProviderInterface
|
||||
|
||||
// loop on reachable scopes
|
||||
foreach ($reachableScopes as $scope) {
|
||||
/** @phpstan-ignore-next-line */
|
||||
if (in_array($scope->getId(), $scopes_ids, true)) {
|
||||
/* @phpstan-ignore-next-line */
|
||||
if (\in_array($scope->getId(), $scopes_ids, true)) {
|
||||
continue;
|
||||
}
|
||||
$scopes_ids[] = '?';
|
||||
@@ -160,13 +148,13 @@ class TimelineActivityProvider implements TimelineProviderInterface
|
||||
}
|
||||
|
||||
return [
|
||||
strtr(
|
||||
\strtr(
|
||||
$whereClause,
|
||||
[
|
||||
'{activity.person_id}' => $associationMapping['joinColumns'][0]['name'],
|
||||
'{activity.scope_id}' => $metadataActivity->getTableName() . '.' .
|
||||
'{activity.scope_id}' => $metadataActivity->getTableName().'.'.
|
||||
$metadataActivity->getAssociationMapping('scope')['joinColumns'][0]['name'],
|
||||
'{scopes_ids}' => implode(', ', $scopes_ids),
|
||||
'{scopes_ids}' => \implode(', ', $scopes_ids),
|
||||
]
|
||||
),
|
||||
$parameters,
|
||||
|
Reference in New Issue
Block a user