Passed
Push — master ( 43c91b...257185 )
by Luiz Kim
02:24
created
src/Listener/LogListener.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -125,15 +125,16 @@
 block discarded – undo
125 125
 
126 126
     private function log()
127 127
     {
128
-        if (get_class($this->entity) == 'ControleOnline\Entity\Webapi\Usuario')
129
-            $this->user = $this->entity;
130
-        else
131
-            $this->log[] =
128
+        if (get_class($this->entity) == 'ControleOnline\Entity\Webapi\Usuario') {
129
+                    $this->user = $this->entity;
130
+        } else {
131
+                    $this->log[] =
132 132
                 [
133 133
                     'action' => $this->action,
134 134
                     'class' => str_replace('Proxies\\__CG__\\', '', get_class($this->entity)),
135 135
                     'object' =>    $this->getObject($this->entity)
136 136
                 ];
137
+        }
137 138
     }
138 139
 
139 140
     private function getObject($entity)
Please login to merge, or discard this patch.
src/Controller/GetThemeColorsAction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
         $css = ':root{' . PHP_EOL;
35 35
         foreach ($theme->getColors(true) as $index => $color) {
36 36
             $css .= '    --q-' . $index . ': ' . $color . ';' . PHP_EOL;
37
-            $css .= '    --'   . $index . ': ' . $color . ';' . PHP_EOL;
37
+            $css .= '    --' . $index . ': ' . $color . ';' . PHP_EOL;
38 38
         }
39 39
         $css .= '}';
40 40
         return new Response($css, Response::HTTP_OK, [
Please login to merge, or discard this patch.
src/Service/HydratorService.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -89,11 +89,13 @@
 block discarded – undo
89 89
     private function getMembers($class, $groups, mixed $arguments = [], int $limit = 0, int $page = 1, array $orderby = [])
90 90
     {
91 91
 
92
-        if ($limit < 1)
93
-            $limit = $this->request->get('itemsPerPage') ?: 50;
92
+        if ($limit < 1) {
93
+                    $limit = $this->request->get('itemsPerPage') ?: 50;
94
+        }
94 95
 
95
-        if ($page == 1)
96
-            $offset = (($page = $this->request->get('page') ?: 1) - 1) * $limit;
96
+        if ($page == 1) {
97
+                    $offset = (($page = $this->request->get('page') ?: 1) - 1) * $limit;
98
+        }
97 99
 
98 100
         $data =     $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset);
99 101
 
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -31,23 +31,23 @@  discard block
 block discarded – undo
31 31
         return $e;
32 32
     }
33 33
 
34
-    public function collectionData($data, $class, $groups,  mixed $arguments = [])
34
+    public function collectionData($data, $class, $groups, mixed $arguments = [])
35 35
     {
36 36
         $response = $this->getBasicResponse($class);
37 37
 
38
-        $response['hydra:member']      =   $this->data($data, $groups);
39
-        $response['hydra:search']       =   $this->getSearch($class);
40
-        $response['hydra:totalItems']   =   $this->getCount($class, $arguments);
38
+        $response['hydra:member'] = $this->data($data, $groups);
39
+        $response['hydra:search']       = $this->getSearch($class);
40
+        $response['hydra:totalItems']   = $this->getCount($class, $arguments);
41 41
 
42 42
         return $response;
43 43
     }
44
-    public function collection($class, $groups,  mixed $arguments = [], int $limit = 0, int $page = 1, array $orderby = [])
44
+    public function collection($class, $groups, mixed $arguments = [], int $limit = 0, int $page = 1, array $orderby = [])
45 45
     {
46 46
         $response = $this->getBasicResponse($class);
47 47
 
48
-        $response['hydra:member']      =   $this->getMembers($class, $groups, $arguments, $limit, $page, $orderby);
49
-        $response['hydra:search']       =   $this->getSearch($class);
50
-        $response['hydra:totalItems']   =   $this->getCount($class, $arguments);
48
+        $response['hydra:member'] = $this->getMembers($class, $groups, $arguments, $limit, $page, $orderby);
49
+        $response['hydra:search']       = $this->getSearch($class);
50
+        $response['hydra:totalItems']   = $this->getCount($class, $arguments);
51 51
 
52 52
         return $response;
53 53
     }
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
         //$response = $this->getBasicResponse($class);
58 58
         //$response['hydra:search']       =   $this->getSearch($class);
59 59
 
60
-        $response['hydra:member']      =  $result;
61
-        $response['hydra:totalItems']   =   count($response['hydra:member']);
60
+        $response['hydra:member'] = $result;
61
+        $response['hydra:totalItems'] = count($response['hydra:member']);
62 62
 
63 63
         return $response;
64 64
     }
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
         $className = substr($class, strrpos($class, '\\') + 1);
82 82
 
83 83
         $response['@id']        = '/' . strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $className)) . 's';
84
-        $response['@context']   =   "/contexts/" . $className;
85
-        $response['@type']      =   "hydra:Collection";
84
+        $response['@context']   = "/contexts/" . $className;
85
+        $response['@type']      = "hydra:Collection";
86 86
 
