Passed
Push — master ( 05f64e...f315ad )
by Anthony
02:45
created
Controller/DefaultController.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 block discarded – undo
7 7
 
8 8
 class DefaultController extends AbstractController
9 9
 {
10
-    /**
11
-     * @Route("/", name="ribsadmin")
12
-     * @Route("/index", name="ribsadmin_index")
13
-     * @Route("/navigation", name="ribsadmin_navigation")
14
-     */
15
-    public function index()
16
-    {
17
-        return $this->render('@RibsAdmin/Default/index.html.twig');
18
-    }
10
+				/**
11
+				 * @Route("/", name="ribsadmin")
12
+				 * @Route("/index", name="ribsadmin_index")
13
+				 * @Route("/navigation", name="ribsadmin_navigation")
14
+				 */
15
+				public function index()
16
+				{
17
+								return $this->render('@RibsAdmin/Default/index.html.twig');
18
+				}
19 19
 }
Please login to merge, or discard this patch.
Controller/NavigationBuilderController.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -10,48 +10,48 @@
 block discarded – undo
10 10
 
11 11
 class NavigationBuilderController extends AbstractController
12 12
 {
13
-    private $nav = [];
14
-
15
-    /**
16
-     * function that display the left navigation mapped by user rights
17
-     * @param Globals $globals
18
-     * @param AccessRights $access_rights
19
-     * @return Response
20
-     */
21
-    public function getLeftNavigation(Globals $globals, AccessRights $access_rights): Response
22
-    {
23
-        $navigation = json_decode(file_get_contents($globals->getBaseBundlePath() . "/Resources/json/navigation.json"), true);
24
-
25
-        foreach ($navigation["items"] as $item) {
26
-            if ($access_rights->testRight($item["right"]) && (!isset($item["position"]) || $item["position"] === "left")) {
27
-                $this->nav[] = $item;
28
-            }
29
-        }
30
-
31
-        $this->getModuleNavigation();
32
-
33
-        return $this->render("@RibsAdmin/navigation.html.twig", ["navigation" => $this->nav]);
34
-    }
35
-
36
-    /**
37
-     * to get all modules navigation and test right navigation
38
-     */
39
-    private function getModuleNavigation()
40
-    {
41
-        $modules = $this->getDoctrine()->getRepository(Module::class)->findBy([
42
-            "active" => true,
43
-            "displayed" => true
44
-        ]);
45
-
46
-        foreach ($modules as $module) {
47
-            $navigation = json_decode(file_get_contents($this->get("ribs_admin.globals")->getBaseBundlePath
48
-                ($module->getPackageName(), $module->getDevMode()) . "/Resources/json/navigation.json"), true);
49
-
50
-            foreach ($navigation["items"] as $item) {
51
-                if ($this->get("ribs_admin.acess_rights")->testRight($item["right"]) && (!isset($item["position"]) || $item["position"] === "left")) {
52
-                    $this->nav[] = $item;
53
-                }
54
-            }
55
-        }
56
-    }
13
+				private $nav = [];
14
+
15
+				/**
16
+				 * function that display the left navigation mapped by user rights
17
+				 * @param Globals $globals
18
+				 * @param AccessRights $access_rights
19
+				 * @return Response
20
+				 */
21
+				public function getLeftNavigation(Globals $globals, AccessRights $access_rights): Response
22
+				{
23
+								$navigation = json_decode(file_get_contents($globals->getBaseBundlePath() . "/Resources/json/navigation.json"), true);
24
+
25
+								foreach ($navigation["items"] as $item) {
26
+												if ($access_rights->testRight($item["right"]) && (!isset($item["position"]) || $item["position"] === "left")) {
27
+																$this->nav[] = $item;
28
+												}
29
+								}
30
+
31
+								$this->getModuleNavigation();
32
+
33
+								return $this->render("@RibsAdmin/navigation.html.twig", ["navigation" => $this->nav]);
34
+				}
35
+
36
+				/**
37
+				 * to get all modules navigation and test right navigation
38
+				 */
39
+				private function getModuleNavigation()
40
+				{
41
+								$modules = $this->getDoctrine()->getRepository(Module::class)->findBy([
42
+												"active" => true,
43
+												"displayed" => true
44
+								]);
45
+
46
+								foreach ($modules as $module) {
47
+												$navigation = json_decode(file_get_contents($this->get("ribs_admin.globals")->getBaseBundlePath
48
+																($module->getPackageName(), $module->getDevMode()) . "/Resources/json/navigation.json"), true);
49
+
50
+												foreach ($navigation["items"] as $item) {
51
+																if ($this->get("ribs_admin.acess_rights")->testRight($item["right"]) && (!isset($item["position"]) || $item["position"] === "left")) {
52
+																				$this->nav[] = $item;
53
+																}
54
+												}
55
+								}
56
+				}
57 57
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@
 block discarded – undo
44 44
         ]);
