Passed
Push — master ( 6642fd...642c1d )
by Anthony
03:37
created
Controller/AccessRightsController.php 1 patch
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -13,120 +13,120 @@
 block discarded – undo
13 13
 
14 14
 class AccessRightsController extends AbstractController
15 15
 {
16
-    /**
17
-     * @Route("/access-rights-management/", name="ribsadmin_access_rights")
18
-     * @return Response
19
-     */
20
-    public function list(): Response
21
-    {
22
-        $em = $this->getDoctrine()->getManager();
23
-        $acces_right = $em->getRepository("RibsAdminBundle:AccessRight")->findAll();
24
-
25
-        return $this->render("@RibsAdmin/access-rights/list.html.twig", [
26
-            "access_right" => $acces_right
27
-        ]);
28
-    }
29
-
30
-    /**
31
-     * @Route("/access-rights-management/create/", name="ribsadmin_access_rights_create")
32
-     * @Route("/access-rights-management/show/{guid}", name="ribsadmin_access_rights_show")
33
-     * @Route("/access-rights-management/edit/{guid}", name="ribsadmin_access_rights_edit")
34
-     * @param Request $request
35
-     * @param Globals $globals
36
-     * @param ModuleService $module
37
-     * @param string|null $guid
38
-     * @return Response
39
-     */
40
-    public function edit(Request $request, Globals $globals, ModuleService $module, string $guid = null): Response
41
-    {
42
-        $em = $this->getDoctrine()->getManager();
43
-        $list_rights_user = [];
44
-        $disabled_form = strpos($request->get("_route"), "_show") ? true : false;
45
-
46
-        if ($guid === null) {
47
-            $access_right = new AccessRight();
48
-        } else {
49
-            $access_right = $em->getRepository("RibsAdminBundle:AccessRight")->findOneBy(["guid" => $guid]);
50
-            $list_rights_user = explode(",", $access_right->getAccessRights());
51
-        }
52
-
53
-        $admins = $em->getRepository("RibsAdminBundle:User")->findBy(["admin" => true, "archived" => false]);
54
-
55
-        $form = $this->createForm("PiouPiou\RibsAdminBundle\Form\AccessRight", $access_right, ["disabled" => $disabled_form]);
56
-        $form->handleRequest($request);
57
-
58
-        if ($form->isSubmitted() && $form->isValid()) {
59
-            return $this->handleEditForm($request, $access_right);
60
-        }
61
-
62
-        return $this->render("@RibsAdmin/access-rights/edit.html.twig", [
63
-            "access_right" => $access_right,
64
-            "form" => $form->createView(),
65
-            "form_errors" => $form->getErrors(),
66
-            "list_rights_user" => $list_rights_user,
67
-            "admins" => $admins,
68
-            "ribs_admin_rights" => json_decode(file_get_contents($globals->getBaseBundlePath() . "/Resources/json/ribsadmin_rights.json")),
69
-            "modules" => $module->getAllInfosModules(),
70
-            "disabled_form" => $disabled_form
71
-        ]);
72
-    }
73
-
74
-    /**
75
-     * @Route("/access-rights-management/delete/{guid}", name="ribsadmin_access_rights_delete")
76
-     * @param string $guid
77
-     * @return RedirectResponse function that delete an access right list
78
-     */
79
-    public function delete(string $guid): RedirectResponse
80
-    {
81
-        $em = $this->getDoctrine()->getManager();
82
-        $list = $em->getRepository("RibsAdminBundle:AccessRight")->findOneBy(["guid" => $guid]);
83
-
84
-        if ($list) {
85
-            foreach ($list->getUsers() as $user) {
86
-                $user->setAccessRightList(null);
87
-            }
88
-
89
-            $em->remove($list);
90
-            $em->flush();
91
-
92
-            $this->addFlash("success-flash", "The right list was deleted");
93
-        } else {
94
-            $this->addFlash("error-flash", "The right list wasn't found");
95
-        }
96
-
97
-        return $this->redirectToRoute("ribsadmin_access_rights");
98
-    }
99
-
100
-    /**
101
-     * @param Request $request
102
-     * @param AccessRight $access_right
103
-     * @return RedirectResponse function that handle the form request
104
-     */
105
-    private function handleEditForm(Request $request, AccessRight $access_right): RedirectResponse
106
-    {
107
-        $em = $this->getDoctrine()->getManager();
108
-
109
-        if ($request->get("right") === null) {
110
-            $rights = "";
111
-        } else {
112
-            $rights = implode(",", $request->get("right"));
113
-        }
114
-
115
-        $access_right->setAccessRights($rights);
116
-        $em->persist($access_right);
117
-        $em->flush();
118
-
119
-        $em->getRepository("RibsAdminBundle:AccessRight")->deleteAllUsersList($access_right);
120
-        $admins = $request->get("admins");
121
-
122
-        if ($admins !== null) {
123
-            foreach ($admins as $admin) {
124
-                $em->getRepository("RibsAdminBundle:AccessRight")->setAccessRightListUser($access_right->getId(), $admin);
125
-            }
126
-        }
127
-
128
-        $this->addFlash("success-flash", "The right list was correctly edited");
129
-
130
-        return $this->redirectToRoute("ribsadmin_access_rights");
131
-    }
16
+				/**
17
+				 * @Route("/access-rights-management/", name="ribsadmin_access_rights")
18
+				 * @return Response
19
+				 */
20
+				public function list(): Response
21
+				{
22
+								$em = $this->getDoctrine()->getManager();
23
+								$acces_right = $em->getRepository("RibsAdminBundle:AccessRight")->findAll();
24
+
25
+								return $this->render("@RibsAdmin/access-rights/list.html.twig", [
26
+												"access_right" => $acces_right
27
+								]);
28
+				}
29
+
30
+				/**
31
+				 * @Route("/access-rights-management/create/", name="ribsadmin_access_rights_create")
32
+				 * @Route("/access-rights-management/show/{guid}", name="ribsadmin_access_rights_show")
33
+				 * @Route("/access-rights-management/edit/{guid}", name="ribsadmin_access_rights_edit")
34
+				 * @param Request $request
35
+				 * @param Globals $globals
36
+				 * @param ModuleService $module
37
+				 * @param string|null $guid
38
+				 * @return Response
39
+				 */
40
+				public function edit(Request $request, Globals $globals, ModuleService $module, string $guid = null): Response
41
+				{
42
+								$em = $this->getDoctrine()->getManager();
43
+								$list_rights_user = [];
44
+								$disabled_form = strpos($request->get("_route"), "_show") ? true : false;
45
+
46
+								if ($guid === null) {
47
+												$access_right = new AccessRight();
48
+								} else {
49
+												$access_right = $em->getRepository("RibsAdminBundle:AccessRight")->findOneBy(["guid" => $guid]);
50
+												$list_rights_user = explode(",", $access_right->getAccessRights());
51
+								}
52
+
53
+								$admins = $em->getRepository("RibsAdminBundle:User")->findBy(["admin" => true, "archived" => false]);
54
+
55
+								$form = $this->createForm("PiouPiou\RibsAdminBundle\Form\AccessRight", $access_right, ["disabled" => $disabled_form]);
56
+								$form->handleRequest($request);
57
+
58
+								if ($form->isSubmitted() && $form->isValid()) {
59
+												return $this->handleEditForm($request, $access_right);
60
+								}
61
+
62
+								return $this->render("@RibsAdmin/access-rights/edit.html.twig", [
63
+												"access_right" => $access_right,
64
+												"form" => $form->createView(),
65
+												"form_errors" => $form->getErrors(),
66
+												"list_rights_user" => $list_rights_user,
67
+												"admins" => $admins,
68
+												"ribs_admin_rights" => json_decode(file_get_contents($globals->getBaseBundlePath() . "/Resources/json/ribsadmin_rights.json")),
69
+												"modules" => $module->getAllInfosModules(),
70
+												"disabled_form" => $disabled_form
71
+								]);
72
+				}
73
+
74
+				/**
75
+				 * @Route("/access-rights-management/delete/{guid}", name="ribsadmin_access_rights_delete")
76
+				 * @param string $guid
77
+				 * @return RedirectResponse function that delete an access right list
78
+				 */
79
+				public function delete(string $guid): RedirectResponse
80
+				{
81
+								$em = $this->getDoctrine()->getManager();
82
+								$list = $em->getRepository("RibsAdminBundle:AccessRight")->findOneBy(["guid" => $guid]);
83
+
84
+								if ($list) {
85
+												foreach ($list->getUsers() as $user) {
86
+																$user->setAccessRightList(null);
87
+												}
88
+
89
+												$em->remove($list);
90
+												$em->flush();
91
+
92
+												$this->addFlash("success-flash", "The right list was deleted");
93
+								} else {
94
+												$this->addFlash("error-flash", "The right list wasn't found");
95
+								}
96
+
97
+								return $this->redirectToRoute("ribsadmin_access_rights");
98
+				}
99
+
100
+				/**
101
+				 * @param Request $request
102
+				 * @param AccessRight $access_right
103
+				 * @return RedirectResponse function that handle the form request
104
+				 */
105
+				private function handleEditForm(Request $request, AccessRight $access_right): RedirectResponse
106
+				{
107
+								$em = $this->getDoctrine()->getManager();
108
+
109
+								if ($request->get("right") === null) {
110
+												$rights = "";
111
+								} else {
112
+												$rights = implode(",", $request->get("right"));
113
+								}
114
+
115
+								$access_right->setAccessRights($rights);
116
+								$em->persist($access_right);
117
+								$em->flush();
118
+
119
+								$em->getRepository("RibsAdminBundle:AccessRight")->deleteAllUsersList($access_right);
120
+								$admins = $request->get("admins");
121
+
122
+								if ($admins !== null) {
123
+												foreach ($admins as $admin) {
124
+																$em->getRepository("RibsAdminBundle:AccessRight")->setAccessRightListUser($access_right->getId(), $admin);
125
+												}
126
+								}
127
+
128
+								$this->addFlash("success-flash", "The right list was correctly edited");
129
+
130
+								return $this->redirectToRoute("ribsadmin_access_rights");
131
+				}
132 132
 }
