Passed
Push — master ( b5f2aa...83de64 )
by Anthony
03:40 queued 10s
created
Entity/AccessRight.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
  */
17 17
 class AccessRight
18 18
 {
19
-    use GuidTrait;
20
-    use CreatedUpdatedTrait;
19
+				use GuidTrait;
20
+				use CreatedUpdatedTrait;
21 21
 
22 22
 	/**
23 23
 	 * @var integer
Please login to merge, or discard this patch.
Repository/UserLogsRepository.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,24 +8,24 @@
 block discarded – undo
8 8
 
9 9
 class UserLogsRepository extends EntityRepository
10 10
 {
11
-    /**
12
-     * @param int $page
13
-     * @param int $max_per_page
14
-     * @return Paginator
15
-     */
16
-    public function findAllPaginated(int $page, int $max_per_page): Paginator
17
-    {
18
-        $qb = $this->createQueryBuilder('l')->orderBy('l.created_at', 'DESC');
19
-        $query = $qb->getQuery();
11
+				/**
12
+				 * @param int $page
13
+				 * @param int $max_per_page
14
+				 * @return Paginator
15
+				 */
16
+				public function findAllPaginated(int $page, int $max_per_page): Paginator
17
+				{
18
+								$qb = $this->createQueryBuilder('l')->orderBy('l.created_at', 'DESC');
19
+								$query = $qb->getQuery();
20 20
 
21
-        $first_result = ($page - 1) * $max_per_page;
22
-        $query->setFirstResult($first_result)->setMaxResults($max_per_page);
23
-        $paginator = new Paginator($query);
21
+								$first_result = ($page - 1) * $max_per_page;
22
+								$query->setFirstResult($first_result)->setMaxResults($max_per_page);
23
+								$paginator = new Paginator($query);
24 24
 
25
-        if (($paginator->count() <= $first_result) && $page != 1) {
26
-            throw new NotFoundHttpException('La page demandée n\'existe pas.');
27
-        }
25
+								if (($paginator->count() <= $first_result) && $page != 1) {
26
+												throw new NotFoundHttpException('La page demandée n\'existe pas.');
27
+								}
28 28
 
29
-        return $paginator;
30
-    }
29
+								return $paginator;
30
+				}
31 31
 }
Please login to merge, or discard this patch.
Entity/User.php 1 patch
Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -14,17 +14,17 @@  discard block
 block discarded – undo
14 14
  */
15 15
 class User