45 45
 
46 46
         foreach ($modules as $module) {
47
-            $navigation = json_decode(file_get_contents($this->get("ribs_admin.globals")->getBaseBundlePath
48
-                ($module->getPackageName(), $module->getDevMode()) . "/Resources/json/navigation.json"), true);
47
+            $navigation = json_decode(file_get_contents($this->get("ribs_admin.globals")->getBaseBundlePath($module->getPackageName(), $module->getDevMode()) . "/Resources/json/navigation.json"), true);
49 48
 
50 49
             foreach ($navigation["items"] as $item) {
51 50
                 if ($this->get("ribs_admin.acess_rights")->testRight($item["right"]) && (!isset($item["position"]) || $item["position"] === "left")) {
Please login to merge, or discard this patch.
Controller/ModuleController.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -11,79 +11,79 @@
 block discarded – undo
11 11
 
12 12
 class ModuleController extends AbstractController
13 13
 {
14
-    /**
15
-     * @Route("/modules/", name="ribsadmin_modules")
16
-     * @return Response
17
-     */
18
-    public function list(): Response
19
-    {
20
-        $em = $this->getDoctrine()->getManager();
14
+				/**
15
+				 * @Route("/modules/", name="ribsadmin_modules")
16
+				 * @return Response
17
+				 */
18
+				public function list(): Response
19
+				{
20
+								$em = $this->getDoctrine()->getManager();
21 21
 
22
-        $modules = $em->getRepository(Module::class)->findBy([], ['titleTag' => 'ASC']);
22
+								$modules = $em->getRepository(Module::class)->findBy([], ['titleTag' => 'ASC']);
23 23
 
24
-        return $this->render('@RibsAdmin/modules/list.html.twig', [
25
-            "modules" => $modules,
26
-        ]);
27
-    }
24
+								return $this->render('@RibsAdmin/modules/list.html.twig', [
25
+												"modules" => $modules,
26
+								]);
27
+				}
28 28
 
29
-    /**
30
-     * @Route("/modules/create/", name="ribsadmin_modules_create")
31
-     * @Route("/modules/edit/{id}", name="ribsadmin_modules_edit")
32
-     * @param Request $request
33
-     * @param int|null $id
34
-     * @return Response
35
-     */
36
-    public function edit(Request $request, int $id = null): Response
37
-    {
38
-        $em = $this->getDoctrine()->getManager();
29
+				/**
30
+				 * @Route("/modules/create/", name="ribsadmin_modules_create")
31
+				 * @Route("/modules/edit/{id}", name="ribsadmin_modules_edit")
32
+				 * @param Request $request
33
+				 * @param int|null $id
34
+				 * @return Response
35
+				 */
36
+				public function edit(Request $request, int $id = null): Response
37
+				{
38
+								$em = $this->getDoctrine()->getManager();
39 39
 
40
-        if (!$id) {
41
-            $module = new Module();
42
-            $text = "created";
43
-        } else {
44
-            $module = $em->getRepository(Module::class)->findOneBy(["id" => $id]);
45
-            $text = "edited";
46
-        }
40
+								if (!$id) {
41
+												$module = new Module();
42
+												$text = "created";
43
+								} else {
44
+												$module = $em->getRepository(Module::class)->findOneBy(["id" => $id]);
45
+												$text = "edited";
46
+								}
47 47
 
48
-        $form = $this->createForm(\PiouPiou\RibsAdminBundle\Form\Module::class, $module);
49
-        $form->handleRequest($request);
48
+								$form = $this->createForm(\PiouPiou\RibsAdminBundle\Form\Module::class, $module);
49
+								$form->handleRequest($request);
50 50
 
51
-        if ($form->isSubmitted() && $form->isValid()) {
52
-            /** @var Module $data */
53
-            $data = $form->getData();
54
-            $em->persist($data);
55
-            $em->flush();
56
-            $this->addFlash("success-flash", "Module " . $data->getTitleTag() . " was " . $text);
51
+								if ($form->isSubmitted() && $form->isValid()) {
52
+												/** @var Module $data */
53
+												$data = $form->getData();
54
+												$em->persist($data);
55
+												$em->flush();
56
+												$this->addFlash("success-flash", "Module " . $data->getTitleTag() . " was " . $text);
57 57
 
58
-            return $this->redirectToRoute("ribsadmin_modules");
59
-        }
58
+												return $this->redirectToRoute("ribsadmin_modules");
59
+								}
60 60
 
61
-        return $this->render("@RibsAdmin/modules/edit.html.twig", [
62
-            "form" => $form->createView(),
63
-            "form_errors" => $form->getErrors(),
64
-            "module" => $module
65
-        ]);
66
-    }
61
+								return $this->render("@RibsAdmin/modules/edit.html.twig", [
62
+												"form" => $form->createView(),
63
+												"form_errors" => $form->getErrors(),
64
+												"module" => $module
65
+								]);
66
+				}
67 67
 
68
-    /**
69
-     * @Route("/modules/delete/{id}", name="ribsadmin_modules_delete")
70
-     * @param int $id
71
-     * @return RedirectResponse
72
-     */
73
-    public function delete(int $id): RedirectResponse
74
-    {
75
-        $em = $this->getDoctrine()->getManager();
76
-        $module = $em->getRepository(Module::class)->findOneBy(["id" => $id]);
68
+				/**
69
+				 * @Route("/modules/delete/{id}", name="ribsadmin_modules_delete")
70
+				 * @param int $id
71
+				 * @return RedirectResponse
72
+				 */
73
+				public function delete(int $id): RedirectResponse
74
+				{
75
+								$em = $this->getDoctrine()->getManager();
76
+								$module = $em->getRepository(Module::class)->findOneBy(["id" => $id]);
77 77
 
78
-        if ($module) {
79
-            $name = $module->getTitle();
80
-            $em->remove($module);
81
-            $em->flush();
82
-            $this->addFlash("success-flash", "Module " . $name . " was deleted");
83
-        } else {
84
-            $this->addFlash("error-flash", "An error occured, module doesn't found");
85
-        }
78
+								if ($module) {
79
+												$name = $module->getTitle();
80
+												$em->remove($module);
81
+												$em->flush();
82
+												$this->addFlash("success-flash", "Module " . $name . " was deleted");
83
+								} else {
84
+												$this->addFlash("error-flash", "An error occured, module doesn't found");
85
+								}
86 86
 
87
-        return $this->redirectToRoute("ribsadmin_modules");
88
-    }
87
+								return $this->redirectToRoute("ribsadmin_modules");
88
+				}
89 89
 }
Please login to merge, or discard this patch.
Controller/RenderPageController.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,22 +9,22 @@
 block discarded – undo
9 9
 
10 10
 class RenderPageController extends AbstractController
11 11
 {
12
-    /**
13
-     * @Route("/page/{url}", name="page", requirements={"url" = "[a-zA-Z0-9\-\_\/]*"})
14
-     * @param string $url
15
-     * @return Response
16
-     */
17
-    public function renderPage(string $url): Response
18
-    {
19
-        $em = $this->getDoctrine()->getManager();
12
+				/**
13
+				 * @Route("/page/{url}", name="page", requirements={"url" = "[a-zA-Z0-9\-\_\/]*"})
14
+				 * @param string $url
15
+				 * @return Response
16
+				 */
17
+				public function renderPage(string $url): Response
18
+				{
19
+								$em = $this->getDoctrine()->getManager();
20 20
 
21
-        $page = $em->getRepository("RibsAdminBundle:Page")->findOneBy(["url" => $url]);
22
-        $navigation = $em->getRepository("RibsAdminBundle:Navigation")->findAllNavigation();
21
+								$page = $em->getRepository("RibsAdminBundle:Page")->findOneBy(["url" => $url]);
22
+								$navigation = $em->getRepository("RibsAdminBundle:Navigation")->findAllNavigation();
23 23
 
24
-        if ($page) {
25
-            return $this->render("@RibsAdmin/page.html.twig", ["page" => $page, "navigation" => $navigation]);
26
-        }
24
+								if ($page) {
25
+												return $this->render("@RibsAdmin/page.html.twig", ["page" => $page, "navigation" => $navigation]);
26
+								}
27 27
 
28
-        throw new NotFoundHttpException("The required page does not exist");
29
-    }
28
+								throw new NotFoundHttpException("The required page does not exist");
29
+				}
30 30
 }
Please login to merge, or discard this patch.
Form/Account.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 class Account extends AbstractType
15 15
 {
16
-    /**
17
-     * @param FormBuilderInterface $builder
18
-     * @param array $options
19
-     */
16
+				/**
17
+				 * @param FormBuilderInterface $builder
18
+				 * @param array $options
19
+				 */
20 20
 	public function buildForm(FormBuilderInterface $builder, array $options)
21 21
 	{
22 22
 		$builder
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 		$builder->add('user', User::class);
50 50
 	}
51 51
 
52
-    /**
53
-     * @param OptionsResolver $resolver
54
-     */
52
+				/**
53
+				 * @param OptionsResolver $resolver
54
+				 */
55 55
 	public function configureOptions(OptionsResolver $resolver)
56 56
 	{
57 57
 		$resolver->setDefaults([
Please login to merge, or discard this patch.
Form/Module.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 class Module extends AbstractType
14 14
 {
15
-    /**
16
-     * @param FormBuilderInterface $builder
17
-     * @param array $options
18
-     */
15
+				/**
16
+				 * @param FormBuilderInterface $builder
17
+				 * @param array $options
18
+				 */
19 19
 	public function buildForm(FormBuilderInterface $builder, array $options)
20 20
 	{
21 21
 		$builder
@@ -27,22 +27,22 @@  discard block
 block discarded – undo
27 27
 				"label" => "Package name",
28 28
 				"required" => true
29 29
 			])
30
-            ->add("titleTag", TextType::class, [
31
-                "label" => "Title tag",
32
-                "required" => true
33
-            ])
34
-            ->add("descriptionTag", TextareaType::class, [
35
-                "label" => "Description tag",
36
-                "required" => true,
37
-            ])
38
-            ->add("url", TextType::class, [
39
-                "label" => "Url",
40
-                "required" => true
41
-            ])
42
-            ->add("urlAdmin", TextType::class, [
43
-                "label" => "Admin url",
44
-                "required" => true
45
-            ])
30
+												->add("titleTag", TextType::class, [
31
+																"label" => "Title tag",
32
+																"required" => true
33
+												])
34
+												->add("descriptionTag", TextareaType::class, [
35
+																"label" => "Description tag",
36
+																"required" => true,
37
+												])
38
+												->add("url", TextType::class, [
39
+																"label" => "Url",
40
+																"required" => true
41
+												])
42
+												->add("urlAdmin", TextType::class, [
43
+																"label" => "Admin url",
44
+																"required" => true
45
+												])
46 46
 			->add("active", CheckboxType::class, [
47 47
 				"label" => "Enable module",
48 48
 				"attr" => [
@@ -50,22 +50,22 @@  discard block
 block discarded – undo
50 50
 				],
51 51
 				"required" => false
52 52
 			])
53
-            ->add("displayed", CheckboxType::class, [
54
-                "label" => "Display module in navigation",
55
-                "attr" => [
56
-                    "class" => "ribs-checkbox switched cxs-2 no-pl"
57
-                ],
58
-                "required" => false
59
-            ])
60
-            ->add('submit', SubmitType::class, [
61
-                'label' => 'Validate',
62
-                'attr' => []
63
-            ]);
53
+												->add("displayed", CheckboxType::class, [
54
+																"label" => "Display module in navigation",
55
+																"attr" => [
56
+																				"class" => "ribs-checkbox switched cxs-2 no-pl"
57
+																],
58
+																"required" => false
59
+												])
60
+												->add('submit', SubmitType::class, [
61
+																'label' => 'Validate',
62
+																'attr' => []
63
+												]);
64 64
 	}
65 65
 
66
-    /**
67
-     * @param OptionsResolver $resolver
68
-     */
66
+				/**
67
+				 * @param OptionsResolver $resolver
68
+				 */
69 69
 	public function configureOptions(OptionsResolver $resolver)
70 70
 	{
71 71
 		$resolver->setDefaults([
Please login to merge, or discard this patch.
Form/Registration.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 class Registration extends AbstractType
15 15
 {
16
-    /**
17
-     * @param FormBuilderInterface $builder
18
-     * @param array $options
19
-     */
16
+				/**
17
+				 * @param FormBuilderInterface $builder
18
+				 * @param array $options
19
+				 */
20 20
 	public function buildForm(FormBuilderInterface $builder, array $options)
21 21
 	{
22 22
 		$builder
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 			]);
30 30
 	}
31 31
 
32
-    /**
33
-     * @param OptionsResolver $resolver
34
-     */
32
+				/**
33
+				 * @param OptionsResolver $resolver
34
+				 */
35 35
 	public function configureOptions(OptionsResolver $resolver)
36 36
 	{
37 37
 		$resolver->setDefaults([
Please login to merge, or discard this patch.
Form/Type/AutocompleteType.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -10,35 +10,35 @@
 block discarded – undo
10 10
 
11 11
 class AutocompleteType extends AbstractType
12 12
 {
13
-    /**
14
-     * @param FormBuilderInterface $builder
15
-     * @param array $options
16
-     */
17
-    public function buildForm(FormBuilderInterface $builder, array $options)
18
-    {
19
-        $builder
20
-            ->add($options["autocomplete_name"], TextType::class, [
21
-                "label" => false,
22
-                "attr" => [
23
-                    "class" => "input-autocomplete",
24
-                    "data-url" => $options["data_url"],
25
-                    "autocomplete" => "off"
26
-                ],
27
-                "mapped" => false
28
-            ])
29
-            ->add($options["autocomplete_name"] . "_id", HiddenType::class, [
30
-                "mapped" => false
31
-            ]);
32
-    }
13
+				/**
14
+				 * @param FormBuilderInterface $builder
15
+				 * @param array $options
16
+				 */
17
+				public function buildForm(FormBuilderInterface $builder, array $options)
18
+				{
19
+								$builder
20
+												->add($options["autocomplete_name"], TextType::class, [
21
+																"label" => false,
22
+																"attr" => [
23
+																				"class" => "input-autocomplete",
24
+																				"data-url" => $options["data_url"],
25
+																				"autocomplete" => "off"
26
+																],
27
+																"mapped" => false
28
+												])
29
+												->add($options["autocomplete_name"] . "_id", HiddenType::class, [
30
+																"mapped" => false
31
+												]);
32
+				}
33 33
 
34
-    /**
35
-     * @param OptionsResolver $resolver
36
-     */
37
-    public function configureOptions(OptionsResolver $resolver)
38
-    {
39
-        $resolver->setDefaults([
40
-            "autocomplete_name" => null,
41
-            "data_url" => null,
42
-        ]);
43
-    }
34
+				/**
35
+				 * @param OptionsResolver $resolver
36
+				 */
37
+				public function configureOptions(OptionsResolver $resolver)
38
+				{
39
+								$resolver->setDefaults([
40
+												"autocomplete_name" => null,
41
+												"data_url" => null,
42
+								]);
43
+				}
44 44
 }
Please login to merge, or discard this patch.
Form/User.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 		$this->tokenStorage = $tokenStorage;
35 35
 	}
36 36
 
37
-    /**
38
-     * @param FormBuilderInterface $builder
39
-     * @param array $options
40
-     */
37
+				/**
38
+				 * @param FormBuilderInterface $builder
39
+				 * @param array $options
40
+				 */
41 41
 	public function buildForm(FormBuilderInterface $builder, array $options)
42 42
 	{
43 43
 		$access_rights_lists = $this->em->getRepository(\PiouPiou\RibsAdminBundle\Entity\AccessRight::class)->findAll();
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
 			]);
71 71
 	}
72 72
 
73
-    /**
74
-     * @param OptionsResolver $resolver
75
-     */
73
+				/**
74
+				 * @param OptionsResolver $resolver
75
+				 */
76 76
 	public function configureOptions(OptionsResolver $resolver)
77 77
 	{
78 78
 		$resolver->setDefaults([
Please login to merge, or discard this patch.