Passed
Push — master ( 3f2c08...1f4183 )
by Luiz Kim
13:11 queued 10:52
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/Entity/City.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,6 @@
 block discarded – undo
59 59
      *
60 60
      * @ORM\Column(name="cod_ibge", type="integer", nullable=true)
61 61
      * @Groups({"city_read","logistic_read","order_read", "people_read", "address_read", "delivery_region_read"})
62
-
63 62
      */
64 63
     private $cod_ibge;
65 64
     /**
Please login to merge, or discard this patch.
src/Entity/State.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,6 @@
 block discarded – undo
43 43
      *
44 44
      * @ORM\Column(name="cod_ibge", type="integer", nullable=true)
45 45
      * @Groups({"city_read","logistic_read","state_read", "order_read", "people_read", "address_read", "delivery_region_read"})
46
-
47 46
      */
48 47
     private $cod_ibge;
49 48
     /**
Please login to merge, or discard this patch.
src/Entity/Country.php 1 patch
Indentation   -16 removed lines patch added patch discarded remove patch
@@ -26,7 +26,6 @@  discard block
 block discarded – undo
26 26
      * @ORM\Id
27 27
      * @ORM\GeneratedValue(strategy="IDENTITY")
28 28
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
29
-
30 29
      */
31 30
     private $id;
32 31
     /**
@@ -34,7 +33,6 @@  discard block
 block discarded – undo
34 33
      *
35 34
      * @ORM\Column(name="countryCode", type="string", length=3, nullable=false)
36 35
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
37
-
38 36
      */
39 37
     private $countrycode;
40 38
     /**
@@ -49,7 +47,6 @@  discard block
 block discarded – undo
49 47
      *
50 48
      * @ORM\Column(name="currencyCode", type="string", length=3, nullable=true)
51 49
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
52
-
53 50
      */
54 51
     private $currencycode;
55 52
     /**
@@ -57,7 +54,6 @@  discard block
 block discarded – undo
57 54
      *
58 55
      * @ORM\Column(name="population", type="integer", nullable=true)
59 56
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
60
-
61 57
      */
62 58
     private $population;
63 59
     /**
@@ -65,7 +61,6 @@  discard block
 block discarded – undo
65 61
      *
66 62
      * @ORM\Column(name="fipsCode", type="string", length=2, nullable=true)
67 63
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
68
-
69 64
      */
70 65
     private $fipscode;
71 66
     /**
@@ -81,7 +76,6 @@  discard block
 block discarded – undo
81 76
      *
82 77
      * @ORM\Column(name="north", type="string", length=30, nullable=true)
83 78
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
84
-
85 79
      */
86 80
     private $north;
87 81
     /**
@@ -89,7 +83,6 @@  discard block
 block discarded – undo
89 83
      *
90 84
      * @ORM\Column(name="south", type="string", length=30, nullable=true)
91 85
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
92
-
93 86
      */
94 87
     private $south;
95 88
     /**
@@ -98,7 +91,6 @@  discard block
 block discarded – undo
98 91
      * @ORM\Column(name="east", type="string", length=30, nullable=true)
99 92
      * 
100 93
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
101
-
102 94
      */
103 95
     private $east;
104 96
     /**
@@ -106,7 +98,6 @@  discard block
 block discarded – undo
106 98
      *
107 99
      * @ORM\Column(name="west", type="string", length=30, nullable=true)
108 100
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
109
-
110 101
      */
111 102
     private $west;
112 103
     /**
@@ -114,7 +105,6 @@  discard block
 block discarded – undo
114 105
      *
115 106
      * @ORM\Column(name="capital", type="string", length=30, nullable=true)
116 107
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
117
-
118 108
      */
119 109
     private $capital;
120 110
     /**
@@ -122,7 +112,6 @@  discard block
 block discarded – undo
122 112
      *
123 113
      * @ORM\Column(name="continentName", type="string", length=15, nullable=true)
124 114
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
125
-
126 115
      */
127 116
     private $continentname;
128 117
     /**
@@ -130,7 +119,6 @@  discard block
 block discarded – undo
130 119
      *
131 120
      * @ORM\Column(name="continent", type="string", length=2, nullable=true)
132 121
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
133
-
134 122
      */
135 123
     private $continent;
136 124
     /**
@@ -138,7 +126,6 @@  discard block
 block discarded – undo
138 126
      *
139 127
      * @ORM\Column(name="areaInSqKm", type="string", length=20, nullable=true)
140 128
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
141
-
142 129
      */
143 130
     private $areainsqkm;
144 131
     /**
@@ -146,7 +133,6 @@  discard block
 block discarded – undo
146 133
      *
147 134
      * @ORM\Column(name="isoAlpha3", type="string", length=3, nullable=true)
148 135
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
149
-
150 136
      */
151 137
     private $isoalpha3;
152 138
     /**
@@ -154,7 +140,6 @@  discard block
 block discarded – undo
154 140
      *
155 141
      * @ORM\Column(name="geonameId", type="integer", nullable=true)
156 142
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
157
-
158 143
      */
159 144
     private $geonameid;
