Loading module/Application/src/Application/Service/Source/SourceService.php +16 −2 Changes for module/Application/src/Application/Service/Source/SourceService.php: 16 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -4,7 +4,9 @@ namespace Application\Service\Source; use Application\Entity\Db\Source; use Application\Service\BaseService; use Application\SourceCodeStringHelperAwareTrait; use Doctrine\ORM\EntityRepository; use Structure\Entity\Db\Etablissement; use UnicaenApp\Exception\RuntimeException; /** Loading @@ -12,6 +14,8 @@ use UnicaenApp\Exception\RuntimeException; */ class SourceService extends BaseService { use SourceCodeStringHelperAwareTrait; const APPL_SOURCE_CODE = 'SYGAL::sygal'; const SQL_TEMPLATE_CREATE_APP_SOURCE = Loading @@ -20,7 +24,7 @@ class SourceService extends BaseService /** * @return EntityRepository */ public function getRepository() public function getRepository(): EntityRepository { /** @var EntityRepository $repo */ $repo = $this->entityManager->getRepository(Source::class); Loading @@ -31,7 +35,7 @@ class SourceService extends BaseService /** * @return Source */ public function fetchApplicationSource() public function fetchApplicationSource(): Source { $codeApp = self::APPL_SOURCE_CODE; Loading @@ -48,4 +52,14 @@ class SourceService extends BaseService return $source; } /** * Génère un SOURCE_CODE par défaut. * * @return string */ public function genereateSourceCode(): string { return $this->sourceCodeStringHelper->addDefaultPrefixTo(uniqid()); } } No newline at end of file module/Application/src/Application/Service/Source/SourceServiceAwareTrait.php +1 −10 Changes for module/Application/src/Application/Service/Source/SourceServiceAwareTrait.php: 1 added line, 10 removed lines. Original line number Diff line number Diff line Loading @@ -7,19 +7,10 @@ namespace Application\Service\Source; */ trait SourceServiceAwareTrait { /** * @var SourceService */ protected $sourceService; protected SourceService $sourceService; /** * @param SourceService $sourceService * @return self */ public function setSourceService(SourceService $sourceService) { $this->sourceService = $sourceService; return $this; } } No newline at end of file module/Application/src/Application/Service/Source/SourceServiceFactory.php +6 −7 Changes for module/Application/src/Application/Service/Source/SourceServiceFactory.php: 6 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Application\Service\Source; use Application\SourceCodeStringHelper; use Interop\Container\ContainerInterface; /** Loading @@ -10,17 +11,15 @@ use Interop\Container\ContainerInterface; class SourceServiceFactory { /** * @param ContainerInterface $container * @param string $requestedName * @param array|null $options * * @return SourceService * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container, $requestedName, $options = null) public function __invoke(ContainerInterface $container): SourceService { $service = new SourceService; /* Injectez vos dépendances ICI */ $helper = $container->get(SourceCodeStringHelper::class); $service->setSourceCodeStringHelper($helper); return $service; } Loading module/Application/src/Application/SourceCodeStringHelperFactory.php +5 −7 Changes for module/Application/src/Application/SourceCodeStringHelperFactory.php: 5 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -2,18 +2,16 @@ namespace Application; use UnicaenApp\Exception\RuntimeException; use Interop\Container\ContainerInterface; use UnicaenApp\Exception\RuntimeException; class SourceCodeStringHelperFactory { /** * Create helper * * @param ContainerInterface $container * @return SourceCodeStringHelper * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container) public function __invoke(ContainerInterface $container): SourceCodeStringHelper { $config = $container->get('Config'); $prefix = $this->getDefaultPrefixFromConfig($config); Loading @@ -28,7 +26,7 @@ class SourceCodeStringHelperFactory * @param array $config * @return string */ private function getDefaultPrefixFromConfig(array $config) private function getDefaultPrefixFromConfig(array $config): string { $key = 'default_prefix_for_source_code'; Loading module/Structure/src/Structure/Entity/Db/EcoleDoctorale.php +4 −6 Changes for module/Structure/src/Structure/Entity/Db/EcoleDoctorale.php: 4 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -71,12 +71,10 @@ class EcoleDoctorale implements public function __toString(): string { $str = ''; if ($sigle = $this->structure->getSigle()) { $str .= "$sigle - "; } $str .= $this->structure->getLibelle(); return $str; return implode(' - ', array_filter([ $this->structure->getSigle(), $this->structure->getLibelle() ])); } /** Loading Loading
module/Application/src/Application/Service/Source/SourceService.php +16 −2 Changes for module/Application/src/Application/Service/Source/SourceService.php: 16 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -4,7 +4,9 @@ namespace Application\Service\Source; use Application\Entity\Db\Source; use Application\Service\BaseService; use Application\SourceCodeStringHelperAwareTrait; use Doctrine\ORM\EntityRepository; use Structure\Entity\Db\Etablissement; use UnicaenApp\Exception\RuntimeException; /** Loading @@ -12,6 +14,8 @@ use UnicaenApp\Exception\RuntimeException; */ class SourceService extends BaseService { use SourceCodeStringHelperAwareTrait; const APPL_SOURCE_CODE = 'SYGAL::sygal'; const SQL_TEMPLATE_CREATE_APP_SOURCE = Loading @@ -20,7 +24,7 @@ class SourceService extends BaseService /** * @return EntityRepository */ public function getRepository() public function getRepository(): EntityRepository { /** @var EntityRepository $repo */ $repo = $this->entityManager->getRepository(Source::class); Loading @@ -31,7 +35,7 @@ class SourceService extends BaseService /** * @return Source */ public function fetchApplicationSource() public function fetchApplicationSource(): Source { $codeApp = self::APPL_SOURCE_CODE; Loading @@ -48,4 +52,14 @@ class SourceService extends BaseService return $source; } /** * Génère un SOURCE_CODE par défaut. * * @return string */ public function genereateSourceCode(): string { return $this->sourceCodeStringHelper->addDefaultPrefixTo(uniqid()); } } No newline at end of file
module/Application/src/Application/Service/Source/SourceServiceAwareTrait.php +1 −10 Changes for module/Application/src/Application/Service/Source/SourceServiceAwareTrait.php: 1 added line, 10 removed lines. Original line number Diff line number Diff line Loading @@ -7,19 +7,10 @@ namespace Application\Service\Source; */ trait SourceServiceAwareTrait { /** * @var SourceService */ protected $sourceService; protected SourceService $sourceService; /** * @param SourceService $sourceService * @return self */ public function setSourceService(SourceService $sourceService) { $this->sourceService = $sourceService; return $this; } } No newline at end of file
module/Application/src/Application/Service/Source/SourceServiceFactory.php +6 −7 Changes for module/Application/src/Application/Service/Source/SourceServiceFactory.php: 6 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Application\Service\Source; use Application\SourceCodeStringHelper; use Interop\Container\ContainerInterface; /** Loading @@ -10,17 +11,15 @@ use Interop\Container\ContainerInterface; class SourceServiceFactory { /** * @param ContainerInterface $container * @param string $requestedName * @param array|null $options * * @return SourceService * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container, $requestedName, $options = null) public function __invoke(ContainerInterface $container): SourceService { $service = new SourceService; /* Injectez vos dépendances ICI */ $helper = $container->get(SourceCodeStringHelper::class); $service->setSourceCodeStringHelper($helper); return $service; } Loading
module/Application/src/Application/SourceCodeStringHelperFactory.php +5 −7 Changes for module/Application/src/Application/SourceCodeStringHelperFactory.php: 5 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -2,18 +2,16 @@ namespace Application; use UnicaenApp\Exception\RuntimeException; use Interop\Container\ContainerInterface; use UnicaenApp\Exception\RuntimeException; class SourceCodeStringHelperFactory { /** * Create helper * * @param ContainerInterface $container * @return SourceCodeStringHelper * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container) public function __invoke(ContainerInterface $container): SourceCodeStringHelper { $config = $container->get('Config'); $prefix = $this->getDefaultPrefixFromConfig($config); Loading @@ -28,7 +26,7 @@ class SourceCodeStringHelperFactory * @param array $config * @return string */ private function getDefaultPrefixFromConfig(array $config) private function getDefaultPrefixFromConfig(array $config): string { $key = 'default_prefix_for_source_code'; Loading
module/Structure/src/Structure/Entity/Db/EcoleDoctorale.php +4 −6 Changes for module/Structure/src/Structure/Entity/Db/EcoleDoctorale.php: 4 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -71,12 +71,10 @@ class EcoleDoctorale implements public function __toString(): string { $str = ''; if ($sigle = $this->structure->getSigle()) { $str .= "$sigle - "; } $str .= $this->structure->getLibelle(); return $str; return implode(' - ', array_filter([ $this->structure->getSigle(), $this->structure->getLibelle() ])); } /** Loading