87 87
         $response['hydra:view'] = [
88 88
             '@id' =>   $this->uri,
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         if ($page == 1)
101 101
             $offset = (($page = $this->request->get('page') ?: 1) - 1) * $limit;
102 102
 
103
-        $data =     $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset);
103
+        $data = $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset);
104 104
 
105 105
         return $this->serialize($data, ['groups' => $groups]);
106 106
     }
Please login to merge, or discard this patch.
src/Repository/AddressRepository.php 3 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -22,65 +22,65 @@
 block discarded – undo
22 22
 
23 23
     public function findOneByCityStateCountryOfPeople(string $city, string $state, string $country, People $people): ?Address
24 24
     {
25
-      $result = $this->createQueryBuilder('a')
26
-                  ->innerJoin         ('a.street'  , 's')
27
-                  ->innerJoin         ('s.district', 'd')
28
-                  ->innerJoin         ('d.city'    , 'c')
29
-                  ->innerJoin         ('c.state'   , 'e')
30
-                  ->innerJoin         ('e.country' , 'u')
25
+        $result = $this->createQueryBuilder('a')
26
+                    ->innerJoin         ('a.street'  , 's')
27
+                    ->innerJoin         ('s.district', 'd')
28
+                    ->innerJoin         ('d.city'    , 'c')
29
+                    ->innerJoin         ('c.state'   , 'e')
30
+                    ->innerJoin         ('e.country' , 'u')
31 31
 
32
-                  ->andWhere          ('c.city        = :city'   )
33
-                  ->andWhere          ('e.uf          = :state'  )
34
-                  ->andWhere          ('u.countryname = :country')
35
-                  ->andWhere          ('a.people      = :people' )
32
+                    ->andWhere          ('c.city        = :city'   )
33
+                    ->andWhere          ('e.uf          = :state'  )
34
+                    ->andWhere          ('u.countryname = :country')
35
+                    ->andWhere          ('a.people      = :people' )
36 36
 
37
-                  ->setParameter      ('city'   , $city   )
38
-                  ->setParameter      ('state'  , $state  )
39
-                  ->setParameter      ('country', $country)
40
-                  ->setParameter      ('people' , $people)
37
+                    ->setParameter      ('city'   , $city   )
38
+                    ->setParameter      ('state'  , $state  )
39
+                    ->setParameter      ('country', $country)
40
+                    ->setParameter      ('people' , $people)
41 41
 
42
-                  ->getQuery()
43
-                  ->getResult()
44
-              ;
42
+                    ->getQuery()
43
+                    ->getResult()
44
+                ;
45 45
 
46
-      if (empty($result))
46
+        if (empty($result))
47 47
         return null;
48 48
 
49
-      return $result[0];
49
+        return $result[0];
50 50
     }
51 51
 
52 52
     public function findPeopleAddressBy(People $people, array $criteria): ?Address
53 53
     {
54
-      $result = $this->createQueryBuilder('a')
55
-                  ->innerJoin         ('a.street'  , 's')
56
-                  ->innerJoin         ('s.district', 'd')
57
-                  ->innerJoin         ('d.city'    , 'c')
58
-                  ->innerJoin         ('c.state'   , 'e')
59
-                  ->innerJoin         ('e.country' , 'u')
54
+        $result = $this->createQueryBuilder('a')
55
+                    ->innerJoin         ('a.street'  , 's')
56
+                    ->innerJoin         ('s.district', 'd')
57
+                    ->innerJoin         ('d.city'    , 'c')
58
+                    ->innerJoin         ('c.state'   , 'e')
59
+                    ->innerJoin         ('e.country' , 'u')
60 60
 
61
-                  ->andWhere          ('a.people      = :people'  )
62
-                  ->andWhere          ('u.countryname = :country' )
63
-                  ->andWhere          ('(e.uf = :state OR e.state = :state)')
64
-                  ->andWhere          ('c.city        = :city'    )
65
-                  ->andWhere          ('d.district    = :district')
66
-                  ->andWhere          ('s.street      = :street'  )
67
-                  ->andWhere          ('a.number      = :number'  )
61
+                    ->andWhere          ('a.people      = :people'  )
62
+                    ->andWhere          ('u.countryname = :country' )
63
+                    ->andWhere          ('(e.uf = :state OR e.state = :state)')
64
+                    ->andWhere          ('c.city        = :city'    )
65
+                    ->andWhere          ('d.district    = :district')
66
+                    ->andWhere          ('s.street      = :street'  )
67
+                    ->andWhere          ('a.number      = :number'  )
68 68
 
69
-                  ->setParameter      ('people'  , $people)
70
-                  ->setParameter      ('country' , $criteria['country'] )
71
-                  ->setParameter      ('state'   , $criteria['state']   )
72
-                  ->setParameter      ('city'    , $criteria['city']    )
73
-                  ->setParameter      ('district', $criteria['district'])
74
-                  ->setParameter      ('street'  , $criteria['street']  )
75
-                  ->setParameter      ('number'  , $criteria['number']  )
69
+                    ->setParameter      ('people'  , $people)
70
+                    ->setParameter      ('country' , $criteria['country'] )
71
+                    ->setParameter      ('state'   , $criteria['state']   )
72
+                    ->setParameter      ('city'    , $criteria['city']    )
73
+                    ->setParameter      ('district', $criteria['district'])
74
+                    ->setParameter      ('street'  , $criteria['street']  )
75
+                    ->setParameter      ('number'  , $criteria['number']  )
76 76
 
77
-                  ->getQuery()
78
-                  ->getResult()
79
-              ;
77
+                    ->getQuery()
78
+                    ->getResult()
79
+                ;
80 80
 
81
-      if (empty($result))
81
+        if (empty($result))
82 82
         return null;
83 83
 
84
-      return $result[0];
84
+        return $result[0];
85 85
     }
