Passed
Push — master ( c57dae...f09347 )
by Luiz Kim
07:37 queued 05:02
created
src/Repository/RouteRepository.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
  */
15 15
 class RouteRepository extends ServiceEntityRepository
16 16
 {
17
-  public function __construct(ManagerRegistry $registry)
18
-  {
17
+    public function __construct(ManagerRegistry $registry)
18
+    {
19 19
     parent::__construct($registry, Routes::class);
20
-  }
20
+    }
21 21
 }
Please login to merge, or discard this patch.
src/Repository/MenuRepository.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
  */
15 15
 class MenuRepository extends ServiceEntityRepository
16 16
 {
17
-  public function __construct(ManagerRegistry $registry)
18
-  {
17
+    public function __construct(ManagerRegistry $registry)
18
+    {
19 19
     parent::__construct($registry, Menu::class);
20
-  }
20
+    }
21 21
 }
Please login to merge, or discard this patch.
src/Controller/GetMenuByPeopleAction.php 2 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -9,98 +9,98 @@  discard block
 block discarded – undo
9 9
 use Exception;
10 10
 use Symfony\Component\HttpFoundation\JsonResponse;
11 11
 use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface
12
- AS Security;
12
+    AS Security;
13 13
 use ControleOnline\Repository\MenuRepository;
14 14
 
15 15
 
16 16
 class GetMenuByPeopleAction
17 17
 {
18
-  /**
19
-   * Entity Manager
20
-   *
21
-   * @var EntityManagerInterface
22
-   */
23
-  private $manager = null;
24
-
25
-  /**
26
-   * Request
27
-   *
28
-   * @var Request
29
-   */
30
-  private $request  = null;
31
-
32
-  /**
33
-   * Security
34
-   *
35
-   * @var Security
36
-   */
37
-  private $security = null;
38
-
39
-  /**
40
-   * @var \ControleOnline\Repository\MenuRepository
41
-   */
42
-  private $repository = null;
43
-
44
-
45
-  public function __construct(Security $security, EntityManagerInterface $entityManager)
46
-  {
18
+    /**
19
+     * Entity Manager
20
+     *
21
+     * @var EntityManagerInterface
22
+     */
23
+    private $manager = null;
24
+
25
+    /**
26
+     * Request
27
+     *
28
+     * @var Request
29
+     */
30
+    private $request  = null;
31
+
32
+    /**
33
+     * Security
34
+     *
35
+     * @var Security
36
+     */
37
+    private $security = null;
38
+
39
+    /**
40
+     * @var \ControleOnline\Repository\MenuRepository
41
+     */
42
+    private $repository = null;
43
+
44
+
45
+    public function __construct(Security $security, EntityManagerInterface $entityManager)
46
+    {
47 47
     $this->manager    = $entityManager;
48 48
     $this->security   = $security;
49 49
     $this->repository = $this->manager->getRepository(Menu::class);
50
-  }
50
+    }
51 51
 
52
-  public function __invoke(Request $request): JsonResponse
53
-  {
52
+    public function __invoke(Request $request): JsonResponse
53
+    {
54 54
     try {
55 55
 
56
-      $menu  = [];
56
+        $menu  = [];
57 57
 
58
-      $company = $request->query->get('myCompany', null);
58
+        $company = $request->query->get('myCompany', null);
59 59
 
60
-      if ($company === null)
60
+        if ($company === null)
61 61
         throw new Exception("Company not found", 404);
62 62
 
63 63
 
64
-      $myCompany = $this->manager->getRepository(People::class)
64
+        $myCompany = $this->manager->getRepository(People::class)
65 65
         ->find($company);
66 66
 
67
-      if ($myCompany === null)
67
+        if ($myCompany === null)
68 68
         throw new Exception("Company not found", 404);
69 69
 
70 70
 
71 71
 
72
-      $currentUser = $this->security->getToken()->getUser();
73
-      /**
74
-       * @var People
75
-       */
76
-      $userPeople = $currentUser->getPeople();
72
+        $currentUser = $this->security->getToken()->getUser();
73
+        /**
74
+         * @var People
75
+         */
76
+        $userPeople = $currentUser->getPeople();
77 77
 
78
-      $menu =  $this->getMenuByPeople($userPeople, $myCompany);
78
+        $menu =  $this->getMenuByPeople($userPeople, $myCompany);
79 79
 
80 80
 
81
-      return new JsonResponse([
81
+        return new JsonResponse([
82 82
         'response' => [
83
-          'data'    => $menu,
84
-          'count'   => 1,
85
-          'error'   => '',
86
-          'success' => true,
83
+            'data'    => $menu,
84
+            'count'   => 1,
85
+            'error'   => '',
86
+            'success' => true,
87 87
         ],
88
-      ]);
88
+        ]);
89 89
     } catch (\Exception $e) {
90 90
 
91
-      return new JsonResponse([
91
+        return new JsonResponse([
92 92
         'response' => [
93
-          'data'    => [],
94
-          'count'   => 0,
95
-          'error'   => $e->getMessage(),
96
-          'success' => false,
93
+            'data'    => [],
94
+            'count'   => 0,
95
+            'error'   => $e->getMessage(),
96
+            'success' => false,
97 97
         ],
98
-      ]);
98
+        ]);
99
+    }
99 100
     }
100
-  }
101 101
 
102
-  private function getMenuByPeople(People $userPeople, People $myCompany)
103
-  {
102
+    private function getMenuByPeople(People $userPeople, People $myCompany)
103
+    {
104 104
 
105 105
     $return = [];
106 106
     $connection = $this->manager->getConnection();
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
 
135 135
     foreach ($result as $menu) {
136 136
 
137
-      $return['modules'][$menu['category_id']]['id'] = $menu['category_id'];
138
-      $return['modules'][$menu['category_id']]['label'] = $menu['category_label'];
139
-      $return['modules'][$menu['category_id']]['color'] = $menu['category_color'];
140
-      $return['modules'][$menu['category_id']]['icon'] = $menu['category_icon'];
141
-      $return['modules'][$menu['category_id']]['menus'][] = [
137
+        $return['modules'][$menu['category_id']]['id'] = $menu['category_id'];
138
+        $return['modules'][$menu['category_id']]['label'] = $menu['category_label'];
139
+        $return['modules'][$menu['category_id']]['color'] = $menu['category_color'];
140
+        $return['modules'][$menu['category_id']]['icon'] = $menu['category_icon'];
141
+        $return['modules'][$menu['category_id']]['menus'][] = [
142 142
         'id' => $menu['id'],
143 143
         'label' =>  $menu['menu'],
144 144
         'icon' =>  $menu['icon'],
145 145
         'color' =>  $menu['color'],
146 146
         'route' =>  $menu['route'],
147 147
         'module' =>  '/modules/' . $menu['module'],
148
-      ];
148
+        ];
149 149
     }
150 150
 
151 151
 
152 152
 
153 153
     return $return;
154
-  }
154
+    }
155 155
 }