160 145
     /**
@@ -162,7 +147,6 @@  discard block
 block discarded – undo
162 147
      *
163 148
      * @ORM\OneToMany(targetEntity="ControleOnline\Entity\LanguageCountry", mappedBy="country")
164 149
      * @Groups({"city_read","logistic_read","state_read", "people_read", "address_read"})
165
-
166 150
      */
167 151
     private $languageCountry;
168 152
     /**
Please login to merge, or discard this patch.
src/Entity/Theme.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,6 @@
 block discarded – undo
66 66
      *
67 67
      * @ORM\Column(name="background", type="integer", nullable=true)
68 68
      * @Groups({"theme_read"})
69
-
70 69
      */
71 70
     private $background;
72 71
     /**
Please login to merge, or discard this patch.
src/Service/HydratorService.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
         $this->uri = $this->request ? $this->request->getPathInfo() : '';
43 43
     }
44 44
 
45
-    public function collection($class, $groups,  mixed $arguments = [], int $limit = 0, int $page = 1, array $orderby = [])
45
+    public function collection($class, $groups, mixed $arguments = [], int $limit = 0, int $page = 1, array $orderby = [])
46 46
     {
47 47
         $response = $this->getBasicResponse($class);
48 48
 
49
-        $response['hydra:member']      =   $this->getMembers($class, $groups, $arguments, $limit, $page, $orderby);
50
-        $response['hydra:search']       =   $this->getSearch($class);
51
-        $response['hydra:totalItems']   =   $this->getCount($class, $arguments);
49
+        $response['hydra:member'] = $this->getMembers($class, $groups, $arguments, $limit, $page, $orderby);
50
+        $response['hydra:search']       = $this->getSearch($class);
51
+        $response['hydra:totalItems']   = $this->getCount($class, $arguments);
52 52
 
53 53
         return $response;
54 54
     }
@@ -58,15 +58,15 @@  discard block
 block discarded – undo
58 58
         //$response = $this->getBasicResponse($class);
59 59
         //$response['hydra:search']       =   $this->getSearch($class);
60 60
 
61
-        $response['hydra:member']      =  $result;
62
-        $response['hydra:totalItems']   =   count($response['hydra:member']);
61
+        $response['hydra:member'] = $result;
62
+        $response['hydra:totalItems'] = count($response['hydra:member']);
63 63
 
64 64
         return $response;
65 65
     }
66 66
 
67 67
     public function item($class, $id, $groups)
68 68
     {
69
-        $data =     $this->manager->getRepository($class)->find(preg_replace("/[^0-9]/", "", $id));
69
+        $data = $this->manager->getRepository($class)->find(preg_replace("/[^0-9]/", "", $id));
70 70
         $analisesSerialized = $this->serializer->serialize($data, 'jsonld', ['groups' => $groups]);
71 71
         return json_decode($analisesSerialized);
72 72
     }
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
         $className = substr($class, strrpos($class, '\\') + 1);
77 77
 
78 78
         $response['@id']        = '/' . strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $className)) . 's';
79
-        $response['@context']   =   "/contexts/" . $className;
80
-        $response['@type']      =   "hydra:Collection";
79
+        $response['@context']   = "/contexts/" . $className;
80
+        $response['@type']      = "hydra:Collection";
81 81
 
82 82
         $response['hydra:view'] = [
83 83
             '@id' =>   $this->uri,
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         if ($page == 1)
96 96
             $offset = (($page = $this->request->get('page') ?: 1) - 1) * $limit;
97 97
 
98
-        $data =     $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset);
98
+        $data = $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset);
99 99
 
100 100
         return $this->serialize($data, ['groups' => $groups]);
101 101
     }
Please login to merge, or discard this patch.
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.
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
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();
@@ -133,21 +133,21 @@  discard block
 block discarded – undo
133 133
 
134 134
     foreach ($result as $menu) {
135 135
 
136
-      $return['modules'][$menu['category_id']]['id'] = $menu['category_id'];
137
-      $return['modules'][$menu['category_id']]['label'] = $menu['category_label'];
138
-      $return['modules'][$menu['category_id']]['color'] = $menu['category_color'];
139
-      $return['modules'][$menu['category_id']]['icon'] = $menu['category_icon'];
140
-      $return['modules'][$menu['category_id']]['menus'][] = [
136
+        $return['modules'][$menu['category_id']]['id'] = $menu['category_id'];
137
+        $return['modules'][$menu['category_id']]['label'] = $menu['category_label'];
138
+        $return['modules'][$menu['category_id']]['color'] = $menu['category_color'];
139
+        $return['modules'][$menu['category_id']]['icon'] = $menu['category_icon'];
140
+        $return['modules'][$menu['category_id']]['menus'][] = [
141 141
         'id' => $menu['id'],
142 142
         'label' =>  $menu['menu'],
143 143
         'icon' =>  $menu['icon'],
144 144
         'color' =>  $menu['color'],
145 145
         'route' =>  $menu['route'],
146
-      ];
146
+        ];
147 147
     }
148 148
 
149 149
 
150 150
 
151 151
     return $return;
152
-  }
152
+    }
153 153
 }
Please login to merge, or discard this patch.
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.