Please login to merge, or discard this patch.
Controller/AccountsController.php 2 patches
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -12,129 +12,129 @@
 block discarded – undo
12 12
 
13 13
 class AccountsController extends AbstractController
14 14
 {
15
-    /**
16
-     * @Route("/accounts/", name="ribsadmin_accounts")
17
-     * @return Response
18
-     */
19
-    public function list(): Response
20
-    {
21
-        $em = $this->getDoctrine()->getManager();
22
-        $current_account = $this->getUser()->getUser();
23
-
24
-        $users = $em->getRepository("RibsAdminBundle:Account")->findAllUserArchived($current_account);
25
-        $users_archived = $em->getRepository("RibsAdminBundle:Account")->findAllUserArchived($current_account, true);
26
-
27
-        return $this->render('@RibsAdmin/accounts/list.html.twig', [
28
-            "users" => $users,
29
-            "users_archived" => $users_archived
30
-        ]);
31
-    }
32
-
33
-    /**
34
-     * @Route("/accounts/create/", name="ribsadmin_accounts_create")
35
-     * @Route("/accounts/show/{guid}", name="ribsadmin_accounts_show")
36
-     * @Route("/accounts/edit/{guid}", name="ribsadmin_accounts_edit")
37
-     * @param Request $request
38
-     * @param string|null $guid
39
-     * @return Response
40
-     */
41
-    public function edit(Request $request, string $guid = null): Response
42
-    {
43
-        $em = $this->getDoctrine()->getManager();
44
-        $disabled_form = strpos($request->get("_route"), "_show") ? true : false;
45
-
46
-        if ($guid === null) {
47
-            $account = new Account();
48
-            $old_password = null;
49
-            $user = null;
50
-        } else {
51
-            $user = $em->getRepository(User::class)->findOneBy(["guid" => $guid]);
52
-            $account = $em->getRepository(Account::class)->findOneBy(["user" => $user->getId()]);
53
-            $old_password = $account->getPassword();
54
-        }
55
-
56
-        $form = $this->createForm("PiouPiou\RibsAdminBundle\Form\Account", $account,  ["disabled" => $disabled_form]);
57
-
58
-        $form->handleRequest($request);
59
-
60
-        if ($form->isSubmitted() && $form->isValid()) {
61
-            /**
62
-             * @var Account
63
-             */
64
-            $data = $form->getData();
65
-
66
-            $account_exist = $em->getRepository(Account::class)->findOneBy(["username" => $data->getUsername()]);
67
-
68
-            if ($account_exist && $account_exist === $account) {
69
-                $account_exist = null;
70
-            }
71
-
72
-            if (!$account_exist) {
73
-                if ($guid === null) {
74
-                    $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData());
75
-                    $data->setPassword($temp_password);
76
-                } else if ($form->get("password")->getData()) {
77
-                    $temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData());
78
-                    $data->setPassword($temp_password);
79
-                } else {
80
-                    $data->setPassword($old_password);
81
-                }
82
-
83
-                $em->persist($data);
84
-                $em->flush();
85
-
86
-                $username = $data->getUser()->getFirstName() . " " . $data->getUser()->getLastName();
87
-
88
-                if ($guid === null) {
89
-                    $this->addFlash("success-flash", "the account of " . $username . " was created");
90
-                } else {
91
-                    $this->addFlash("success-flash", "the account of " . $username . " was edited");
92
-                }
93
-
94
-                return $this->redirectToRoute("ribsadmin_accounts");
95
-            } else {
96
-                $this->addFlash("error-flash", "An account with username " . $data->getUsername() . " already exist");
97
-                return $this->redirectToRoute($request->get("_route"), ["guid" => $guid]);
98
-            }
99
-        }
100
-
101
-        return $this->render("@RibsAdmin/accounts/edit.html.twig", [
102
-            "form" => $form->createView(),
103
-            "form_errors" => $form->getErrors(),
104
-            "user" => $user,
105
-            "disabled_form" => $disabled_form
106
-        ]);
107
-    }
108
-
109
-    /**
110
-     * method to disable or enable a user
111
-     * @Route("/accounts/archive/{guid}/{activate}", name="ribsadmin_accounts_archive")
112
-     * @param string $guid
113
-     * @param bool $activate
114
-     * @return RedirectResponse
115
-     */
116
-    public function archive(string $guid, bool $activate = false): RedirectResponse
117
-    {
118
-        $em = $this->getDoctrine()->getManager();
119
-
120
-        $user = $em->getRepository("RibsAdminBundle:User")->findOneBy(["guid" => $guid]);
121
-
122
-        if ($user) {
123
-            if ($activate === true) {
124
-                $user->setArchived(false);
125
-                $word = "activated";
126
-            } else {
127
-                $user->setArchived(true);
128
-                $word = "disabled";
129
-            }
130
-
131
-            $em->persist($user);
132
-            $em->flush();
133
-
134
-            $this->addFlash("success-flash", "The user " . $user->getFirstname() . " " . $user->getLastname() .
135
-                " was " . $word . " sucessfuly");
136
-        }
137
-
138
-        return $this->redirectToRoute("ribsadmin_accounts");
139
-    }
15
+				/**
16
+				 * @Route("/accounts/", name="ribsadmin_accounts")
17
+				 * @return Response
18
+				 */
19
+				public function list(): Response
20
+				{
21
+								$em = $this->getDoctrine()->getManager();
22
+								$current_account = $this->getUser()->getUser();
23
+
24
+								$users = $em->getRepository("RibsAdminBundle:Account")->findAllUserArchived($current_account);
25
+								$users_archived = $em->getRepository("RibsAdminBundle:Account")->findAllUserArchived($current_account, true);
26
+
27
+								return $this->render('@RibsAdmin/accounts/list.html.twig', [
28
+												"users" => $users,
29
+												"users_archived" => $users_archived
30
+								]);
31
+				}
32
+
33
+				/**
34
+				 * @Route("/accounts/create/", name="ribsadmin_accounts_create")
35
+				 * @Route("/accounts/show/{guid}", name="ribsadmin_accounts_show")
36
+				 * @Route("/accounts/edit/{guid}", name="ribsadmin_accounts_edit")
37
+				 * @param Request $request
38
+				 * @param string|null $guid
39
+				 * @return Response
40
+				 */
41
+				public function edit(Request $request, string $guid = null): Response
42
+				{
43
+								$em = $this->getDoctrine()->getManager();
44
+								$disabled_form = strpos($request->get("_route"), "_show") ? true : false;
45
+
46
+								if ($guid === null) {
47
+												$account = new Account();
48
+												$old_password = null;
49
+												$user = null;
50
+								} else {
51
+												$user = $em->getRepository(User::class)->findOneBy(["guid" => $guid]);
52
+												$account = $em->getRepository(Account::class)->findOneBy(["user" => $user->getId()]);
53
+												$old_password = $account->getPassword();
54
+								}
55
+
56
+								$form = $this->createForm("PiouPiou\RibsAdminBundle\Form\Account", $account,  ["disabled" => $disabled_form]);
57
+
58
+								$form->handleRequest($request);
59
+
60
+								if ($form->isSubmitted() && $form->isValid()) {
61
+												/**
62
+												 * @var Account
63
+												 */
64
+												$data = $form->getData();
65
+
66
+												$account_exist = $em->getRepository(Account::class)->findOneBy(["username" => $data->getUsername()]);
67
+
68
+												if ($account_exist && $account_exist === $account) {
69
+																$account_exist = null;
70
+												}
71
+
72
+												if (!$account_exist) {
73
+																if ($guid === null) {
74
+																				$temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData());
75
+																				$data->setPassword($temp_password);
76
+																} else if ($form->get("password")->getData()) {
77
+																				$temp_password = $this->get("security.password_encoder")->encodePassword($data, $form->get("password")->getData());
78
+																				$data->setPassword($temp_password);
79
+																} else {
80
+																				$data->setPassword($old_password);
81
+																}
82
+
83
+																$em->persist($data);
84
+																$em->flush();
85
+
86
+																$username = $data->getUser()->getFirstName() . " " . $data->getUser()->getLastName();
87
+
88
+																if ($guid === null) {
89
+																				$this->addFlash("success-flash", "the account of " . $username . " was created");
90
+																} else {
91
+																				$this->addFlash("success-flash", "the account of " . $username . " was edited");
92
+																}
93
+
94
+																return $this->redirectToRoute("ribsadmin_accounts");
95
+												} else {
96
+																$this->addFlash("error-flash", "An account with username " . $data->getUsername() . " already exist");
97
+																return $this->redirectToRoute($request->get("_route"), ["guid" => $guid]);
98
+												}
99
+								}
100
+
101
+								return $this->render("@RibsAdmin/accounts/edit.html.twig", [
102
+												"form" => $form->createView(),
103
+												"form_errors" => $form->getErrors(),
104
+												"user" => $user,
105
+												"disabled_form" => $disabled_form
106
+								]);
107
+				}
108
+
109
+				/**
110
+				 * method to disable or enable a user
111
+				 * @Route("/accounts/archive/{guid}/{activate}", name="ribsadmin_accounts_archive")
112
+				 * @param string $guid
113
+				 * @param bool $activate
114
+				 * @return RedirectResponse
115
+				 */
116
+				public function archive(string $guid, bool $activate = false): RedirectResponse
117
+				{
118
+								$em = $this->getDoctrine()->getManager();
119
+
120
+								$user = $em->getRepository("RibsAdminBundle:User")->findOneBy(["guid" => $guid]);
121
+
122
+								if ($user) {
123
+												if ($activate === true) {
124
+																$user->setArchived(false);
125
+																$word = "activated";
126
+												} else {
127
+																$user->setArchived(true);
128
+																$word = "disabled";
129
+												}
130
+
131
+												$em->persist($user);
132
+												$em->flush();
133
+
134
+												$this->addFlash("success-flash", "The user " . $user->getFirstname() . " " . $user->getLastname() .
135
+																" was " . $word . " sucessfuly");
136
+								}
137
+
138
+								return $this->redirectToRoute("ribsadmin_accounts");
139
+				}
140 140
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
             $old_password = $account->getPassword();