86 86
 }
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -23,21 +23,21 @@  discard block
 block discarded – undo
23 23
     public function findOneByCityStateCountryOfPeople(string $city, string $state, string $country, People $people): ?Address
24 24
     {
25 25
       $result = $this->createQueryBuilder('a')
26
-                  ->innerJoin         ('a.street'  , 's')
27
-                  ->innerJoin         ('s.district', 'd')
28
-                  ->innerJoin         ('d.city'    , 'c')
29
-                  ->innerJoin         ('c.state'   , 'e')
30
-                  ->innerJoin         ('e.country' , 'u')
26
+                  ->innerJoin('a.street', 's')
27
+                  ->innerJoin('s.district', 'd')
28
+                  ->innerJoin('d.city', 'c')
29
+                  ->innerJoin('c.state', 'e')
30
+                  ->innerJoin('e.country', 'u')
31 31
 
32
-                  ->andWhere          ('c.city        = :city'   )
33
-                  ->andWhere          ('e.uf          = :state'  )
34
-                  ->andWhere          ('u.countryname = :country')
35
-                  ->andWhere          ('a.people      = :people' )
32
+                  ->andWhere('c.city        = :city')
33
+                  ->andWhere('e.uf          = :state')
34
+                  ->andWhere('u.countryname = :country')
35
+                  ->andWhere('a.people      = :people')
36 36
 
37
-                  ->setParameter      ('city'   , $city   )
38
-                  ->setParameter      ('state'  , $state  )
39
-                  ->setParameter      ('country', $country)
40
-                  ->setParameter      ('people' , $people)
37
+                  ->setParameter('city', $city)
38
+                  ->setParameter('state', $state)
39
+                  ->setParameter('country', $country)
40
+                  ->setParameter('people', $people)
41 41
 
42 42
                   ->getQuery()
43 43
                   ->getResult()
@@ -52,27 +52,27 @@  discard block
 block discarded – undo
52 52
     public function findPeopleAddressBy(People $people, array $criteria): ?Address
53 53
     {
54 54
       $result = $this->createQueryBuilder('a')
55
-                  ->innerJoin         ('a.street'  , 's')
56
-                  ->innerJoin         ('s.district', 'd')
57
-                  ->innerJoin         ('d.city'    , 'c')
58
-                  ->innerJoin         ('c.state'   , 'e')
59
-                  ->innerJoin         ('e.country' , 'u')
55
+                  ->innerJoin('a.street', 's')
56
+                  ->innerJoin('s.district', 'd')
57
+                  ->innerJoin('d.city', 'c')
58
+                  ->innerJoin('c.state', 'e')
59
+                  ->innerJoin('e.country', 'u')
60 60
 
61
-                  ->andWhere          ('a.people      = :people'  )
62
-                  ->andWhere          ('u.countryname = :country' )
63
-                  ->andWhere          ('(e.uf = :state OR e.state = :state)')
64
-                  ->andWhere          ('c.city        = :city'    )
65
-                  ->andWhere          ('d.district    = :district')
66
-                  ->andWhere          ('s.street      = :street'  )
67
-                  ->andWhere          ('a.number      = :number'  )
61
+                  ->andWhere('a.people      = :people')
62
+                  ->andWhere('u.countryname = :country')
63
+                  ->andWhere('(e.uf = :state OR e.state = :state)')
64
+                  ->andWhere('c.city        = :city')
65
+                  ->andWhere('d.district    = :district')
66
+                  ->andWhere('s.street      = :street')
67
+                  ->andWhere('a.number      = :number')
68 68
 
69
-                  ->setParameter      ('people'  , $people)
70
-                  ->setParameter      ('country' , $criteria['country'] )
71
-                  ->setParameter      ('state'   , $criteria['state']   )
72
-                  ->setParameter      ('city'    , $criteria['city']    )
73
-                  ->setParameter      ('district', $criteria['district'])
74
-                  ->setParameter      ('street'  , $criteria['street']  )
75
-                  ->setParameter      ('number'  , $criteria['number']  )
69
+                  ->setParameter('people', $people)
70
+                  ->setParameter('country', $criteria['country'])
71
+                  ->setParameter('state', $criteria['state'])
72
+                  ->setParameter('city', $criteria['city'])
73
+                  ->setParameter('district', $criteria['district'])
74
+                  ->setParameter('street', $criteria['street'])
75
+                  ->setParameter('number', $criteria['number'])
76 76
 
77 77
                   ->getQuery()
78 78
                   ->getResult()
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,8 +43,9 @@  discard block
 block discarded – undo
43 43
                   ->getResult()
44 44
               ;
45 45
 
46
-      if (empty($result))
47
-        return null;
46
+      if (empty($result)) {
47
+              return null;
48
+      }
48 49
 
49 50
       return $result[0];
50 51
     }
@@ -78,8 +79,9 @@  discard block
 block discarded – undo
78 79
                   ->getResult()
79 80
               ;
80 81
 
81
-      if (empty($result))
82
-        return null;
82
+      if (empty($result)) {
83
+              return null;
84
+      }
83 85
 
84 86
       return $result[0];
85 87
     }