156 156
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
    *
28 28
    * @var Request
29 29
    */
30
-  private $request  = null;
30
+  private $request = null;
31 31
 
32 32
   /**
33 33
    * Security
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
   {
54 54
     try {
55 55
 
56
-      $menu  = [];
56
+      $menu = [];
57 57
 
58 58
       $company = $request->query->get('myCompany', null);
59 59
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
        */
76 76
       $userPeople = $currentUser->getPeople();
77 77
 
78
-      $menu =  $this->getMenuByPeople($userPeople, $myCompany);
78
+      $menu = $this->getMenuByPeople($userPeople, $myCompany);
79 79
 
80 80
 
81 81
       return new JsonResponse([
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
     // build query
109 109
 
110
-    $sql  = 'SELECT menu.*,
110
+    $sql = 'SELECT menu.*,
111 111
             category.name AS category_label,
112 112
             category.color AS category_color,
113 113
             routes.route AS route,
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 
127 127
     $params = [];
128 128
 
129
-    $params['myCompany']   = $myCompany->getId();
130
-    $params['userPeople']   = $userPeople->getId();
129
+    $params['myCompany'] = $myCompany->getId();
130
+    $params['userPeople'] = $userPeople->getId();
131 131
     // execute query
132 132
 
133 133
     $result = $connection->executeQuery($sql, $params)->fetchAllAssociative();
Please login to merge, or discard this patch.
src/Controller/GetActionByPeopleAction.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -11,58 +11,58 @@  discard block
 block discarded – undo
11 11
 
12 12
 class GetActionByPeopleAction
13 13
 {
14
-  private $manager = null;
15
-  private $security = null;
14
+    private $manager = null;
15
+    private $security = null;
16 16
 
17
-  public function __construct(Security $security, EntityManagerInterface $entityManager)
18
-  {
17
+    public function __construct(Security $security, EntityManagerInterface $entityManager)
18
+    {
19 19
     $this->manager = $entityManager;
20 20
     $this->security = $security;
21
-  }
21
+    }
22 22
 
23
-  public function __invoke(Request $request): JsonResponse
24
-  {
23
+    public function __invoke(Request $request): JsonResponse
24
+    {
25 25
     try {
26
-      $menu = [];
27
-      $company = $request->query->get('myCompany', null);
26
+        $menu = [];
27
+        $company = $request->query->get('myCompany', null);
28 28
 
29
-      if ($company === null) {
29
+        if ($company === null) {
30 30
         throw new Exception("Company not found", 404);
31
-      }
31
+        }
32 32
 
33
-      $myCompany = $this->manager->getRepository(People::class)->find($company);
33
+        $myCompany = $this->manager->getRepository(People::class)->find($company);
34 34
 
35
-      if ($myCompany === null) {
35
+        if ($myCompany === null) {
36 36
         throw new Exception("Company not found", 404);
37
-      }
37
+        }
38 38
 
39
-      $currentUser = $this->security->getToken()->getUser();
40
-      $userPeople = $currentUser->getPeople();
39
+        $currentUser = $this->security->getToken()->getUser();
40
+        $userPeople = $currentUser->getPeople();
41 41
 
42
-      $menu = $this->getMenuByPeople($userPeople, $myCompany);
42
+        $menu = $this->getMenuByPeople($userPeople, $myCompany);
43 43
 
44
-      return new JsonResponse([
44
+        return new JsonResponse([
45 45
         'response' => [
46
-          'data' => $menu,
47
-          'count' => 1,
48
-          'error' => '',
49
-          'success' => true,
46
+            'data' => $menu,
47
+            'count' => 1,
48
+            'error' => '',
49
+            'success' => true,
50 50
         ],
51
-      ]);
51
+        ]);
52 52
     } catch (\Exception $e) {
53
-      return new JsonResponse([
53
+        return new JsonResponse([
54 54
         'response' => [
55
-          'data' => [],
56
-          'count' => 0,
57
-          'error' => $e->getMessage(),
58
-          'success' => false,
55
+            'data' => [],
56
+            'count' => 0,
57
+            'error' => $e->getMessage(),
58
+            'success' => false,
59 59
         ],
60
-      ]);
60
+        ]);
61
+    }
61 62
     }
62
-  }
63 63
 
64
-  private function getMenuByPeople(People $userPeople, People $myCompany)
65
-  {
64
+    private function getMenuByPeople(People $userPeople, People $myCompany)
65
+    {
66 66
     $return = [];
67 67
     $connection = $this->manager->getConnection();
68 68
 
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
                 GROUP BY action.id';
79 79
 
80 80
     $params = [
81
-      'myCompany' => $myCompany->getId(),
82
-      'userPeople' => $userPeople->getId(),
83
-      'route' => $this->route,
81
+        'myCompany' => $myCompany->getId(),
82
+        'userPeople' => $userPeople->getId(),
83
+        'route' => $this->route,
84 84
     ];
85 85
 
86 86
     $result = $connection->executeQuery($sql, $params)->fetchAllAssociative();
87 87
 
88 88
     foreach ($result as $action) {
89
-      $return['routes'][trim($action['route'])]['actions'][$action['id']] = trim($action['action']);
89
+        $return['routes'][trim($action['route'])]['actions'][$action['id']] = trim($action['action']);
90 90
     }
91 91
 
92 92
     return $return;
93
-  }
93
+    }
94 94
 }
Please login to merge, or discard this patch.
src/Controller/GetFileDataAction.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@  discard block
 block discarded – undo
52 52
             ]);
53 53
             $file = $data;
54 54
             //$file = $this->manager->getRepository(File::class)->findOneBy(['url' => $request->getPathInfo()]);
55
-            if (!$file)
56
-                throw new \Exception('Not found', 404);
55
+            if (!$file) {
56
+                            throw new \Exception('Not found', 404);
57
+            }
57 58
 
58 59
 
59 60
             $content  = $file->getContent();
@@ -69,10 +70,11 @@  discard block
 block discarded – undo
69 70
                 $response->headers->set('Content-Type', "$fileType/$ext");
70 71
             }
71 72
 
72
-            if ($fileType == 'image')
73
-                $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_INLINE, basename($request->getPathInfo()));
74
-            else
75
-                $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_ATTACHMENT, basename($request->getPathInfo()));
73
+            if ($fileType == 'image') {
74
+                            $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_INLINE, basename($request->getPathInfo()));
75
+            } else {
76
+                            $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_ATTACHMENT, basename($request->getPathInfo()));
77
+            }
76 78
 
77 79
             $response->headers->set('Content-Disposition', $disposition);
78 80
 
Please login to merge, or discard this patch.