16 16
 {
17
-    use GuidTrait;
18
-    use CreatedUpdatedTrait;
17
+				use GuidTrait;
18
+				use CreatedUpdatedTrait;
19 19
 
20
-    /**
21
-     * @var integer
22
-     *
23
-     * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true})
24
-     * @ORM\Id
25
-     * @ORM\GeneratedValue(strategy="IDENTITY")
26
-     */
27
-    private $id;
20
+				/**
21
+				 * @var integer
22
+				 *
23
+				 * @ORM\Column(name="id", type="integer", nullable=false, options={"unsigned"=true})
24
+				 * @ORM\Id
25
+				 * @ORM\GeneratedValue(strategy="IDENTITY")
26
+				 */
27
+				private $id;
28 28
 	
29 29
 	/**
30 30
 	 * @var AccessRight
@@ -32,63 +32,63 @@  discard block
 block discarded – undo
32 32
 	 * @ORM\ManyToOne(targetEntity="PiouPiou\RibsAdminBundle\Entity\AccessRight", inversedBy="users")
33 33
 	 * @ORM\JoinColumn(name="id_access_right", referencedColumnName="id", nullable=true)
34 34
 	 */
35
-    private $accessRightList;
35
+				private $accessRightList;
36 36
 	
37 37
 	/**
38 38
 	 * @var boolean
39 39
 	 *
40 40
 	 * @ORM\Column(name="admin", type="boolean", nullable=true, options={"default": false})
41 41
 	 */
42
-    private $admin;
42
+				private $admin;
43 43
 
44
-    /**
45
-     * @var string
46
-     *
47
-     * @ORM\Column(name="firstname", type="string", length=255, nullable=false)
48
-     */
49
-    private $firstname;
44
+				/**
45
+				 * @var string
46
+				 *
47
+				 * @ORM\Column(name="firstname", type="string", length=255, nullable=false)
48
+				 */
49
+				private $firstname;
50 50
 
51
-    /**
52
-     * @var string
53
-     *
54
-     * @ORM\Column(name="lastname", type="string", length=255, nullable=false)
55
-     */
56
-    private $lastname;
51
+				/**
52
+				 * @var string
53
+				 *
54
+				 * @ORM\Column(name="lastname", type="string", length=255, nullable=false)
55
+				 */
56
+				private $lastname;
57 57
 
58
-    /**
59
-     * @var string
60
-     *
61
-     * @ORM\Column(name="adress", type="string", length=255, nullable=true)
62
-     */
63
-    private $adress;
58
+				/**
59
+				 * @var string
60
+				 *
61
+				 * @ORM\Column(name="adress", type="string", length=255, nullable=true)
62
+				 */
63
+				private $adress;
64 64
 
65
-    /**
66
-     * @var string
67
-     *
68
-     * @ORM\Column(name="postal_code", type="string", length=100, nullable=true)
69
-     */
70
-    private $postalCode;
65
+				/**
66
+				 * @var string
67
+				 *
68
+				 * @ORM\Column(name="postal_code", type="string", length=100, nullable=true)
69
+				 */
70
+				private $postalCode;
71 71
 
72
-    /**
73
-     * @var string
74
-     *
75
-     * @ORM\Column(name="country", type="string", length=100, nullable=true)
76
-     */
77
-    private $country;
72
+				/**
73
+				 * @var string
74
+				 *
75
+				 * @ORM\Column(name="country", type="string", length=100, nullable=true)
76
+				 */
77
+				private $country;
78 78
 
79
-    /**
80
-     * @var string
81
-     *
82
-     * @ORM\Column(name="state", type="string", length=255, nullable=true)
83
-     */
84
-    private $state;
79
+				/**
80
+				 * @var string
81
+				 *
82
+				 * @ORM\Column(name="state", type="string", length=255, nullable=true)
83
+				 */
84
+				private $state;
85 85
 
86
-    /**
87
-     * @var string
88
-     *
89
-     * @ORM\Column(name="access_rights", type="text", nullable=true)
90
-     */
91
-    private $accessRights;
86
+				/**
87
+				 * @var string
88
+				 *
89
+				 * @ORM\Column(name="access_rights", type="text", nullable=true)
90
+				 */
91
+				private $accessRights;
92 92
 	
93 93
 	/**
94 94
 	 * @var boolean
@@ -97,21 +97,21 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	private $archived = false;
99 99
 
100
-    /**
101
-     * @return int
102
-     */
103
-    public function getId()
104
-    {
105
-        return $this->id;
106
-    }
100
+				/**
101
+				 * @return int
102
+				 */
103
+				public function getId()
104
+				{
105
+								return $this->id;
106
+				}
107 107
 
108
-    /**
109
-     * @param int $id
110
-     */
111
-    public function setId($id)
112
-    {
113
-        $this->id = $id;
114
-    }
108
+				/**
109
+				 * @param int $id
110
+				 */
111
+				public function setId($id)
112
+				{
113
+								$this->id = $id;
114
+				}
115 115
 	
116 116
 	/**
117 117
 	 * @return AccessRight
@@ -145,117 +145,117 @@  discard block
 block discarded – undo
145 145
 		$this->admin = $admin;
146 146
 	}
147 147
 
148
-    /**
149
-     * @return string
150
-     */
151
-    public function getFirstname()
152
-    {
153
-        return $this->firstname;
154
-    }
148
+				/**
149
+				 * @return string
150
+				 */
151
+				public function getFirstname()
152
+				{
153
+								return $this->firstname;
154
+				}
155 155
 
156
-    /**
157
-     * @param string $firstname
158
-     */
159
-    public function setFirstname($firstname)
160
-    {
161
-        $this->firstname = $firstname;
162
-    }
156
+				/**
157
+				 * @param string $firstname
158
+				 */
159
+				public function setFirstname($firstname)
160
+				{
161
+								$this->firstname = $firstname;
162
+				}
163 163
 
164
-    /**
165
-     * @return string
166
-     */
167
-    public function getLastname()
168
-    {
169
-        return $this->lastname;
170
-    }
164
+				/**
165
+				 * @return string
166
+				 */
167
+				public function getLastname()
168
+				{
169
+								return $this->lastname;
170
+				}
171 171
 
172
-    /**
173
-     * @param string $lastname
174
-     */
175
-    public function setLastname($lastname)
176
-    {
177
-        $this->lastname = $lastname;
178
-    }
172
+				/**
173
+				 * @param string $lastname
174
+				 */
175
+				public function setLastname($lastname)
176
+				{
177
+								$this->lastname = $lastname;
178
+				}
179 179
 
180
-    /**
181
-     * @return string
182
-     */
183
-    public function getAdress()
184
-    {
185
-        return $this->adress;
186
-    }
180
+				/**
181
+				 * @return string
182
+				 */
183
+				public function getAdress()
184
+				{
185
+								return $this->adress;
186
+				}
187 187
 
188
-    /**
189
-     * @param string $adress
190
-     */
191
-    public function setAdress($adress)
192
-    {
193
-        $this->adress = $adress;
194
-    }
188
+				/**
189
+				 * @param string $adress
190
+				 */
191
+				public function setAdress($adress)
192
+				{
193
+								$this->adress = $adress;
194
+				}
195 195
 
196
-    /**
197
-     * @return string
198
-     */
199
-    public function getPostalCode()
200
-    {
201
-        return $this->postalCode;
202
-    }
196
+				/**
197
+				 * @return string
198
+				 */
199
+				public function getPostalCode()
200
+				{
201
+								return $this->postalCode;
202
+				}
203 203
 
204
-    /**
205
-     * @param string $postalCode
206
-     */
207
-    public function setPostalCode($postalCode)
208
-    {
209
-        $this->postalCode = $postalCode;
210
-    }
204
+				/**
205
+				 * @param string $postalCode
206
+				 */
207
+				public function setPostalCode($postalCode)
208
+				{
209
+								$this->postalCode = $postalCode;
210
+				}
211 211
 
212
-    /**
213
-     * @return string
214
-     */
215
-    public function getCountry()
216
-    {
217
-        return $this->country;
218
-    }
212
+				/**
213
+				 * @return string
214
+				 */
215
+				public function getCountry()
216
+				{
217
+								return $this->country;
218
+				}
219 219
 
220
-    /**
221
-     * @param string $country
222
-     */
223
-    public function setCountry($country)
224
-    {
225
-        $this->country = $country;
226
-    }
220
+				/**
221
+				 * @param string $country
222
+				 */
223
+				public function setCountry($country)
224
+				{
225
+								$this->country = $country;
226
+				}
227 227
 
228
-    /**
229
-     * @return string
230
-     */
231
-    public function getState()
232
-    {
233
-        return $this->state;
234
-    }
228
+				/**
229
+				 * @return string
230
+				 */
231
+				public function getState()
232
+				{
233
+								return $this->state;
234
+				}
235 235
 
236
-    /**
237
-     * @param string $state
238
-     */
239
-    public function setState($state)
240
-    {
241
-        $this->state = $state;
242
-    }
236
+				/**
237
+				 * @param string $state
238
+				 */
239
+				public function setState($state)
240
+				{
241
+								$this->state = $state;
242
+				}
243 243
 
244
-    /**
245
-     * @return string
246
-     */
247
-    public function getAccessRights()
248
-    {
249
-        return $this->accessRights;
250
-    }
244
+				/**
245
+				 * @return string
246
+				 */
247
+				public function getAccessRights()
248
+				{
249
+								return $this->accessRights;
250
+				}
251 251
 
252
-    /**
253
-     * @param string $accessRights
254
-     */
255
-    public function setAccessRights($accessRights)
256
-    {
257
-        $this->accessRights = $accessRights;
258
-    }
252
+				/**
253
+				 * @param string $accessRights
254
+				 */
255
+				public function setAccessRights($accessRights)
256
+				{
257
+								$this->accessRights = $accessRights;
258
+				}
259 259
 	
260 260
 	/**
261 261
 	 * @return boolean
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 	}
275 275
 
276 276
 	public function __toString()
277
-    {
278
-        return $this->getFirstname() . " " . $this->getLastname();
279
-    }
277
+				{
278
+								return $this->getFirstname() . " " . $this->getLastname();
279
+				}
280 280
 }
281 281
 
Please login to merge, or discard this patch.
Controller/UserLogsController.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -10,45 +10,45 @@
 block discarded – undo
10 10
 
11 11
 class UserLogsController extends AbstractController
12 12
 {
13
-    /**
14
-     * list all user logs
15
-     * @Route("/user-logs/{page}", requirements={"page" = "\d+"}, name="ribsadmin_userlogs")
16
-     * @param ParameterBagInterface $parameterBag
17
-     * @param int $page
18
-     * @return Response
19
-     */
20
-    public function list(ParameterBagInterface $parameterBag, int $page = 1): Response
21
-    {
22
-        $em = $this->getDoctrine()->getManager();
23
-        $max_per_page = $parameterBag->get("ribs_admin")["paginator_element_per_page"];
13
+				/**
14
+				 * list all user logs
15
+				 * @Route("/user-logs/{page}", requirements={"page" = "\d+"}, name="ribsadmin_userlogs")
16
+				 * @param ParameterBagInterface $parameterBag
17
+				 * @param int $page
18
+				 * @return Response
19
+				 */
20
+				public function list(ParameterBagInterface $parameterBag, int $page = 1): Response
21
+				{
22
+								$em = $this->getDoctrine()->getManager();
23
+								$max_per_page = $parameterBag->get("ribs_admin")["paginator_element_per_page"];
24 24
 
25
-        $logs = $em->getRepository(UserLogs::class)->findAllPaginated($page, $max_per_page);
26
-        $pagination = array(
27
-            "page" => $page,
28
-            "page_number" => ceil(count($logs) / 20),
29
-            "route" => "ribsadmin_userlogs",
30
-            "parameters" => array()
31
-        );
25
+								$logs = $em->getRepository(UserLogs::class)->findAllPaginated($page, $max_per_page);
26
+								$pagination = array(
27
+												"page" => $page,
28
+												"page_number" => ceil(count($logs) / 20),
29
+												"route" => "ribsadmin_userlogs",
30
+												"parameters" => array()
31
+								);
32 32
 
33
-        return $this->render("@RibsAdmin/userlogs/list.html.twig", [
34
-            "logs" => $logs,
35
-            "pagination" => $pagination
36
-        ]);
37
-    }
33
+								return $this->render("@RibsAdmin/userlogs/list.html.twig", [
34
+												"logs" => $logs,
35
+												"pagination" => $pagination
36
+								]);
37
+				}
38 38
 
39
-    /**
40
-     * show detail of a user log
41
-     * @Route("/user-logs/show/{guid}", name="ribsadmin_userlogs_show")
42
-     * @param string $guid
43
-     * @return Response
44
-     */
45
-    public function show(string $guid): Response
46
-    {
47
-        $log = $this->getDoctrine()->getRepository(UserLogs::class)->findOneByGuid($guid);
48
-        dump($log->getRequestParameters());
39
+				/**
40
+				 * show detail of a user log
41
+				 * @Route("/user-logs/show/{guid}", name="ribsadmin_userlogs_show")
42
+				 * @param string $guid
43
+				 * @return Response
44
+				 */
45
+				public function show(string $guid): Response
46
+				{
47
+								$log = $this->getDoctrine()->getRepository(UserLogs::class)->findOneByGuid($guid);
48
+								dump($log->getRequestParameters());
49 49
 
50
-        return $this->render("@RibsAdmin/userlogs/show.html.twig", [
51
-            "log" => $log,
52
-        ]);
53
-    }
50
+								return $this->render("@RibsAdmin/userlogs/show.html.twig", [
51
+												"log" => $log,
52
+								]);
53
+				}
54 54
 }