Please login to merge, or discard this patch.
src/Controller/GetMenuByPeopleAction.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
    *
27 27
    * @var Request
28 28
    */
29
-  private $request  = null;
29
+  private $request = null;
30 30
 
31 31
   /**
32 32
    * Security
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
   {
53 53
     try {
54 54
 
55
-      $menu  = [];
55
+      $menu = [];
56 56
 
57 57
       $company = $request->query->get('myCompany', null);
58 58
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
        */
75 75
       $userPeople = $currentUser->getPeople();
76 76
 
77
-      $menu =  $this->getMenuByPeople($userPeople, $myCompany);
77
+      $menu = $this->getMenuByPeople($userPeople, $myCompany);
78 78
 
79 79
 
80 80
       return new JsonResponse([
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 
107 107
     // build query
108 108
 
109
-    $sql  = 'SELECT menu.*,
109
+    $sql = 'SELECT menu.*,
110 110
             category.name AS category_label,
111 111
             category.color AS category_color,
112 112
             routes.route AS route,
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 
123 123
     $params = [];
124 124
 
125
-    $params['myCompany']   = $myCompany->getId();
126
-    $params['userPeople']   = $userPeople->getId();
125
+    $params['myCompany'] = $myCompany->getId();
126
+    $params['userPeople'] = $userPeople->getId();
127 127
     // execute query
128 128
 
129 129
     $statement = $connection->prepare($sql);
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,15 +56,17 @@
 block discarded – undo
56 56
 
57 57
       $company = $request->query->get('myCompany', null);
58 58
 
59
-      if ($company === null)
60
-        throw new Exception("Company not found", 404);
59
+      if ($company === null) {
60
+              throw new Exception("Company not found", 404);
61
+      }
61 62
 
62 63
 
63 64
       $myCompany = $this->manager->getRepository(People::class)
64 65
         ->find($company);
65 66
 
66
-      if ($myCompany === null)
67
-        throw new Exception("Company not found", 404);
67
+      if ($myCompany === null) {
68
+              throw new Exception("Company not found", 404);
69
+      }
68 70
 
69 71
 
70 72
 
Please login to merge, or discard this patch.
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -14,92 +14,92 @@  discard block
 block discarded – undo
14 14
 
15 15
 class GetMenuByPeopleAction
16 16
 {
17
-  /**
18
-   * Entity Manager
19
-   *
20
-   * @var EntityManagerInterface
21
-   */
22
-  private $manager = null;
23
-
24
-  /**
25
-   * Request
26
-   *
27
-   * @var Request
28
-   */
29
-  private $request  = null;
30
-
31
-  /**
32
-   * Security
33
-   *
34
-   * @var Security
35
-   */
36
-  private $security = null;
37
-
38
-  /**
39
-   * @var \ControleOnline\Repository\MenuRepository
40
-   */
41
-  private $repository = null;
42
-
43
-
44
-  public function __construct(Security $security, EntityManagerInterface $entityManager)
45
-  {
17
+    /**
18
+     * Entity Manager
19
+     *
20
+     * @var EntityManagerInterface
21
+     */
22
+    private $manager = null;
23
+
24
+    /**
25
+     * Request
26
+     *
27
+     * @var Request
28
+     */
29
+    private $request  = null;
30
+
31
+    /**
32
+     * Security
33
+     *
34
+     * @var Security
35
+     */
36
+    private $security = null;
37
+
38
+    /**
39
+     * @var \ControleOnline\Repository\MenuRepository
40
+     */
41
+    private $repository = null;
42
+
43
+
44
+    public function __construct(Security $security, EntityManagerInterface $entityManager)
45
+    {
46 46
     $this->manager    = $entityManager;
47 47
     $this->security   = $security;
48 48
     $this->repository = $this->manager->getRepository(\ControleOnline\Entity\Menu::class);
49
-  }
49
+    }
50 50
 
51
-  public function __invoke(Request $request): JsonResponse
52
-  {
51
+    public function __invoke(Request $request): JsonResponse
52
+    {
53 53
     try {
54 54
 
55
-      $menu  = [];
55
+        $menu  = [];
56 56
 
57
-      $company = $request->query->get('myCompany', null);
57
+        $company = $request->query->get('myCompany', null);
58 58
 
59
-      if ($company === null)
59
+        if ($company === null)
60 60
         throw new Exception("Company not found", 404);
61 61
 
62 62
 
63
-      $myCompany = $this->manager->getRepository(People::class)
63
+        $myCompany = $this->manager->getRepository(People::class)
64 64
         ->find($company);
65 65
 
66
-      if ($myCompany === null)
66
+        if ($myCompany === null)
67 67
         throw new Exception("Company not found", 404);
68 68
 
69 69
 
70 70
 
71
-      $currentUser = $this->security->getUser();
72
-      /**
73
-       * @var People
74
-       */
75
-      $userPeople = $currentUser->getPeople();
71
+        $currentUser = $this->security->getUser();
72
+        /**
73
+         * @var People
74
+         */
75
+        $userPeople = $currentUser->getPeople();
76 76
 
77
-      $menu =  $this->getMenuByPeople($userPeople, $myCompany);
77
+        $menu =  $this->getMenuByPeople($userPeople, $myCompany);
78 78
 
79 79
 
80
-      return new JsonResponse([
80
+        return new JsonResponse([
81 81
         'response' => [
82
-          'data'    => $menu,
83
-          'count'   => 1,
84
-          'error'   => '',
85
-          'success' => true,
82
+            'data'    => $menu,
83
+            'count'   => 1,
84
+            'error'   => '',
85
+            'success' => true,
86 86
         ],
87
-      ]);
87
+        ]);
88 88
     } catch (\Exception $e) {
89 89
 
90
-      return new JsonResponse([
90
+        return new JsonResponse([
91 91
         'response' => [
92
-          'data'    => [],
93
-          'count'   => 0,
94
-          'error'   => $e->getMessage(),
95
-          'success' => false,
92
+            'data'    => [],
93
+            'count'   => 0,
94
+            'error'   => $e->getMessage(),
95
+            'success' => false,
96 96
         ],
97
-      ]);
97
+        ]);
98
+    }
98 99
     }
99
-  }
100 100
 
101
-  private function getMenuByPeople(People $userPeople, People $myCompany)
102
-  {
101
+    private function getMenuByPeople(People $userPeople, People $myCompany)
102
+    {
103 103
 
104 104
     $return = [];
105 105
     $connection = $this->manager->getConnection();
@@ -136,22 +136,22 @@  discard block
 block discarded – undo
136 136
 
137 137
     foreach ($result as $menu) {
138 138
 
139
-      $return['modules'][$menu['category_id']]['id'] = $menu['category_id'];
140
-      $return['modules'][$menu['category_id']]['label'] = $menu['category_label'];
141
-      $return['modules'][$menu['category_id']]['color'] = $menu['category_color'];
142
-      $return['modules'][$menu['category_id']]['icon'] = $menu['category_icon'];
143
-      $return['modules'][$menu['category_id']]['menus'][] = [
139
+        $return['modules'][$menu['category_id']]['id'] = $menu['category_id'];
140
+        $return['modules'][$menu['category_id']]['label'] = $menu['category_label'];
141
+        $return['modules'][$menu['category_id']]['color'] = $menu['category_color'];
142
+        $return['modules'][$menu['category_id']]['icon'] = $menu['category_icon'];
143
+        $return['modules'][$menu['category_id']]['menus'][] = [
144 144
         'id' => $menu['id'],
145 145
         'label' =>  $menu['menu'],
146 146
         'icon' =>  $menu['icon'],
147 147
         'color' =>  $menu['color'],
148 148
         'route' =>  $menu['route'],
149 149
         'module' =>  '/modules/' . $menu['module'],
150
-      ];
150
+        ];
151 151
     }
152 152
 
153 153
 
154 154
 
155 155
     return $return;
156
-  }
156
+    }
157 157
 }
Please login to merge, or discard this patch.
src/Controller/GetActionByPeopleAction.php 3 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -14,91 +14,91 @@  discard block
 block discarded – undo
14 14
 
15 15
 class GetActionByPeopleAction
16 16
 {
17
-  /**
18
-   * Entity Manager
19
-   *
20
-   * @var EntityManagerInterface
21
-   */
22
-  private $manager = null;
23
-
24
-  /**
25
-   * Request
26
-   *
27
-   * @var Request
28
-   */
29
-  private $request  = null;
30
-
31
-  /**
32
-   * Security
33
-   *
34
-   * @var Security
35
-   */
36
-  private $security = null;
37
-
38
-  /**
39
-   * @var \ControleOnline\Repository\MenuRepository
40
-   */
41
-  private $repository = null;
42
-
43
-
44
-  public function __construct(Security $security, EntityManagerInterface $entityManager)
45
-  {
17
+    /**
18
+     * Entity Manager
19
+     *
20
+     * @var EntityManagerInterface
21
+     */
22
+    private $manager = null;
23
+
24
+    /**
25
+     * Request
26
+     *
27
+     * @var Request
28
+     */
29
+    private $request  = null;
30
+
31
+    /**
32
+     * Security
33
+     *
34
+     * @var Security
35
+     */
36
+    private $security = null;
37
+
38
+    /**
39
+     * @var \ControleOnline\Repository\MenuRepository
40
+     */
41
+    private $repository = null;
42
+
43
+
44
+    public function __construct(Security $security, EntityManagerInterface $entityManager)
45
+    {
46 46
     $this->manager    = $entityManager;
47 47
     $this->security   = $security;
48
-  }
48
+    }
49 49
 
50
-  public function __invoke(Request $request): JsonResponse
51
-  {
50
+    public function __invoke(Request $request): JsonResponse
51
+    {
52 52
     try {
53 53
 
54
-      $menu  = [];
54
+        $menu  = [];
55 55
 
56
-      $company = $request->query->get('myCompany', null);
56
+        $company = $request->query->get('myCompany', null);
57 57
 
58
-      if ($company === null)
58
+        if ($company === null)
59 59
         throw new Exception("Company not found", 404);
60 60
 
61 61
 
62
-      $myCompany = $this->manager->getRepository(People::class)
62
+        $myCompany = $this->manager->getRepository(People::class)
63 63
         ->find($company);
64 64
 
65
-      if ($myCompany === null)
65
+        if ($myCompany === null)
66 66
         throw new Exception("Company not found", 404);
67 67
 
68 68
 
69 69
 
70
-      $currentUser = $this->security->getUser();
71
-      /**
72
-       * @var People
73
-       */
74
-      $userPeople = $currentUser->getPeople();
70
+        $currentUser = $this->security->getUser();
71
+        /**
72
+         * @var People
73
+         */
74
+        $userPeople = $currentUser->getPeople();
75 75
 
76
-      $menu =  $this->getMenuByPeople($userPeople, $myCompany);
76
+        $menu =  $this->getMenuByPeople($userPeople, $myCompany);
77 77
 
78 78
 
79
-      return new JsonResponse([
79
+        return new JsonResponse([
80 80
         'response' => [
81
-          'data'    => $menu,
82
-          'count'   => 1,
83
-          'error'   => '',
84
-          'success' => true,
81
+            'data'    => $menu,
82
+            'count'   => 1,
83
+            'error'   => '',
84
+            'success' => true,
85 85
         ],
86
-      ]);
86
+        ]);
87 87
     } catch (\Exception $e) {
88 88
 
89
-      return new JsonResponse([
89
+        return new JsonResponse([
90 90
         'response' => [
91
-          'data'    => [],
92
-          'count'   => 0,
93
-          'error'   => $e->getMessage(),
94
-          'success' => false,
91
+            'data'    => [],
92
+            'count'   => 0,
93
+            'error'   => $e->getMessage(),
94
+            'success' => false,
95 95
         ],
96
-      ]);
96
+        ]);
97
+    }
97 98
     }
98
-  }
99 99
 
100
-  private function getMenuByPeople(People $userPeople, People $myCompany)
101
-  {
100
+    private function getMenuByPeople(People $userPeople, People $myCompany)
101
+    {
102 102
 
103 103
     $return = [];
104 104
     $connection = $this->manager->getConnection();
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
     $result = $statement->fetchAll();
134 134
 
135 135
     foreach ($result as $action) {
136
-      $return['routes'][trim($action['route'])]['actions'][$action['id']] = trim($action['action']);
136
+        $return['routes'][trim($action['route'])]['actions'][$action['id']] = trim($action['action']);
137 137
     }
138 138
 
139 139
     return $return;
140
-  }
140
+    }
141 141
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
    *
27 27
    * @var Request
28 28
    */
29
-  private $request  = null;
29
+  private $request = null;
30 30
 
31 31
   /**
32 32
    * Security
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
   {
52 52
     try {
53 53
 
54
-      $menu  = [];
54
+      $menu = [];
55 55
 
56 56
       $company = $request->query->get('myCompany', null);
57 57
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
        */
74 74
       $userPeople = $currentUser->getPeople();
75 75
 
76
-      $menu =  $this->getMenuByPeople($userPeople, $myCompany);
76
+      $menu = $this->getMenuByPeople($userPeople, $myCompany);
77 77
 
78 78
 
79 79
       return new JsonResponse([
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
     // build query
107 107
 
108
-    $sql  = 'SELECT action.*,routes.route
108
+    $sql = 'SELECT action.*,routes.route
109 109
 
110 110
     FROM action 
111 111
        INNER JOIN routes ON routes.id = action.route_id
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 
123 123
     $params = [];
124 124
 
125
-    $params['myCompany']   = $myCompany->getId();
126
-    $params['userPeople']   = $userPeople->getId();
127
-    $params['route']   = $this->route;
125
+    $params['myCompany'] = $myCompany->getId();
126
+    $params['userPeople'] = $userPeople->getId();
127
+    $params['route'] = $this->route;
128 128
     // execute query
129 129
 
130 130
     $statement = $connection->prepare($sql);
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,15 +56,17 @@
 block discarded – undo
56 56
 
57 57
       $company = $request->query->get('myCompany', null);
58 58
 
59
-      if ($company === null)
60
-        throw new Exception("Company not found", 404);
59
+      if ($company === null) {
60
+              throw new Exception("Company not found", 404);
61
+      }
61 62
 
62 63
 
63 64
       $myCompany = $this->manager->getRepository(People::class)
64 65
         ->find($company);
65 66
 
66
-      if ($myCompany === null)
67
-        throw new Exception("Company not found", 404);
67
+      if ($myCompany === null) {
68
+              throw new Exception("Company not found", 404);
69
+      }
68 70
 
69 71
 
70 72
 
Please login to merge, or discard this patch.
src/Repository/ConfigRepository.php 2 patches
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,8 +64,9 @@  discard block
 block discarded – undo
64 64
       ->getQuery()
65 65
       ->getResult();
66 66
 
67
-    if (empty($result))
68
-      return null;
67
+    if (empty($result)) {
68
+          return null;
69
+    }
69 70
 
70 71
     $configs = [];
71 72
 
@@ -88,8 +89,9 @@  discard block
 block discarded – undo
88 89
     ]);
89 90
 
90 91
 
91
-    if (empty($config) || $config->getConfigValue() != 'itau')
92
-      return null;
92
+    if (empty($config) || $config->getConfigValue() != 'itau') {
93
+          return null;
94
+    }
93 95
 
94 96
     $result = $this->createQueryBuilder('a')
95 97
       ->andWhere('a.people = :people')
@@ -99,8 +101,9 @@  discard block
 block discarded – undo
99 101
       ->getQuery()
100 102
       ->getResult();
101 103
 
102
-    if (empty($result))
103
-      return null;
104
+    if (empty($result)) {
105
+          return null;
106
+    }
104 107
 
105 108
     $configs = [];
106 109
 
@@ -125,8 +128,9 @@  discard block
 block discarded – undo
125 128
       ->getQuery()
126 129
       ->getResult();
127 130
 
128
-    if (empty($result))
129
-      return null;
131
+    if (empty($result)) {
132
+          return null;
133
+    }
130 134
 
131 135
     $configs = [];
132 136
 
Please login to merge, or discard this patch.
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -15,57 +15,57 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class ConfigRepository extends ServiceEntityRepository
17 17
 {
18
-  public function __construct(ManagerRegistry $registry)
19
-  {
18
+    public function __construct(ManagerRegistry $registry)
19
+    {
20 20
     parent::__construct($registry, Config::class);
21
-  }
21
+    }
22 22
 
23
-  public function updatePeopleConfigKey(People $people, string $key, string $value): void
24
-  {
23
+    public function updatePeopleConfigKey(People $people, string $key, string $value): void
24
+    {
25 25
     try {
26
-      $params = [];
26
+        $params = [];
27 27
 
28
-      $this->getEntityManager()->getConnection()
28
+        $this->getEntityManager()->getConnection()
29 29
         ->executeQuery('START TRANSACTION', $params);
30 30
 
31
-      $rawSQL = <<<SQL
31
+        $rawSQL = <<<SQL
32 32
           UPDATE config
33 33
             SET configValue = :value
34 34
           WHERE people_id = :id AND configKey = :key
35 35
         SQL;
36 36
 
37
-      $params = [
37
+        $params = [
38 38
         'id'    => $people->getId(),
39 39
         'key'   => $key,
40 40
         'value' => $value,
41
-      ];
41
+        ];
42 42
 
43
-      $this->getEntityManager()->getConnection()
43
+        $this->getEntityManager()->getConnection()
44 44
         ->executeQuery($rawSQL, $params);
45 45
 
46
-      $this->getEntityManager()->getConnection()
46
+        $this->getEntityManager()->getConnection()
47 47
         ->executeQuery('COMMIT', $params);
48 48
     } catch (\Exception $e) {
49
-      $this->getEntityManager()->getConnection()
49
+        $this->getEntityManager()->getConnection()
50 50
         ->executeQuery('ROLLBACK', $params);
51 51
 
52
-      throw new \Exception($e->getMessage());
52
+        throw new \Exception($e->getMessage());
53
+    }
53 54
     }
54
-  }
55 55
 
56
-  public function getKeyValuesByPeople(People $people, string $key): ?array
57
-  {
56
+    public function getKeyValuesByPeople(People $people, string $key): ?array
57
+    {
58 58
     $result = $this->createQueryBuilder('a')
59
-      ->andWhere('a.people = :people')
60
-      ->andWhere('a.configKey LIKE :prefix')
61
-      ->setParameter('people', $people)
62
-      ->setParameter('prefix', $key . '-%')
59
+        ->andWhere('a.people = :people')
60
+        ->andWhere('a.configKey LIKE :prefix')
61
+        ->setParameter('people', $people)
62
+        ->setParameter('prefix', $key . '-%')
63 63
 
64
-      ->getQuery()
65
-      ->getResult();
64
+        ->getQuery()
65
+        ->getResult();
66 66
 
67 67
     if (empty($result))
68
-      return null;
68
+        return null;
69 69
 
70 70
     $configs = [];
71 71
 
@@ -73,34 +73,34 @@  discard block
 block discarded – undo
73 73
      * @var Config $config
74 74
      */
75 75
     foreach ($result as $config) {
76
-      $configs[$config->getConfigKey()] = $config->getConfigValue();
76
+        $configs[$config->getConfigKey()] = $config->getConfigValue();
77 77
     }
78 78
 
79 79
     return $configs;
80
-  }
80
+    }
81 81
 
82
-  public function getItauConfigByPeople(People $people): ?array
83
-  {
82
+    public function getItauConfigByPeople(People $people): ?array
83
+    {
84 84
 
85 85
     $config = $this->getEntityManager()->getRepository(Config::class)->findOneBy([
86
-      'people' => $people,
87
-      'configKey' => 'payment_type'
86
+        'people' => $people,
87
+        'configKey' => 'payment_type'
88 88
     ]);
89 89
 
90 90
 
91 91
     if (empty($config) || $config->getConfigValue() != 'itau')
92
-      return null;
92
+        return null;
93 93
 
94 94
     $result = $this->createQueryBuilder('a')
95
-      ->andWhere('a.people = :people')
96
-      ->andWhere('a.configKey LIKE :prefix')
97
-      ->setParameter('people', $people)
98
-      ->setParameter('prefix', 'itau-shopline-%')
99
-      ->getQuery()
100
-      ->getResult();
95
+        ->andWhere('a.people = :people')
96
+        ->andWhere('a.configKey LIKE :prefix')
97
+        ->setParameter('people', $people)
98
+        ->setParameter('prefix', 'itau-shopline-%')
99
+        ->getQuery()
100
+        ->getResult();
101 101
 
102 102
     if (empty($result))
103
-      return null;
103
+        return null;
104 104
 
105 105
     $configs = [];
106 106
 
@@ -108,25 +108,25 @@  discard block
 block discarded – undo
108 108
      * @var Config $config
109 109
      */
110 110
     foreach ($result as $config) {
111
-      $configs[$config->getConfigKey()] = $config->getConfigValue();
111
+        $configs[$config->getConfigKey()] = $config->getConfigValue();
112 112
     }
113 113
 
114 114
     return $configs;
115
-  }
115
+    }
116 116
 
117
-  public function getMauticConfigByPeople(People $people): ?array
118
-  {
117
+    public function getMauticConfigByPeople(People $people): ?array
118
+    {
119 119
     $result = $this->createQueryBuilder('a')
120
-      ->andWhere('a.people = :people')
121
-      ->andWhere('a.configKey LIKE :prefix')
122
-      ->setParameter('people', $people)
123
-      ->setParameter('prefix', 'mautic-%')
120
+        ->andWhere('a.people = :people')
121
+        ->andWhere('a.configKey LIKE :prefix')
122
+        ->setParameter('people', $people)
123
+        ->setParameter('prefix', 'mautic-%')
124 124
 
125
-      ->getQuery()
126
-      ->getResult();
125
+        ->getQuery()
126
+        ->getResult();
127 127
 
128 128
     if (empty($result))
129
-      return null;
129
+        return null;
130 130
 
131 131
     $configs = [];
132 132
 
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
      * @var Config $config
135 135
      */
136 136
     foreach ($result as $config) {
137
-      $configs[$config->getConfigKey()] = $config->getConfigValue();
137
+        $configs[$config->getConfigKey()] = $config->getConfigValue();
138 138
     }
139 139
 
140 140
     return $configs;
141
-  }
141
+    }
142 142
 }
Please login to merge, or discard this patch.
src/Service/PusherService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
         try {
18 18
             $this->logger->info('Attempting to push message', ['data' => $data, 'topic' => $topic]);
19 19
             
20
-            $webSocketClient =  new Client('localhost', '8080');
20
+            $webSocketClient = new Client('localhost', '8080');
21 21
             $webSocketClient->connect();
22 22
             $webSocketClient->publish($topic, json_encode($data));
23 23
             $webSocketClient->disconnect();
Please login to merge, or discard this patch.
src/Controller/GetFileDataAction.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         $this->manager = $entityManager;
36 36
     }
37 37
 
38
-    public function __invoke(File $data,  Request $request)
38
+    public function __invoke(File $data, Request $request)
39 39
     {
40 40
 
41 41
         try {
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 
48 48
             $content  = $file->getContent();
49
-            $response = new StreamedResponse(function () use ($content) {
49
+            $response = new StreamedResponse(function() use ($content) {
50 50
                 fputs(fopen('php://output', 'wb'), $content);
51 51
             });
52 52
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,8 +41,9 @@  discard block
 block discarded – undo
41 41
         try {
42 42
             $file = $data;
43 43
             //$file = $this->manager->getRepository(File::class)->findOneBy(['url' => $request->getPathInfo()]);
44
-            if (!$file)
45
-                throw new \Exception('Not found', 404);
44
+            if (!$file) {
45
+                            throw new \Exception('Not found', 404);
46
+            }
46 47
 
47 48
 
48 49
             $content  = $file->getContent();
@@ -58,10 +59,11 @@  discard block
 block discarded – undo
58 59
                 $response->headers->set('Content-Type', "$fileType/$ext");
59 60
             }
60 61
 
61
-            if ($fileType == 'image')
62
-                $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_INLINE, basename($request->getPathInfo()));
63
-            else
64
-                $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_ATTACHMENT, basename($request->getPathInfo()));
62
+            if ($fileType == 'image') {
63
+                            $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_INLINE, basename($request->getPathInfo()));
64
+            } else {
65
+                            $disposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_ATTACHMENT, basename($request->getPathInfo()));
66
+            }
65 67
 
66 68
             $response->headers->set('Content-Disposition', $disposition);
67 69
 
Please login to merge, or discard this patch.