php cs fixes

This commit is contained in:
2023-02-22 11:54:03 +01:00
parent 1f4438690e
commit f07ea3259e
25 changed files with 273 additions and 186 deletions

View File

@@ -1,10 +1,18 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\AsideActivityBundle\Export\Export;
use Chill\AsideActivityBundle\Entity\AsideActivity;
use Chill\AsideActivityBundle\Export\Declarations;
use Chill\AsideActivityBundle\Form\AsideActivityCategoryType;
use Chill\AsideActivityBundle\Repository\AsideActivityCategoryRepository;
use Chill\AsideActivityBundle\Security\AsideActivityVoter;
use Chill\AsideActivityBundle\Templating\Entity\CategoryRender;
@@ -16,32 +24,32 @@ use Chill\MainBundle\Export\Helper\UserHelper;
use Chill\MainBundle\Export\ListInterface;
use Chill\MainBundle\Repository\CenterRepositoryInterface;
use Chill\MainBundle\Repository\ScopeRepositoryInterface;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
use Closure;
use DateTimeInterface;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder;
use LogicException;
use Symfony\Component\Form\FormBuilderInterface;
final class ListAsideActivity implements ListInterface, GroupedExportInterface
{
private EntityManagerInterface $em;
private UserHelper $userHelper;
private DateTimeHelper $dateTimeHelper;
private ScopeRepositoryInterface $scopeRepository;
private CenterRepositoryInterface $centerRepository;
private AsideActivityCategoryRepository $asideActivityCategoryRepository;
private CategoryRender $categoryRender;
private CenterRepositoryInterface $centerRepository;
private DateTimeHelper $dateTimeHelper;
private EntityManagerInterface $em;
private ScopeRepositoryInterface $scopeRepository;
private TranslatableStringHelperInterface $translatableStringHelper;
private UserHelper $userHelper;
public function __construct(
EntityManagerInterface $em,
DateTimeHelper $dateTimeHelper,
@@ -76,11 +84,6 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
return 'export.aside_activity.List of aside activities';
}
public function getTitle()
{
return 'export.aside_activity.List of aside activities';
}
public function getGroup(): string
{
return 'export.Exports of aside activities';
@@ -91,15 +94,16 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
switch ($key) {
case 'id':
case 'note':
return function ($value) use ($key) {
return static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.aside_activity.' . $key;
}
return $value ?? '';
};
case 'duration':
return function ($value) use ($key) {
return static function ($value) use ($key) {
if ('_header' === $value) {
return 'export.aside_activity.' . $key;
}
@@ -108,7 +112,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
return '';
}
if ($value instanceof \DateTimeInterface) {
if ($value instanceof DateTimeInterface) {
return $value->format('H:i:s');
}
@@ -118,7 +122,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
case 'createdAt':
case 'updatedAt':
case 'date':
return $this->dateTimeHelper->getLabel('export.aside_activity.'.$key);
return $this->dateTimeHelper->getLabel('export.aside_activity.' . $key);
case 'agent_id':
case 'creator_id':
@@ -165,7 +169,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
};
default:
throw new \LogicException('this key is not supported : ' . $key);
throw new LogicException('this key is not supported : ' . $key);
}
}
@@ -182,7 +186,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
'aside_activity_type',
'date',
'duration',
'note'
'note',
];
}
@@ -195,6 +199,11 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
return $query->getQuery()->getResult(AbstractQuery::HYDRATE_ARRAY);
}
public function getTitle()
{
return 'export.aside_activity.List of aside activities';
}
public function getType(): string
{
return Declarations::ASIDE_ACTIVITY_TYPE;
@@ -204,8 +213,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
{
$qb = $this->em->createQueryBuilder()
->from(AsideActivity::class, 'aside')
->leftJoin('aside.agent', 'agent')
;
->leftJoin('aside.agent', 'agent');
$qb
->addSelect('aside.id AS id')
@@ -218,8 +226,7 @@ final class ListAsideActivity implements ListInterface, GroupedExportInterface
->addSelect('IDENTITY(aside.type) AS aside_activity_type')
->addSelect('aside.date')
->addSelect('aside.duration')
->addSelect('aside.note')
;
->addSelect('aside.note');
return $qb;
}

View File

@@ -17,7 +17,6 @@ use Chill\MainBundle\Form\Type\Export\FilterType;
use Chill\MainBundle\Form\Type\PickRollingDateType;
use Chill\MainBundle\Service\RollingDate\RollingDate;
use Chill\MainBundle\Service\RollingDate\RollingDateConverterInterface;
use Doctrine\ORM\Query\Expr\Andx;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormError;

View File

@@ -15,7 +15,6 @@ use Chill\AsideActivityBundle\Export\Declarations;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\PickUserDynamicType;
use Chill\MainBundle\Templating\Entity\UserRender;
use Doctrine\ORM\Query\Expr\Andx;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;