54 54
         }
55 55
 
56
-        $form = $this->createForm("PiouPiou\RibsAdminBundle\Form\Account", $account,  ["disabled" => $disabled_form]);
56
+        $form = $this->createForm("PiouPiou\RibsAdminBundle\Form\Account", $account, ["disabled" => $disabled_form]);
57 57
 
58 58
         $form->handleRequest($request);
59 59
 
Please login to merge, or discard this patch.
Repository/NavigationRepository.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -7,38 +7,38 @@
 block discarded – undo
7 7
 
8 8
 class NavigationRepository extends EntityRepository
9 9
 {
10
-    /**
11
-     * function that return all navigation links of pages and modules
12
-     * @return array
13
-     * @throws DBALException
14
-     */
15
-    public function findAllNavigation(): array
16
-    {
17
-        $query = $this->getEntityManager()->getConnection()->prepare("SELECT p.url, p.title, p.title_tag FROM navigation n
10
+				/**
11
+				 * function that return all navigation links of pages and modules
12
+				 * @return array
13
+				 * @throws DBALException
14
+				 */
15
+				public function findAllNavigation(): array
16
+				{
17
+								$query = $this->getEntityManager()->getConnection()->prepare("SELECT p.url, p.title, p.title_tag FROM navigation n
18 18
 			LEFT JOIN page p ON n.id_page = p.id AND p.displayed = 1
19 19
 			LEFT JOIN module m ON n.id_module = m.id AND m.displayed = 1
20 20
 		  	ORDER BY n.order ASC
21 21
  		");
22 22
 
23
-        $query->execute();
23
+								$query->execute();
24 24
 
25
-        return $query->fetchAll(\PDO::FETCH_ASSOC);
26
-    }
25
+								return $query->fetchAll(\PDO::FETCH_ASSOC);
26
+				}
27 27
 
28
-    /**
29
-     * function that return all navigation links of pages
30
-     * @return array
31
-     * @throws DBALException
32
-     */
33
-    public function findAllNavigationPage(): array
34
-    {
35
-        $query = $this->getEntityManager()->getConnection()->prepare("SELECT p.id, p.url, p.title, p.title_tag FROM navigation n
28
+				/**
29
+				 * function that return all navigation links of pages
30
+				 * @return array
31
+				 * @throws DBALException
32
+				 */
33
+				public function findAllNavigationPage(): array
34
+				{
35
+								$query = $this->getEntityManager()->getConnection()->prepare("SELECT p.id, p.url, p.title, p.title_tag FROM navigation n
36 36
 			INNER JOIN page p ON n.id_page = p.id AND p.displayed = 1
37 37
 		  	ORDER BY n.order ASC
38 38
  		");
39 39
 
40
-        $query->execute();
40
+								$query->execute();
41 41
 
42
-        return $query->fetchAll(\PDO::FETCH_ASSOC);
43
-    }
42
+								return $query->fetchAll(\PDO::FETCH_ASSOC);
43
+				}
44 44
 }
Please login to merge, or discard this patch.
Controller/PageController.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -8,28 +8,28 @@
 block discarded – undo
8 8
 
9 9
 class PageController extends AbstractController
10 10
 {
11
-    /**
12
-     * @Route("/contents", name="ribsadmin_contents")
13
-     * @return Response
14
-     */
15
-    public function index(): Response
16
-    {
17
-        $navigation = $this->getDoctrine()->getManager()->getRepository("RibsAdminBundle:Navigation")->findAllNavigationPage();
11
+				/**
12
+				 * @Route("/contents", name="ribsadmin_contents")
13
+				 * @return Response
14
+				 */
15
+				public function index(): Response
16
+				{
17
+								$navigation = $this->getDoctrine()->getManager()->getRepository("RibsAdminBundle:Navigation")->findAllNavigationPage();
18 18
 
19
-        return $this->render('@RibsAdmin/page/index.html.twig', ["navigation" => $navigation]);
20
-    }
19
+								return $this->render('@RibsAdmin/page/index.html.twig', ["navigation" => $navigation]);
20
+				}
21 21
 
22
-    /**
23
-     * @Route("/contents/edit-page/{page_id}", name="ribsadmin_contents_edit_page")
24
-     * @param int $page_id
25
-     * @return Response
26
-     */
27
-    public function editPage(int $page_id): Response
28
-    {
29
-        $em = $this->getDoctrine()->getManager();
30
-        $navigation = $em->getRepository("RibsAdminBundle:Navigation")->findAllNavigationPage();
31
-        $page = $em->getRepository("RibsAdminBundle:Page")->find($page_id);
22
+				/**
23
+				 * @Route("/contents/edit-page/{page_id}", name="ribsadmin_contents_edit_page")
24
+				 * @param int $page_id
25
+				 * @return Response
26
+				 */
27
+				public function editPage(int $page_id): Response
28
+				{
29
+								$em = $this->getDoctrine()->getManager();
30
+								$navigation = $em->getRepository("RibsAdminBundle:Navigation")->findAllNavigationPage();
31
+								$page = $em->getRepository("RibsAdminBundle:Page")->find($page_id);
32 32
 
33
-        return $this->render('@RibsAdmin/page/edit-page.html.twig', ["navigation" => $navigation, "page" => $page]);
34
-    }
33
+								return $this->render('@RibsAdmin/page/edit-page.html.twig', ["navigation" => $navigation, "page" => $page]);
34
+				}
35 35
 }
Please login to merge, or discard this patch.
Service/AccessRights.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
 		
97 97
 		$ribs_admin_rights = json_decode(file_get_contents($this->globals->getBaseBundlePath() . "/Resources/json/ribsadmin_rights.json"));
98 98
 		$modules_rights = $this->module->getModuleRights();
99
-		$ribs_admin_rights = (object)array_merge((array)$ribs_admin_rights, (array)$modules_rights);
99
+		$ribs_admin_rights = (object) array_merge((array) $ribs_admin_rights, (array) $modules_rights);
100 100
 
101 101
         if ($this->testIsOpenUrl($route)) {
102 102
             return;
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	private $module;
45 45
 
46
-    /**
47
-     * @var Api
48
-     */
49
-    private $api;
46
+				/**
47
+				 * @var Api
48
+				 */
49
+				private $api;
50 50
 	
51 51
 	/**
52 52
 	 * @var User
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
 	/** @var TokenStorageInterface */
57 57
 	private $token_storage;
58 58
 
59
-    /**
60
-     * AccessRights constructor.
61
-     * @param ContainerInterface $container
62
-     * @param RouterInterface $router
63
-     * @param SessionInterface $session
64
-     * @param RequestStack $request
65
-     * @param TokenStorageInterface $tokenStorage
66
-     * @param Globals $globals
67
-     * @param ModuleService $module
68
-     * @param Api $api
69
-     */
59
+				/**
60
+				 * AccessRights constructor.
61
+				 * @param ContainerInterface $container
62
+				 * @param RouterInterface $router
63
+				 * @param SessionInterface $session
64
+				 * @param RequestStack $request
65
+				 * @param TokenStorageInterface $tokenStorage
66
+				 * @param Globals $globals
67
+				 * @param ModuleService $module
68
+				 * @param Api $api
69
+				 */
70 70
 	public function __construct(ContainerInterface $container, RouterInterface $router, SessionInterface $session, RequestStack $request, TokenStorageInterface $tokenStorage, Globals $globals, ModuleService $module, Api $api)
71 71
 	{
72 72
 		$this->container = $container;
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 		$this->api = $api;
79 79
 		$this->token_storage = $tokenStorage;
80 80
 		if ($this->token_storage->getToken() && is_object($this->token_storage->getToken()->getUser()) && $this->token_storage->getToken()->getUser()->getUser()) {
81
-            $this->user = $this->token_storage->getToken()->getUser()->getUser();
82
-        }
81
+												$this->user = $this->token_storage->getToken()->getUser()->getUser();
82
+								}
83 83
 	}
84 84
 	
85 85
 	public function onKernelController()
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 		$modules_rights = $this->module->getModuleRights();
99 99
 		$ribs_admin_rights = (object)array_merge((array)$ribs_admin_rights, (array)$modules_rights);
100 100
 
101
-        if ($this->testIsOpenUrl($route)) {
102
-            return;
103
-        }
101
+								if ($this->testIsOpenUrl($route)) {
102
+												return;
103
+								}
104 104
 
105 105
 		if ($admin_page == "ribsadmin" && !$api && strpos($route, "login") === false && strpos($route, "register") === false) {
106 106
 			//redirection if user not connected
@@ -124,25 +124,25 @@  discard block
 block discarded – undo
124 124
 			
125 125
 			throw new AccessDeniedException("No access");
126 126
 		} else if ($api && strpos($route, "login") === false && strpos($route, "register") === false) {
127
-            if ($this->api->userIslogged($this->request->getCurrentRequest()->get("infos"), $this->request->getCurrentRequest()->get("token")) === false) {
128
-                throw new AccessDeniedException("User is not connected");
129
-            }
130
-        }
127
+												if ($this->api->userIslogged($this->request->getCurrentRequest()->get("infos"), $this->request->getCurrentRequest()->get("token")) === false) {
128
+																throw new AccessDeniedException("User is not connected");
129
+												}
130
+								}
131 131
 	}
132 132
 
133 133
 	private function testIsOpenUrl($route)
134
-    {
135
-        $open_urls = json_decode(file_get_contents($this->globals->getBaseBundlePath() . "/Resources/json/ribsadmin_open_url.json"), true);
134
+				{
135
+								$open_urls = json_decode(file_get_contents($this->globals->getBaseBundlePath() . "/Resources/json/ribsadmin_open_url.json"), true);
136 136
 
137
-        if ($open_urls && $open_urls["items"] && in_array($route, $open_urls["items"])) {
138
-            return true;
139
-        }
137
+								if ($open_urls && $open_urls["items"] && in_array($route, $open_urls["items"])) {
138
+												return true;
139
+								}
140 140
 
141
-        return false;
142
-    }
141
+								return false;
142
+				}
143 143
 	
144 144
 	/**
145
-     * function that allow to test a right directly in the view
145
+	 * function that allow to test a right directly in the view
146 146
 	 * @param string $right
147 147
 	 * @return bool
148 148
 	 */
@@ -153,9 +153,9 @@  discard block
 block discarded – undo
153 153
 		
154 154
 		$all_rights = array_merge($user_rights, $list_rights);
155 155
 
156
-        if (in_array("*", $all_rights)) {
157
-            return true;
158
-        }
156
+								if (in_array("*", $all_rights)) {
157
+												return true;
158
+								}
159 159
 
160 160
 		if (in_array($right, $all_rights)) {
161 161
 			return true;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	}
166 166
 	
167 167
 	/**
168
-     * test if route_right is found in users rights
168
+	 * test if route_right is found in users rights
169 169
 	 * @param array $route_right
170 170
 	 * @return bool
171 171
 	 */
@@ -177,8 +177,8 @@  discard block
 block discarded – undo
177 177
 		$all_rights = array_merge($user_rights, $list_rights);
178 178
 
179 179
 		if (in_array("*", $all_rights)) {
180
-		    return true;
181
-        }
180
+						return true;
181
+								}
182 182
 
183 183
 		foreach ($all_rights as $right) {
184 184
 			if (in_array($right, $route_right)) {
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	}
191 191
 	
192 192
 	/**
193
-     * function that search if the right contain an url or more
193
+	 * function that search if the right contain an url or more
194 194
 	 * @param $needle
195 195
 	 * @param $haystack
196 196
 	 * @return bool|mixed
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 		$it = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($haystack));
202 202
 		
203 203
 		foreach ($it AS $element => $value) {
204
-		    if (strpos($value, ", ") !== false) {
205
-		        if (in_array($needle, $explode = explode(", ", $value))) {
206
-                    $value = $needle;
207
-                }
208
-            }
204
+						if (strpos($value, ", ") !== false) {
205
+										if (in_array($needle, $explode = explode(", ", $value))) {
206
+																				$value = $needle;
207
+																}
208
+												}
209 209
 
210 210
 			if ($value == $needle) {
211 211
 				$rights[] = $it->getInnerIterator()["right"];
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	}
221 221
 	
222 222
 	/**
223
-     * function that retun a array that contain all user rights or empty array if no right found
223
+	 * function that retun a array that contain all user rights or empty array if no right found
224 224
 	 * @return array
225 225
 	 */
226 226
 	private function getUserRights(): array
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	}
236 236
 	
237 237
 	/**
238
-     * function that retun a array that contain all rights of rattached list right of the current user
238
+	 * function that retun a array that contain all rights of rattached list right of the current user
239 239
 	 * @return array
240 240
 	 */
241 241
 	private function getRightsListOfUser(): array
Please login to merge, or discard this patch.
Form/Package.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@  discard block
 block discarded – undo
11 11
 
12 12
 class Package extends AbstractType
13 13
 {
14
-    /**
15
-     * @param FormBuilderInterface $builder
16
-     * @param array $options
17
-     */
14
+				/**
15
+				 * @param FormBuilderInterface $builder
16
+				 * @param array $options
17
+				 */
18 18
 	public function buildForm(FormBuilderInterface $builder, array $options)
19 19
 	{
20 20
 		$builder
@@ -25,33 +25,33 @@  discard block
 block discarded – undo
25 25
 				"label" => "Project url",
26 26
 				"required" => true
27 27
 			])
28
-            ->add("packageName", TextType::class, [
29
-                "label" => "Package name"
30
-            ])
31
-            ->add("checkVersionUrl", TextType::class, [
32
-                "label" => "Check version url",
33
-                "required" => false
34
-            ])
35
-            ->add("composerLockUrl", TextType::class, [
36
-                "label" => "Check composer.lock url",
37
-                "required" => false
38
-            ])
39
-            ->add('isLocal', CheckboxType::class, [
40
-                'label' => 'Is local project',
41
-                'attr' => [
42
-                    'class' => 'ribs-checkbox switched'
43
-                ],
44
-                'required' => false
45
-            ])
46
-            ->add('submit', SubmitType::class, [
47
-                'label' => 'Validate',
48
-                'attr' => []
49
-            ]);
28
+												->add("packageName", TextType::class, [
29
+																"label" => "Package name"
30
+												])
31
+												->add("checkVersionUrl", TextType::class, [
32
+																"label" => "Check version url",
33
+																"required" => false
34
+												])
35
+												->add("composerLockUrl", TextType::class, [
36
+																"label" => "Check composer.lock url",
37
+																"required" => false
38
+												])
39
+												->add('isLocal', CheckboxType::class, [
40
+																'label' => 'Is local project',
41
+																'attr' => [
42
+																				'class' => 'ribs-checkbox switched'
43
+																],
44
+																'required' => false
45
+												])
46
+												->add('submit', SubmitType::class, [
47
+																'label' => 'Validate',
48
+																'attr' => []
49
+												]);
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.
Entity/Package.php 1 patch
Indentation   +315 added lines, -315 removed lines patch added patch discarded remove patch
@@ -15,326 +15,326 @@
 block discarded – undo
15 15
  */
16 16
 class Package
17 17
 {
18
-    use GuidTrait;
19
-    use CreatedUpdatedTrait;
20
-
21
-    /**
22
-     * @var integer
23
-     *
24
-     * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true})
25
-     * @ORM\Id
26
-     * @ORM\GeneratedValue(strategy="IDENTITY")
27
-     */
28
-    private $id;
29
-
30
-    /**
31
-     * @var string
32
-     *
33
-     * @ORM\Column(name="project_name", type="string", length=255, nullable=false)
34
-     */
35
-    private $project_name;
36
-
37
-    /**
38
-     * @var string
39
-     *
40
-     * @ORM\Column(name="package_name", type="string", length=255, nullable=false)
41
-     */
42
-    private $package_name;
43
-
44
-    /**
45
-     * @var string
46
-     *
47
-     * @ORM\Column(name="project_url", type="string", length=255, nullable=false)
48
-     */
49
-    private $project_url;
50
-
51
-    /**
52
-     * @var string
53
-     *
54
-     * @ORM\Column(name="version", type="string", length=255, nullable=true)
55
-     */
56
-    private $version;
57
-
58
-    /**
59
-     * @var string
60
-     *
61
-     * @ORM\Column(name="last_packagist_version", type="string", length=255, nullable=true)
62
-     */
63
-    private $last_packagist_version;
64
-
65
-    /**
66
-     * @var DateTime
67
-     *
68
-     * @ORM\Column(name="version_date", type="date", nullable=true)
69
-     */
70
-    private $version_date;
71
-
72
-    /**
73
-     * @var DateTime
74
-     *
75
-     * @ORM\Column(name="last_check", type="datetime", nullable=true)
76
-     */
77
-    private $last_check;
78
-
79
-    /**
80
-     * @var string
81
-     *
82
-     * @ORM\Column(name="mode", type="string", length=255, nullable=true)
83
-     */
84
-    private $mode;
18
+				use GuidTrait;
19
+				use CreatedUpdatedTrait;
20
+
21
+				/**
22
+				 * @var integer
23
+				 *
24
+				 * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true})
25
+				 * @ORM\Id
26
+				 * @ORM\GeneratedValue(strategy="IDENTITY")
27
+				 */
28
+				private $id;
29
+
30
+				/**
31
+				 * @var string
32
+				 *
33
+				 * @ORM\Column(name="project_name", type="string", length=255, nullable=false)
34
+				 */
35
+				private $project_name;
36
+
37
+				/**
38
+				 * @var string
39
+				 *
40
+				 * @ORM\Column(name="package_name", type="string", length=255, nullable=false)
41
+				 */
42
+				private $package_name;
43
+
44
+				/**
45
+				 * @var string
46
+				 *
47
+				 * @ORM\Column(name="project_url", type="string", length=255, nullable=false)
48
+				 */
49
+				private $project_url;
50
+
51
+				/**
52
+				 * @var string
53
+				 *
54
+				 * @ORM\Column(name="version", type="string", length=255, nullable=true)
55
+				 */
56
+				private $version;
57
+
58
+				/**
59
+				 * @var string
60
+				 *
61
+				 * @ORM\Column(name="last_packagist_version", type="string", length=255, nullable=true)
62
+				 */
63
+				private $last_packagist_version;
64
+
65
+				/**
66
+				 * @var DateTime
67
+				 *
68
+				 * @ORM\Column(name="version_date", type="date", nullable=true)
69
+				 */
70
+				private $version_date;
71
+
72
+				/**
73
+				 * @var DateTime
74
+				 *
75
+				 * @ORM\Column(name="last_check", type="datetime", nullable=true)
76
+				 */
77
+				private $last_check;
78
+
79
+				/**
80
+				 * @var string
81
+				 *
82
+				 * @ORM\Column(name="mode", type="string", length=255, nullable=true)
83
+				 */
84
+				private $mode;
85 85
 	
86 86
 	/**
87 87
 	 * @var string
88 88
 	 *
89 89
 	 * @ORM\Column(name="check_version_url", type="string", length=255, nullable=true)
90 90
 	 */
91
-    private $check_version_url;
92
-
93
-    /**
94
-     * @var string
95
-     *
96
-     * @ORM\Column(name="composer_lock_url", type="string", length=255, nullable=true)
97
-     */
98
-    private $composer_lock_url;
99
-
100
-    /**
101
-     * @var boolean
102
-     *
103
-     * @ORM\Column(name="is_local", type="boolean", nullable=false, options={"default": false}))
104
-     */
105
-    private $is_local;
106
-
107
-    /**
108
-     * @return int
109
-     */
110
-    public function getId(): int
111
-    {
112
-        return $this->id;
113
-    }
114
-
115
-    /**
116
-     * @param int $id
117
-     * @return Package
118
-     */
119
-    public function setId(int $id): self
120
-    {
121
-        $this->id = $id;
122
-
123
-        return $this;
124
-    }
125
-
126
-    /**
127
-     * @return string
128
-     */
129
-    public function getProjectName(): ?string
130
-    {
131
-        return $this->project_name;
132
-    }
133
-
134
-    /**
135
-     * @param string $project_name
136
-     * @return Package
137
-     */
138
-    public function setProjectName(string $project_name): self
139
-    {
140
-        $this->project_name = $project_name;
141
-
142
-        return $this;
143
-    }
144
-
145
-    /**
146
-     * @return string
147
-     */
148
-    public function getPackageName(): ?string
149
-    {
150
-        return $this->package_name;
151
-    }
152
-
153
-    /**
154
-     * @param string $package_name
155
-     * @return Package
156
-     */
157
-    public function setPackageName(string $package_name): self
158
-    {
159
-        $this->package_name = $package_name;
160
-
161
-        return $this;
162
-    }
163
-
164
-    /**
165
-     * @return string
166
-     */
167
-    public function getProjectUrl(): ?string
168
-    {
169
-        return $this->project_url;
170
-    }
171
-
172
-    /**
173
-     * @param string $project_url
174
-     * @return Package
175
-     */
176
-    public function setProjectUrl(string $project_url): self
177
-    {
178
-        $this->project_url = $project_url;
179
-
180
-        return $this;
181
-    }
182
-
183
-    /**
184
-     * @return string
185
-     */
186
-    public function getVersion(): ?string
187
-    {
188
-        return $this->version;
189
-    }
190
-
191
-    /**
192
-     * @param string $version
193
-     * @return Package
194
-     */
195
-    public function setVersion(?string $version): self
196
-    {
197
-        $this->version = $version;
198
-
199
-        return $this;
200
-    }
201
-
202
-    /**
203
-     * @return string
204
-     */
205
-    public function getLastPackagistVersion(): ?string
206
-    {
207
-        return $this->last_packagist_version;
208
-    }
209
-
210
-    /**
211
-     * @param string $last_packagist_version
212
-     * @return Package
213
-     */
214
-    public function setLastPackagistVersion(?string $last_packagist_version): self
215
-    {
216
-        $this->last_packagist_version = $last_packagist_version;
217
-
218
-        return $this;
219
-    }
220
-
221
-    /**
222
-     * @return DateTime
223
-     */
224
-    public function getVersionDate(): ?DateTime
225
-    {
226
-        return $this->version_date;
227
-    }
228
-
229
-    /**
230
-     * @param DateTime $version_date
231
-     * @return Package
232
-     */
233
-    public function setVersionDate(?DateTime $version_date): self
234
-    {
235
-        $this->version_date = $version_date;
236
-
237
-        return $this;
238
-    }
239
-
240
-    /**
241
-     * @return DateTime
242
-     */
243
-    public function getLastCheck(): ?DateTime
244
-    {
245
-        return $this->last_check;
246
-    }
247
-
248
-    /**
249
-     * @param DateTime $last_check
250
-     * @return Package
251
-     */
252
-    public function setLastCheck(DateTime $last_check): self
253
-    {
254
-        $this->last_check = $last_check;
255
-
256
-        return $this;
257
-    }
258
-
259
-    /**
260
-     * @return string
261
-     */
262
-    public function getMode(): ?string
263
-    {
264
-        return $this->mode;
265
-    }
266
-
267
-    /**
268
-     * @param string $mode
269
-     * @return Package
270
-     */
271
-    public function setMode(string $mode): self
272
-    {
273
-        $this->mode = $mode;
274
-
275
-        return $this;
276
-    }
277
-
278
-    /**
279
-     * @return string
280
-     */
281
-    public function getCheckVersionUrl(): ?string
282
-    {
283
-        return $this->check_version_url;
284
-    }
285
-
286
-    /**
287
-     * @param string|null $check_version_url
288
-     * @return Package
289
-     */
290
-    public function setCheckVersionUrl(?string $check_version_url): self
291
-    {
292
-        $this->check_version_url = $check_version_url;
293
-
294
-        return $this;
295
-    }
296
-
297
-    /**
298
-     * @return string
299
-     */
300
-    public function getComposerLockUrl(): ?string
301
-    {
302
-        return $this->composer_lock_url;
303
-    }
304
-
305
-    /**
306
-     * @param string|null $composer_lock_url
307
-     * @return Package
308
-     */
309
-    public function setComposerLockUrl(?string $composer_lock_url): self
310
-    {
311
-        $this->composer_lock_url = $composer_lock_url;
312
-
313
-        return $this;
314
-    }
315
-
316
-    /**
317
-     * @return bool
318
-     */
319
-    public function isIsLocal(): ?bool
320
-    {
321
-        return $this->is_local;
322
-    }
323
-
324
-    /**
325
-     * @param bool $is_local
326
-     * @return Package
327
-     */
328
-    public function setIsLocal(bool $is_local): self
329
-    {
330
-        $this->is_local = $is_local;
331
-
332
-        return $this;
333
-    }
334
-
335
-    public function getFormattedIsLocal()
336
-    {
337
-        return $this->isIsLocal() ? "Yes" : "No";
338
-    }
91
+				private $check_version_url;
92
+
93
+				/**
94
+				 * @var string
95
+				 *
96
+				 * @ORM\Column(name="composer_lock_url", type="string", length=255, nullable=true)
97
+				 */
98
+				private $composer_lock_url;
99
+
100
+				/**
101
+				 * @var boolean
102
+				 *
103
+				 * @ORM\Column(name="is_local", type="boolean", nullable=false, options={"default": false}))
104
+				 */
105
+				private $is_local;
106
+
107
+				/**
108
+				 * @return int
109
+				 */
110
+				public function getId(): int
111
+				{
112
+								return $this->id;
113
+				}
114
+
115
+				/**
116
+				 * @param int $id
117
+				 * @return Package
118
+				 */
119
+				public function setId(int $id): self
120
+				{
121
+								$this->id = $id;
122
+
123
+								return $this;
124
+				}
125
+
126
+				/**
127
+				 * @return string
128
+				 */
129
+				public function getProjectName(): ?string
130
+				{
131
+								return $this->project_name;
132
+				}
133
+
134
+				/**
135
+				 * @param string $project_name
136
+				 * @return Package
137
+				 */
138
+				public function setProjectName(string $project_name): self
139
+				{
140
+								$this->project_name = $project_name;
141
+
142
+								return $this;
143
+				}
144
+
145
+				/**
146
+				 * @return string
147
+				 */
148
+				public function getPackageName(): ?string
149
+				{
150
+								return $this->package_name;
151
+				}
152
+
153
+				/**
154
+				 * @param string $package_name
155
+				 * @return Package
156
+				 */
157
+				public function setPackageName(string $package_name): self
158
+				{
159
+								$this->package_name = $package_name;
160
+
161
+								return $this;
162
+				}
163
+
164
+				/**
165
+				 * @return string
166
+				 */
167
+				public function getProjectUrl(): ?string
168
+				{
169
+								return $this->project_url;
170
+				}
171
+
172
+				/**
173
+				 * @param string $project_url
174
+				 * @return Package
175
+				 */
176
+				public function setProjectUrl(string $project_url): self
177
+				{
178
+								$this->project_url = $project_url;
179
+
180
+								return $this;
181
+				}
182
+
183
+				/**
184
+				 * @return string
185
+				 */
186
+				public function getVersion(): ?string
187
+				{
188
+								return $this->version;
189
+				}
190
+
191
+				/**
192
+				 * @param string $version
193
+				 * @return Package
194
+				 */
195
+				public function setVersion(?string $version): self
196
+				{
197
+								$this->version = $version;
198
+
199
+								return $this;
200
+				}
201
+
202
+				/**
203
+				 * @return string
204
+				 */
205
+				public function getLastPackagistVersion(): ?string
206
+				{
207
+								return $this->last_packagist_version;
208
+				}
209
+
210
+				/**
211
+				 * @param string $last_packagist_version
212
+				 * @return Package
213
+				 */
214
+				public function setLastPackagistVersion(?string $last_packagist_version): self
215
+				{
216
+								$this->last_packagist_version = $last_packagist_version;
217
+
218
+								return $this;
219
+				}
220
+
221
+				/**
222
+				 * @return DateTime
223
+				 */
224
+				public function getVersionDate(): ?DateTime
225
+				{
226
+								return $this->version_date;
227
+				}
228
+
229
+				/**
230
+				 * @param DateTime $version_date
231
+				 * @return Package
232
+				 */
233
+				public function setVersionDate(?DateTime $version_date): self
234
+				{
235
+								$this->version_date = $version_date;
236
+
237
+								return $this;
238
+				}
239
+
240
+				/**
241
+				 * @return DateTime
242
+				 */
243
+				public function getLastCheck(): ?DateTime
244
+				{
245
+								return $this->last_check;
246
+				}
247
+
248
+				/**
249
+				 * @param DateTime $last_check
250
+				 * @return Package
251
+				 */
252
+				public function setLastCheck(DateTime $last_check): self
253
+				{
254
+								$this->last_check = $last_check;
255
+
256
+								return $this;
257
+				}
258
+
259
+				/**
260
+				 * @return string
261
+				 */
262
+				public function getMode(): ?string
263
+				{
264
+								return $this->mode;
265
+				}
266
+
267
+				/**
268
+				 * @param string $mode
269
+				 * @return Package
270
+				 */
271
+				public function setMode(string $mode): self
272
+				{
273
+								$this->mode = $mode;
274
+
275
+								return $this;
276
+				}
277
+
278
+				/**
279
+				 * @return string
280
+				 */
281
+				public function getCheckVersionUrl(): ?string
282
+				{
283
+								return $this->check_version_url;
284
+				}
285
+
286
+				/**
287
+				 * @param string|null $check_version_url
288
+				 * @return Package
289
+				 */
290
+				public function setCheckVersionUrl(?string $check_version_url): self
291
+				{
292
+								$this->check_version_url = $check_version_url;
293
+
294
+								return $this;
295
+				}
296
+
297
+				/**
298
+				 * @return string
299
+				 */
300
+				public function getComposerLockUrl(): ?string
301
+				{
302
+								return $this->composer_lock_url;
303
+				}
304
+
305
+				/**
306
+				 * @param string|null $composer_lock_url
307
+				 * @return Package
308
+				 */
309
+				public function setComposerLockUrl(?string $composer_lock_url): self
310
+				{
311
+								$this->composer_lock_url = $composer_lock_url;
312
+
313
+								return $this;
314
+				}
315
+
316
+				/**
317
+				 * @return bool
318
+				 */
319
+				public function isIsLocal(): ?bool
320
+				{
321
+								return $this->is_local;
322
+				}
323
+
324
+				/**
325
+				 * @param bool $is_local
326
+				 * @return Package
327
+				 */
328
+				public function setIsLocal(bool $is_local): self
329
+				{
330
+								$this->is_local = $is_local;
331
+
332
+								return $this;
333
+				}
334
+
335
+				public function getFormattedIsLocal()
336
+				{
337
+								return $this->isIsLocal() ? "Yes" : "No";
338
+				}
339 339
 }
340 340
 
Please login to merge, or discard this patch.
Controller/PackageController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
                 $message = "<ul>";
110 110
                 $message .= "<li>The project package was not well updated</li>";
111 111
                 foreach ($version->getMessages() as $version_message) {
112
-                    $message .= "<li>".$version_message."</li>";
112
+                    $message .= "<li>" . $version_message . "</li>";
113 113
                 }
114 114
                 $message .= "</ul>";
115 115
 
Please login to merge, or discard this patch.
Indentation   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -19,128 +19,128 @@
 block discarded – undo
19 19
 
20 20
 class PackageController extends AbstractController
21 21
 {
22
-    /**
23
-     * @Route("/packages/", name="ribsadmin_packages")
24
-     * @param EntityManagerInterface $em
25
-     * @return Response
26
-     */
27
-    public function index(EntityManagerInterface $em): Response
28
-    {
29
-        $packages = $em->getRepository(Package::class)->findAll();
22
+				/**
23
+				 * @Route("/packages/", name="ribsadmin_packages")
24
+				 * @param EntityManagerInterface $em
25
+				 * @return Response
26
+				 */
27
+				public function index(EntityManagerInterface $em): Response
28
+				{
29
+								$packages = $em->getRepository(Package::class)->findAll();
30 30
         
31
-        return $this->render("@RibsAdmin/packages/list.html.twig", ["packages" => $packages]);
32
-    }
33
-
34
-    /**
35
-     * @Route("/packages/create/", name="ribsadmin_packages_create")
36
-     * @Route("/packages/show/{guid}", name="ribsadmin_packages_show")
37
-     * @Route("/packages/edit/{guid}", name="ribsadmin_packages_edit")
38
-     * @param Request $request
39
-     * @param EntityManagerInterface $em
40
-     * @param PackagistApi $packagist
41
-     * @param string|null $guid
42
-     * @return Response
43
-     * @throws ClientExceptionInterface
44
-     * @throws RedirectionExceptionInterface
45
-     * @throws ServerExceptionInterface
46
-     * @throws TransportExceptionInterface
47
-     */
48
-    public function edit(Request $request, EntityManagerInterface $em, PackagistApi $packagist, string $guid = null): Response
49
-    {
50
-        $disabled_form = strpos($request->get("_route"), "_show") ? true : false;
51
-        if (!$guid) {
52
-            $package = new Package();
53
-            $text = "created";
54
-        } else {
55
-            $package = $em->getRepository(Package::class)->findOneBy(["guid" => $guid]);
56
-            $text = "edited";
57
-        }
58
-
59
-        $form = $this->createForm(\PiouPiou\RibsAdminBundle\Form\Package::class, $package, ["disabled" => $disabled_form]);
60
-        $form->handleRequest($request);
61
-
62
-        if ($form->isSubmitted() && $form->isValid()) {
63
-            /** @var Package $data */
64
-            $data = $form->getData();
65
-            $em->persist($data);
66
-            $em->flush();
67
-            $this->addFlash("success-flash", "Package " . $data->getProjectName() . " was " . $text);
68
-
69
-            return $this->redirectToRoute("ribsadmin_packages");
70
-        }
71
-
72
-        return $this->render("@RibsAdmin/packages/edit.html.twig", [
73
-            "disabled_form" => $disabled_form,
74
-            "form" => $form->createView(),
75
-            "form_errors" => $form->getErrors(),
76
-            "package" => $package,
77
-            "versions" => $packagist->getAllPackagistVersions($package->getPackageName())
78
-        ]);
79
-    }
80
-
81
-    /**
82
-     * @Route("/packages/delete/{guid}", name="ribsadmin_packages_delete")
83
-     * @param EntityManagerInterface $em
84
-     * @param string $guid
85
-     * @return RedirectResponse
86
-     */
87
-    public function delete(EntityManagerInterface $em, string $guid): RedirectResponse
88
-    {
89
-        $package = $em->getRepository(Package::class)->findOneBy(["guid" => $guid]);
90
-
91
-        if ($package) {
92
-            $em->remove($package);
93
-            $em->flush();
94
-            $this->addFlash("success-flash", "The project package was deleted");
95
-        } else {
96
-            $this->addFlash("error-flash", "The project package was not found");
97
-        }
98
-
99
-        return $this->redirectToRoute("ribsadmin_packages");
100
-    }
101
-
102
-    /**
103
-     * @Route("/packages/update/{guid}", name="ribsadmin_packages_update")
104
-     * @param Version $version
105
-     * @param string $guid
106
-     * @return RedirectResponse
107
-     * @throws Exception
108
-     */
109
-    public function updatePackage(Version $version, string $guid): RedirectResponse
110
-    {
111
-        if ($guid) {
112
-            $version->save($guid);
113
-
114
-            if ($version->getMessages()) {
115
-                $message = "<ul>";
116
-                $message .= "<li>The project package was not well updated</li>";
117
-                foreach ($version->getMessages() as $version_message) {
118
-                    $message .= "<li>".$version_message."</li>";
119
-                }
120
-                $message .= "</ul>";
121
-
122
-                $this->addFlash("info-flash", $message);
123
-            } else {
124
-                $this->addFlash("success-flash", "The project package was updated");
125
-            }
126
-        } else {
127
-            $this->addFlash("error-flash", "The project package was not found");
128
-        }
129
-
130
-        return $this->redirectToRoute("ribsadmin_packages");
131
-    }
132
-
133
-    /**
134
-     * @Route("/packages/update-version/{guid}/{install_version}", name="ribsadmin_packages_update_version")
135
-     * @param Version $version
136
-     * @param string $guid
137
-     * @param string $install_version
138
-     * @return RedirectResponse
139
-     */
140
-    public function changePackageVersion(Version $version, string $guid, string $install_version): RedirectResponse
141
-    {
142
-        $version->updatePackage($guid, $install_version);
143
-
144
-        return $this->redirectToRoute("ribsadmin_packages_update", ["guid" => $guid]);
145
-    }
31
+								return $this->render("@RibsAdmin/packages/list.html.twig", ["packages" => $packages]);
32
+				}
33
+
34
+				/**
35
+				 * @Route("/packages/create/", name="ribsadmin_packages_create")
36
+				 * @Route("/packages/show/{guid}", name="ribsadmin_packages_show")
37
+				 * @Route("/packages/edit/{guid}", name="ribsadmin_packages_edit")
38
+				 * @param Request $request
39
+				 * @param EntityManagerInterface $em
40
+				 * @param PackagistApi $packagist
41
+				 * @param string|null $guid
42
+				 * @return Response
43
+				 * @throws ClientExceptionInterface
44
+				 * @throws RedirectionExceptionInterface
45
+				 * @throws ServerExceptionInterface
46
+				 * @throws TransportExceptionInterface
47
+				 */
48
+				public function edit(Request $request, EntityManagerInterface $em, PackagistApi $packagist, string $guid = null): Response
49
+				{
50
+								$disabled_form = strpos($request->get("_route"), "_show") ? true : false;
51
+								if (!$guid) {
52
+												$package = new Package();
53
+												$text = "created";
54
+								} else {
55
+												$package = $em->getRepository(Package::class)->findOneBy(["guid" => $guid]);
56
+												$text = "edited";
57
+								}
58
+
59
+								$form = $this->createForm(\PiouPiou\RibsAdminBundle\Form\Package::class, $package, ["disabled" => $disabled_form]);
60
+								$form->handleRequest($request);
61
+
62
+								if ($form->isSubmitted() && $form->isValid()) {
63
+												/** @var Package $data */
64
+												$data = $form->getData();
65
+												$em->persist($data);
66
+												$em->flush();
67
+												$this->addFlash("success-flash", "Package " . $data->getProjectName() . " was " . $text);
68
+
69
+												return $this->redirectToRoute("ribsadmin_packages");
70
+								}
71
+
72
+								return $this->render("@RibsAdmin/packages/edit.html.twig", [
73
+												"disabled_form" => $disabled_form,
74
+												"form" => $form->createView(),
75
+												"form_errors" => $form->getErrors(),
76
+												"package" => $package,
77
+												"versions" => $packagist->getAllPackagistVersions($package->getPackageName())
78
+								]);
79
+				}
80
+
81
+				/**
82
+				 * @Route("/packages/delete/{guid}", name="ribsadmin_packages_delete")
83
+				 * @param EntityManagerInterface $em
84
+				 * @param string $guid
85
+				 * @return RedirectResponse
86
+				 */
87
+				public function delete(EntityManagerInterface $em, string $guid): RedirectResponse
88
+				{
89
+								$package = $em->getRepository(Package::class)->findOneBy(["guid" => $guid]);
90
+
91
+								if ($package) {
92
+												$em->remove($package);
93
+												$em->flush();
94
+												$this->addFlash("success-flash", "The project package was deleted");
95
+								} else {
96
+												$this->addFlash("error-flash", "The project package was not found");
97
+								}
98
+
99
+								return $this->redirectToRoute("ribsadmin_packages");
100
+				}
101
+
102
+				/**
103
+				 * @Route("/packages/update/{guid}", name="ribsadmin_packages_update")
104
+				 * @param Version $version
105
+				 * @param string $guid
106
+				 * @return RedirectResponse
107
+				 * @throws Exception
108
+				 */
109
+				public function updatePackage(Version $version, string $guid): RedirectResponse
110
+				{
111
+								if ($guid) {
112
+												$version->save($guid);
113
+
114
+												if ($version->getMessages()) {
115
+																$message = "<ul>";
116
+																$message .= "<li>The project package was not well updated</li>";
117
+																foreach ($version->getMessages() as $version_message) {
118
+																				$message .= "<li>".$version_message."</li>";
119
+																}
120
+																$message .= "</ul>";
121
+
122
+																$this->addFlash("info-flash", $message);
123
+												} else {
124
+																$this->addFlash("success-flash", "The project package was updated");
125
+												}
126
+								} else {
127
+												$this->addFlash("error-flash", "The project package was not found");
128
+								}
129
+
130
+								return $this->redirectToRoute("ribsadmin_packages");
131
+				}
132
+
133
+				/**
134
+				 * @Route("/packages/update-version/{guid}/{install_version}", name="ribsadmin_packages_update_version")
135
+				 * @param Version $version
136
+				 * @param string $guid
137
+				 * @param string $install_version
138
+				 * @return RedirectResponse
139
+				 */
140
+				public function changePackageVersion(Version $version, string $guid, string $install_version): RedirectResponse
141
+				{
142
+								$version->updatePackage($guid, $install_version);
143
+
144
+								return $this->redirectToRoute("ribsadmin_packages_update", ["guid" => $guid]);
145
+				}
146 146
 }
Please login to merge, or discard this patch.
Command/UpdatePackagesInfo.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -12,47 +12,47 @@
 block discarded – undo
12 12
 
13 13
 class UpdatePackagesInfo extends Command
14 14
 {
15
-    /**
16
-     * @var EntityManagerInterface
17
-     */
18
-    private $em;
19
-
20
-    /**
21
-     * @var Version
22
-     */
23
-    private $version;
24
-
25
-    /**
26
-     * ImportModuleCommand constructor.
27
-     * @param EntityManagerInterface $em
28
-     * @param Version $version
29
-     * @param string|null $name
30
-     */
31
-    public function __construct(EntityManagerInterface $em, Version $version, string $name = null)
32
-    {
33
-        parent::__construct($name);
34
-        $this->em = $em;
35
-        $this->version = $version;
36
-    }
37
-
38
-    protected function configure()
39
-    {
40
-        $this
41
-            ->setName('ribsadmin:update-packages-info')
42
-            ->setDescription('Update all packages versions informatio')
43
-        ;
44
-    }
45
-
46
-    protected function execute(InputInterface $input, OutputInterface $output)
47
-    {
48
-        $packages = $this->em->getRepository(Package::class)->findAll();
49
-
50
-        /** @var Package $package */
51
-        foreach ($packages as $package) {
52
-            $output->writeln("Update ".$package->getPackageName()." info");
53
-            $this->version->save($package->getGuid());
54
-        }
55
-
56
-        return 0;
57
-    }
15
+				/**
16
+				 * @var EntityManagerInterface
17
+				 */
18
+				private $em;
19
+
20
+				/**
21
+				 * @var Version
22
+				 */
23
+				private $version;
24
+
25
+				/**
26
+				 * ImportModuleCommand constructor.
27
+				 * @param EntityManagerInterface $em
28
+				 * @param Version $version
29
+				 * @param string|null $name
30
+				 */
31
+				public function __construct(EntityManagerInterface $em, Version $version, string $name = null)
32
+				{
33
+								parent::__construct($name);
34
+								$this->em = $em;
35
+								$this->version = $version;
36
+				}
37
+
38
+				protected function configure()
39
+				{
40
+								$this
41
+												->setName('ribsadmin:update-packages-info')
42
+												->setDescription('Update all packages versions informatio')
43
+								;
44
+				}
45
+
46
+				protected function execute(InputInterface $input, OutputInterface $output)
47
+				{
48
+								$packages = $this->em->getRepository(Package::class)->findAll();
49
+
50
+								/** @var Package $package */
51
+								foreach ($packages as $package) {
52
+												$output->writeln("Update ".$package->getPackageName()." info");
53
+												$this->version->save($package->getGuid());
54
+								}
55
+
56
+								return 0;
57
+				}
58 58
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 
50 50
         /** @var Package $package */
51 51
         foreach ($packages as $package) {
52
-            $output->writeln("Update ".$package->getPackageName()." info");
52
+            $output->writeln("Update " . $package->getPackageName() . " info");
53 53
             $this->version->save($package->getGuid());
54 54
         }
55 55
 
Please login to merge, or discard this patch.