diff --git a/application/src/Controller/ActivationInterface.php b/application/src/Controller/ActivationInterface.php index 63d2f7b..5d9f984 100644 --- a/application/src/Controller/ActivationInterface.php +++ b/application/src/Controller/ActivationInterface.php @@ -1,17 +1,15 @@ render("standard/imprint.html.twig"); + return $this->render('standard/imprint.html.twig'); } - + /** * @Route("/", name="homepage") */ public function homepage(): Response { - return $this->render("standard/homepage.html.twig"); + return $this->render('standard/homepage.html.twig'); } } - diff --git a/application/src/Controller/DefaultControllerInterface.php b/application/src/Controller/DefaultControllerInterface.php index 5caa3d1..acf55af 100644 --- a/application/src/Controller/DefaultControllerInterface.php +++ b/application/src/Controller/DefaultControllerInterface.php @@ -1,17 +1,15 @@ user = new User(); $form = $this->createForm(UserType::class, $this->user); @@ -33,11 +29,13 @@ class RegistrationController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $this->encodePassword($passwordEncoder); $this->saveUser($translator); + return $this->redirectToRoute('login'); } - return $this->render("user/register.html.twig", array( - 'form' => $form->createView() - )); + + return $this->render('user/register.html.twig', [ + 'form' => $form->createView(), + ]); } public function encodePassword(UserPasswordEncoderInterface $passwordEncoder): void @@ -52,10 +50,9 @@ class RegistrationController extends AbstractController $entityManager->persist($this->user); try { $entityManager->flush(); - $this->addFlash('success', $translator->trans('User "%username%" created!',['%username%'=>$this->user->getUsername()])); + $this->addFlash('success', $translator->trans('User "%username%" created!', ['%username%' => $this->user->getUsername()])); } catch (\Exception $exception) { - $this->addFlash('danger', $translator->trans('User "%username%" could not be created!',['%username%'=>$this->user->getUsername()])); + $this->addFlash('danger', $translator->trans('User "%username%" could not be created!', ['%username%' => $this->user->getUsername()])); } } } - diff --git a/application/src/Controller/SecurityController.php b/application/src/Controller/SecurityController.php index 67ab0a4..f61dd31 100644 --- a/application/src/Controller/SecurityController.php +++ b/application/src/Controller/SecurityController.php @@ -1,4 +1,5 @@ getLastAuthenticationError(); if ($error) { - $this->addFlash('danger', $translator->trans($error->getMessageKey(),$error->getMessageData(),'security')); - }else{ + $this->addFlash('danger', $translator->trans($error->getMessageKey(), $error->getMessageData(), 'security')); + } else { $lastUsername = $authenticationUtils->getLastUsername(); - if($lastUsername){ - $this->addFlash('success', $translator->trans('User %user% loged in.',['%user%'=>$lastUsername])); + if ($lastUsername) { + $this->addFlash('success', $translator->trans('User %user% loged in.', ['%user%' => $lastUsername])); } } - return $this->render("user/login.html.twig",[ - 'last_username'=>$authenticationUtils->getLastUsername(), + + return $this->render('user/login.html.twig', [ + 'last_username' => $authenticationUtils->getLastUsername(), ]); } } - diff --git a/application/src/Controller/SourceController.php b/application/src/Controller/SourceController.php index 749204c..d86afb8 100644 --- a/application/src/Controller/SourceController.php +++ b/application/src/Controller/SourceController.php @@ -1,32 +1,35 @@ getChilds(); } - + public function setChilds(ArrayCollection $childs): void { $this->childs = $childs; } - } - diff --git a/application/src/Entity/Attribut/ChildsAttributeInterface.php b/application/src/Entity/Attribut/ChildsAttributeInterface.php index a8bd3af..5e90f15 100644 --- a/application/src/Entity/Attribut/ChildsAttributeInterface.php +++ b/application/src/Entity/Attribut/ChildsAttributeInterface.php @@ -1,15 +1,15 @@ id = $id; } - + public function getId(): int { return $this->id; } } - diff --git a/application/src/Entity/Attribut/IdAttributInterface.php b/application/src/Entity/Attribut/IdAttributInterface.php index 7d1a271..6af8838 100644 --- a/application/src/Entity/Attribut/IdAttributInterface.php +++ b/application/src/Entity/Attribut/IdAttributInterface.php @@ -1,15 +1,13 @@ node = $node; } - + public function getNode(): NodeInterface { return $this->node; } - } - diff --git a/application/src/Entity/Attribut/NodeAttributInterface.php b/application/src/Entity/Attribut/NodeAttributInterface.php index 6f40f66..46217e6 100644 --- a/application/src/Entity/Attribut/NodeAttributInterface.php +++ b/application/src/Entity/Attribut/NodeAttributInterface.php @@ -1,17 +1,15 @@ parents = $parents; } } - diff --git a/application/src/Entity/Attribut/ParentsAttributInterface.php b/application/src/Entity/Attribut/ParentsAttributInterface.php index 59dfdc9..7f37f7c 100644 --- a/application/src/Entity/Attribut/ParentsAttributInterface.php +++ b/application/src/Entity/Attribut/ParentsAttributInterface.php @@ -1,17 +1,15 @@ password; } - - public function setPassword(string $password):void{ + + public function setPassword(string $password): void + { $this->password = $password; } } - diff --git a/application/src/Entity/Attribut/PlainPasswordAttribute.php b/application/src/Entity/Attribut/PlainPasswordAttribute.php index 6438844..102966c 100644 --- a/application/src/Entity/Attribut/PlainPasswordAttribute.php +++ b/application/src/Entity/Attribut/PlainPasswordAttribute.php @@ -1,18 +1,18 @@ plainPassword = $password; } } - diff --git a/application/src/Entity/Attribut/SourceAttribut.php b/application/src/Entity/Attribut/SourceAttribut.php index 0ce4567..5d6f5c7 100644 --- a/application/src/Entity/Attribut/SourceAttribut.php +++ b/application/src/Entity/Attribut/SourceAttribut.php @@ -1,27 +1,29 @@ source; } - - public function setSource(SourceInterface $source):void{ + + public function setSource(SourceInterface $source): void + { $this->source = $source; } } - diff --git a/application/src/Entity/Attribut/SourceAttributInterface.php b/application/src/Entity/Attribut/SourceAttributInterface.php index 3a3e808..a0b72a0 100644 --- a/application/src/Entity/Attribut/SourceAttributInterface.php +++ b/application/src/Entity/Attribut/SourceAttributInterface.php @@ -1,17 +1,15 @@ username; } - - public function setUsername(string $username):void{ + + public function setUsername(string $username): void + { $this->username = \trim($username); } } - diff --git a/application/src/Entity/Configuration.php b/application/src/Entity/Configuration.php index 20c89ee..1e209f9 100644 --- a/application/src/Entity/Configuration.php +++ b/application/src/Entity/Configuration.php @@ -1,48 +1,48 @@ id, $this->username, $this->password, - )); + ]); } /** @see \Serializable::unserialize() */ public function unserialize($serialized) { - list ( + list( $this->id, $this->username, - $this->password, - ) = unserialize($serialized, array('allowed_classes' => false)); + $this->password) = unserialize($serialized, ['allowed_classes' => false]); } } diff --git a/application/src/Entity/UserInterface.php b/application/src/Entity/UserInterface.php index e5e99dc..61c20e6 100644 --- a/application/src/Entity/UserInterface.php +++ b/application/src/Entity/UserInterface.php @@ -1,14 +1,12 @@ factory = $factory; $this->item = $item; $this->request = $request; } - + /** * @return FactoryInterface */ @@ -40,7 +40,7 @@ class UserMenuEvent extends Event { return $this->factory; } - + /** * @return ItemInterface */ @@ -48,7 +48,7 @@ class UserMenuEvent extends Event { return $this->item; } - + /** * @return RequestStack */ @@ -56,4 +56,4 @@ class UserMenuEvent extends Event { return $this->request; } -} \ No newline at end of file +} diff --git a/application/src/Form/UserType.php b/application/src/Form/UserType.php index efb9dbf..b0abd61 100644 --- a/application/src/Form/UserType.php +++ b/application/src/Form/UserType.php @@ -1,11 +1,11 @@ -add('username', TextType::class) - ->add('plainPassword', RepeatedType::class, array( + ->add('plainPassword', RepeatedType::class, [ 'type' => PasswordType::class, - 'first_options' => array('label' => 'Password'), - 'second_options' => array('label' => 'Repeat Password'), - )) + 'first_options' => ['label' => 'Password'], + 'second_options' => ['label' => 'Repeat Password'], + ]) ; } public function configureOptions(OptionsResolver $resolver) { - $resolver->setDefaults(array( + $resolver->setDefaults([ 'data_class' => User::class, - )); + ]); } -} \ No newline at end of file +} diff --git a/application/src/Menu/Menu.php b/application/src/Menu/Menu.php index 008ba99..e82281b 100644 --- a/application/src/Menu/Menu.php +++ b/application/src/Menu/Menu.php @@ -1,4 +1,5 @@ dispatcher = $dispatcher; $this->factory = $factory; } - + public function userTopbar(RequestStack $request): ItemInterface { - $menu = $this->factory->createItem('root', array( - 'childrenAttributes' => array( - 'class' => 'navbar-nav mr-auto', - ), - )); - + $menu = $this->factory->createItem('root', [ + 'childrenAttributes' => [ + 'class' => 'navbar-nav mr-auto', + ], + ]); + $this->dispatcher->dispatch( UserMenuEvent::EVENT, new UserMenuEvent($this->factory, $menu, $request) ); - + return $menu; - } -} \ No newline at end of file + } +} diff --git a/application/src/Repository/UserRepository.php b/application/src/Repository/UserRepository.php index f575d53..d50e046 100644 --- a/application/src/Repository/UserRepository.php +++ b/application/src/Repository/UserRepository.php @@ -1,14 +1,12 @@ addChild( 'imprint', [ - 'route'=>'imprint', + 'route' => 'imprint', 'attributes' => [ 'icon' => 'fas fa-address-card', ], @@ -95,7 +94,7 @@ class UserMenuSubscriber implements EventSubscriberInterface public static function getSubscribedEvents(): array { return [ - UserMenuEvent::EVENT => 'onUserMenuConfigure' + UserMenuEvent::EVENT => 'onUserMenuConfigure', ]; } } diff --git a/application/tests/unit/Controller/DefaultControllerTest.php b/application/tests/unit/Controller/DefaultControllerTest.php index 67523cd..47af3a1 100644 --- a/application/tests/unit/Controller/DefaultControllerTest.php +++ b/application/tests/unit/Controller/DefaultControllerTest.php @@ -1,15 +1,13 @@ defaultController = new DefaultController(); + + public function setUp(): void + { + $this->defaultController = new DefaultController(); } - - public function testHomepage():void{ + + public function testHomepage(): void + { $client = static::createClient(); $client->request('GET', '/'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); } - - public function testImprint():void{ + + public function testImprint(): void + { $client = static::createClient(); $client->request('GET', '/imprint'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); } } - diff --git a/application/tests/unit/Controller/UserControllerTest.php b/application/tests/unit/Controller/UserControllerTest.php index e9a29cb..71895c2 100644 --- a/application/tests/unit/Controller/UserControllerTest.php +++ b/application/tests/unit/Controller/UserControllerTest.php @@ -1,4 +1,5 @@ userController = new UserController(); } - + public function testLogout(): void { $client = static::createClient(); $client->request('GET', '/user/logout'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); } - + public function testLogin(): void { $client = static::createClient(); $client->request('GET', '/login'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); } - - public function testRegister():void + + public function testRegister(): void { $client = static::createClient(); $client->request('GET', '/user/register'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); } } - diff --git a/application/tests/unit/Entity/UserTest.php b/application/tests/unit/Entity/UserTest.php index 167c2e4..7881e16 100644 --- a/application/tests/unit/Entity/UserTest.php +++ b/application/tests/unit/Entity/UserTest.php @@ -1,38 +1,38 @@ user = new User(); $this->user->setPassword(self::PASSWORD); $this->user->setUsername(' '.self::USERNAME.' '); } - - public function testUsername():void{ - $this->assertEquals(self::USERNAME,$this->user->getUsername()); + + public function testUsername(): void + { + $this->assertEquals(self::USERNAME, $this->user->getUsername()); } - - public function testPassword():void{ - $this->assertEquals(self::PASSWORD,$this->user->getPassword()); + + public function testPassword(): void + { + $this->assertEquals(self::PASSWORD, $this->user->getPassword()); } } -