Please login to merge, or discard this patch.
Service/UserLog.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -9,48 +9,48 @@
 block discarded – undo
9 9
 
10 10
 class UserLog
11 11
 {
12
-    /**
13
-     * @var TokenStorageInterface
14
-     */
15
-    private $token_storage;
16
-
17
-    /**
18
-     * @var EntityManagerInterface a
19
-     */
20
-    private $em;
21
-
22
-    public function __construct(TokenStorageInterface $token_storage, EntityManagerInterface $em)
23
-    {
24
-        $this->token_storage = $token_storage;
25
-        $this->em = $em;
26
-    }
27
-
28
-    /**
29
-     * @param RequestEvent $request_event
30
-     */
31
-    public function onKernelRequest(RequestEvent $request_event)
32
-    {
33
-        if ($request_event->isMasterRequest()) {
34
-            $user = null;
35
-            if ($this->token_storage->getToken() && is_object($this->token_storage->getToken()->getUser()) && $this->token_storage->getToken()->getUser()->getUser()) {
36
-                $user = $this->token_storage->getToken()->getUser()->getUser();
37
-            }
38
-            $request = $request_event->getRequest();
39
-            $route = $request->get("_route");
40
-
41
-            if (in_array($route, ["_profiler", "_profiler_search_bar", "_wdt", "ribsadmin_userlogs", "ribsadmin_userlogs_show"])) {
42
-                return;
43
-            }
44
-
45
-            if ($user) {
46
-                $user_log = new UserLogs();
47
-                $user_log->setMethod($request->getMethod());
48
-                $user_log->setUser($user);
49
-                $user_log->setUrl($request->get("_route"));
50
-                $user_log->setRequestParameters($request->request->all());
51
-                $this->em->persist($user_log);
52
-                $this->em->flush();
53
-            }
54
-        }
55
-    }
12
+				/**
13
+				 * @var TokenStorageInterface
14
+				 */
15
+				private $token_storage;
16
+
17
+				/**
18
+				 * @var EntityManagerInterface a
19
+				 */
20
+				private $em;
21
+
22
+				public function __construct(TokenStorageInterface $token_storage, EntityManagerInterface $em)
23
+				{
24
+								$this->token_storage = $token_storage;
25
+								$this->em = $em;
26
+				}
27
+
28
+				/**
29
+				 * @param RequestEvent $request_event
30
+				 */
31
+				public function onKernelRequest(RequestEvent $request_event)
32
+				{
33
+								if ($request_event->isMasterRequest()) {
34
+												$user = null;
35
+												if ($this->token_storage->getToken() && is_object($this->token_storage->getToken()->getUser()) && $this->token_storage->getToken()->getUser()->getUser()) {
36
+																$user = $this->token_storage->getToken()->getUser()->getUser();
37
+												}
38
+												$request = $request_event->getRequest();
39
+												$route = $request->get("_route");
40
+
41
+												if (in_array($route, ["_profiler", "_profiler_search_bar", "_wdt", "ribsadmin_userlogs", "ribsadmin_userlogs_show"])) {
42
+																return;
43
+												}
44
+
45
+												if ($user) {
46
+																$user_log = new UserLogs();
47
+																$user_log->setMethod($request->getMethod());
48
+																$user_log->setUser($user);
49
+																$user_log->setUrl($request->get("_route"));
50
+																$user_log->setRequestParameters($request->request->all());
51
+																$this->em->persist($user_log);
52
+																$this->em->flush();
53
+												}
54
+								}
55
+				}
56 56
 }
Please login to merge, or discard this patch.