Passed
Push — master ( ba5c06...7a4132 )
by
unknown
24:32
created
src/Entity/DeviceConfig.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         return $this;
103 103
     }
104 104
 
105
-    public function getConfigs(bool $decode = false): string|array
105
+    public function getConfigs(bool $decode = false): string | array
106 106
     {
107 107
         // Ensure we're decoding a string, even if it was temporarily an array internally
108 108
         $configString = is_array($this->configs) ? json_encode($this->configs) : $this->configs;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         return $this->setConfigs($configs);
117 117
     }
118 118
 
119
-    public function setConfigs(string|array|object $configs): self
119
+    public function setConfigs(string | array | object $configs): self
120 120
     {
121 121
         if (is_string($configs))
122 122
             $configs = json_decode($configs, true);
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,8 +118,9 @@
 block discarded – undo
118 118
 
119 119
     public function setConfigs(string|array|object $configs): self
120 120
     {
121
-        if (is_string($configs))
122
-            $configs = json_decode($configs, true);
121
+        if (is_string($configs)) {
122
+                    $configs = json_decode($configs, true);
123
+        }
123 124
 
124 125
         $this->configs = json_encode($configs);
125 126
         return $this;
Please login to merge, or discard this patch.
src/Service/FileService.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,12 +19,13 @@
 block discarded – undo
19 19
 
20 20
   public function getFileUrl(People $people): ?array
21 21
   {
22
-    if ($people->getImage() instanceof File)
23
-      return [
22
+    if ($people->getImage() instanceof File) {
23
+          return [
24 24
         'id'     => $people->getImage()->getId(),
25 25
         'domain' => $this->domainService->getMainDomain(),
26 26
         'url'    => '/files/' . $people->getImage()->getId() . '/download'
27 27
       ];
28
+    }
28 29
 
29 30
     return null;
30 31
   }
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -10,33 +10,33 @@
 block discarded – undo
10 10
 class FileService
11 11
 {
12 12
 
13
-  public function __construct(
13
+    public function __construct(
14 14
     private EntityManagerInterface $manager,
15 15
     private DomainService $domainService
16 16
 
17
-  ) {}
17
+    ) {}
18 18
 
19 19
 
20
-  public function getFileUrl(People $people): ?array
21
-  {
20
+    public function getFileUrl(People $people): ?array
21
+    {
22 22
     if ($people->getImage() instanceof File)
23
-      return [
23
+        return [
24 24
         'id'     => $people->getImage()->getId(),
25 25
         'domain' => $this->domainService->getMainDomain(),
26 26
         'url'    => '/files/' . $people->getImage()->getId() . '/download'
27
-      ];
27
+        ];
28 28
 
29 29
     return null;
30
-  }
30
+    }
31 31
 
32
-  public function addFile(People $people, string  $content, string $context, ?string $fileName = null, ?string $fileType = null, ?string $extension = null): File
33
-  {
32
+    public function addFile(People $people, string  $content, string $context, ?string $fileName = null, ?string $fileType = null, ?string $extension = null): File
33
+    {
34 34
     return $this->manager->getRepository(File::class)->addFile($people, $content, $context, $fileName, $fileType, $extension);
35
-  }
35
+    }
36 36
 
37
-  public function removeFile(File $file)
38
-  {
37
+    public function removeFile(File $file)
38
+    {
39 39
     $this->manager->remove($file);
40 40
     $this->manager->flush();
41
-  }
41
+    }
42 42
 }
Please login to merge, or discard this patch.
src/Service/StatusService.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
 
18 18
     public function discoveryStatus($realStatus, $name, $context): Status
19 19
     {
20
-        $status =  $this->manager->getRepository(Status::class)->findOneBy([
20
+        $status = $this->manager->getRepository(Status::class)->findOneBy([
21 21
             'realStatus' => $realStatus,
22 22
             'status' => $name,
23 23
             'context' => $context,
Please login to merge, or discard this patch.
src/Entity/Spool.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
     #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
40 40
     #[ORM\Id]
41 41
     #[ORM\GeneratedValue(strategy: 'IDENTITY')]
42
-    #[Groups(['spool_item:read', 'spool:read',])]
42
+    #[Groups(['spool_item:read', 'spool:read', ])]
43 43
     #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])]
44 44
 
45 45
     private $id;
Please login to merge, or discard this patch.
src/Service/DeviceService.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,8 +22,9 @@  discard block
 block discarded – undo
22 22
         $devices = [];
23 23
         foreach ($device_configs as $device_config) {
24 24
             $configs = $device_config->getConfigs(true);
25
-            if (isset($configs['pos-gateway']) && $configs['pos-gateway'] == 'cielo')
26
-                $devices[] = $device_config->getDevice();
25
+            if (isset($configs['pos-gateway']) && $configs['pos-gateway'] == 'cielo') {
26
+                            $devices[] = $device_config->getDevice();
27
+            }
27 28
         }
28 29
         return $devices;
29 30
     }
@@ -64,8 +65,9 @@  discard block
 block discarded – undo
64 65
         $device = $this->discoveryDevice($deviceId);
65 66
 
66 67
         $device_config = $this->discoveryDeviceConfig($device,  $people);
67
-        foreach ($configs as $key => $config)
68
-            $device_config->addConfig($key,  $config);
68
+        foreach ($configs as $key => $config) {
69
+                    $device_config->addConfig($key,  $config);
70
+        }
69 71
 
70 72
         $this->manager->persist($device_config);
71 73
         $this->manager->flush();
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         return $devices;
29 29
     }
30 30
 
31
-    public function findDevices(array|string $devices)
31
+    public function findDevices(array | string $devices)
32 32
     {
33 33
         return $this->manager->getRepository(Device::class)->findBy([
34 34
             'device' => $devices
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
     {
71 71
         $device = $this->discoveryDevice($deviceId);
72 72
 
73
-        $device_config = $this->discoveryDeviceConfig($device,  $people);
73
+        $device_config = $this->discoveryDeviceConfig($device, $people);
74 74
         foreach ($configs as $key => $config)
75
-            $device_config->addConfig($key,  $config);
75
+            $device_config->addConfig($key, $config);
76 76
 
77 77
         $this->manager->persist($device_config);
78 78
         $this->manager->flush();
Please login to merge, or discard this patch.
src/Service/LoggerService.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,25 +9,25 @@
 block discarded – undo
9 9
 
10 10
 class LoggerService
11 11
 {
12
-  private static $loggers = [];
13
-  private string $logsDir;
12
+    private static $loggers = [];
13
+    private string $logsDir;
14 14
 
15
-  public function __construct(ParameterBagInterface $parameterBag)
16
-  {
15
+    public function __construct(ParameterBagInterface $parameterBag)
16
+    {
17 17
     $this->logsDir = $parameterBag->get('kernel.logs_dir');
18
-  }
18
+    }
19 19
 
20
-  public function getLogger(string $name): LoggerInterface
21
-  {
20
+    public function getLogger(string $name): LoggerInterface
21
+    {
22 22
     if (!isset(self::$loggers[$name])) {
23
-      $logger = new Logger($name);
24
-      $logger->pushHandler(new StreamHandler(
23
+        $logger = new Logger($name);
24
+        $logger->pushHandler(new StreamHandler(
25 25
         $this->logsDir . '/' . $name . '.log',
26 26
         Logger::INFO
27
-      ));
28
-      self::$loggers[$name] = $logger;
27
+        ));
28
+        self::$loggers[$name] = $logger;
29 29
     }
30 30
 
31 31
     return self::$loggers[$name];
32
-  }
32
+    }
33 33
 }
Please login to merge, or discard this patch.
src/Command/DefaultCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     {
26 26
         parent::__construct($name);
27 27
         $this->lock = $this->lockFactory->createLock($name);
28
-        $this->addOption('domain', ['d'], InputOption::VALUE_OPTIONAL,  'Database domain identifier');
28
+        $this->addOption('domain', ['d'], InputOption::VALUE_OPTIONAL, 'Database domain identifier');
29 29
     }
30 30
 
31 31
     protected function execute(InputInterface $input, OutputInterface $output): int
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         return Command::SUCCESS;
53 53
     }
54 54
 
55
-    public function addLog(string|iterable $messages, int $options = 0, ?string $logName = 'integration')
55
+    public function addLog(string | iterable $messages, int $options = 0, ?string $logName = 'integration')
56 56
     {
57 57
         $this->output->writeln($messages, $options);
58 58
         $this->loggerService->getLogger($logName)->info($messages);
Please login to merge, or discard this patch.
src/Service/AddressService.php 3 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     $district = ($district && $city) ? $this->discoveryDistrict($city, $district) : null;
45 45
     $street = ($streetName && $cep && $district) ? $this->discoveryStreet($cep, $district, $streetName) : null;
46 46
 
47
-    $address =  $this->manager->getRepository(Address::class)->findOneBy([
47
+    $address = $this->manager->getRepository(Address::class)->findOneBy([
48 48
       'people' => $people,
49 49
       'street' => $street,
50 50
       'number' => $streetNumber,
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
       'district' => $district,
92 92
       'street' => $streetName
93 93
     ];
94
-    $street =  $this->manager->getRepository(Street::class)->findOneBy($search);
94
+    $street = $this->manager->getRepository(Street::class)->findOneBy($search);
95 95
 
96 96
     if (!$street) {
97 97
       $street = new Street();
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
     $search['district'] = $districtName;
114 114
 
115
-    $district =  $this->manager->getRepository(District::class)->findOneBy($search);
115
+    $district = $this->manager->getRepository(District::class)->findOneBy($search);
116 116
 
117 117
     if (!$district) {
118 118
       $district = new District();
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     if ($cod_ibge)
137 137
       $search['cod_ibge'] = $cod_ibge;
138 138
 
139
-    $city =  $this->manager->getRepository(City::class)->findOneBy($search);
139
+    $city = $this->manager->getRepository(City::class)->findOneBy($search);
140 140
 
141 141
     if (!$city) {
142 142
       $city = new City();
Please login to merge, or discard this patch.
Braces   +27 added lines, -16 removed lines patch added patch discarded remove patch
@@ -59,8 +59,12 @@  discard block
 block discarded – undo
59 59
       $address->setStreet($street);
60 60
       $address->setPeople($people);
61 61
     }
62
-    if ($latitude > 0) $address->setLatitude($latitude);
63
-    if ($longitude > 0) $address->setLongitude($longitude);
62
+    if ($latitude > 0) {
63
+        $address->setLatitude($latitude);
64
+    }
65
+    if ($longitude > 0) {
66
+        $address->setLongitude($longitude);
67
+    }
64 68
 
65 69
 
66 70
     $this->manager->persist($address);
@@ -125,16 +129,19 @@  discard block
 block discarded – undo
125 129
   }
126 130
   public function discoveryCity(State $state, ?string $cityName = null, ?string $cod_ibge = null): City
127 131
   {
128
-    if (!$cityName && !$cod_ibge)
129
-      throw new Exception("Need a param to search city", 404);
132
+    if (!$cityName && !$cod_ibge) {
133
+          throw new Exception("Need a param to search city", 404);
134
+    }
130 135
 
131 136
     $search = [
132 137
       'state' => $state
133 138
     ];
134
-    if ($state)
135
-      $search['city'] = $cityName;
136
-    if ($cod_ibge)
137
-      $search['cod_ibge'] = $cod_ibge;
139
+    if ($state) {
140
+          $search['city'] = $cityName;
141
+    }
142
+    if ($cod_ibge) {
143
+          $search['cod_ibge'] = $cod_ibge;
144
+    }
138 145
 
139 146
     $city =  $this->manager->getRepository(City::class)->findOneBy($search);
140 147
 
@@ -150,18 +157,22 @@  discard block
 block discarded – undo
150 157
   }
151 158
   public function discoveryState(Country $country, ?string $uf = null, ?string $stateName = null, ?string $cod_ibge = null): State
152 159
   {
153
-    if (!$uf && !$stateName && !$cod_ibge)
154
-      throw new Exception("Need a param to search state", 404);
160
+    if (!$uf && !$stateName && !$cod_ibge) {
161
+          throw new Exception("Need a param to search state", 404);
162
+    }
155 163
 
156 164
     $search = [
157 165
       'country' => $country
158 166
     ];
159
-    if ($stateName)
160
-      $search['state'] = $stateName;
161
-    if ($cod_ibge)
162
-      $search['cod_ibge'] = $cod_ibge;
163
-    if ($uf)
164
-      $search['uf'] = $uf;
167
+    if ($stateName) {
168
+          $search['state'] = $stateName;
169
+    }
170
+    if ($cod_ibge) {
171
+          $search['cod_ibge'] = $cod_ibge;
172
+    }
173
+    if ($uf) {
174
+          $search['uf'] = $uf;
175
+    }
165 176
 
166 177
     $state = $this->manager->getRepository(State::class)->findOneBy($search);
167 178
 
Please login to merge, or discard this patch.
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 {
19 19
 
20 20
 
21
-  public function __construct(
21
+    public function __construct(
22 22
     private  EntityManagerInterface $manager
23
-  ) {}
23
+    ) {}
24 24
 
25
-  public function discoveryAddress(
25
+    public function discoveryAddress(
26 26
     ?People $people = null,
27 27
     int $postalCode,
28 28
     int $streetNumber,
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     ?int $latitude = 0,
36 36
     ?int $longitude = 0,
37 37
     ?string $nickName = 'Default',
38
-  ): Address {
38
+    ): Address {
39 39
 
40 40
     $cep = ($postalCode) ? $this->discoveryCep($postalCode) : null;
41 41
     $country = ($countryCode) ? $this->getCountry($countryCode) : null;
@@ -45,19 +45,19 @@  discard block
 block discarded – undo
45 45
     $street = ($streetName && $cep && $district) ? $this->discoveryStreet($cep, $district, $streetName) : null;
46 46
 
47 47
     $address =  $this->manager->getRepository(Address::class)->findOneBy([
48
-      'people' => $people,
49
-      'street' => $street,
50
-      'number' => $streetNumber,
51
-      'complement' => $complement
48
+        'people' => $people,
49
+        'street' => $street,
50
+        'number' => $streetNumber,
51
+        'complement' => $complement
52 52
     ]);
53 53
 
54 54
     if (!$address) {
55
-      $address = new Address();
56
-      $address->setNumber($streetNumber);
57
-      $address->setNickname($nickName);
58
-      $address->setComplement($complement);
59
-      $address->setStreet($street);
60
-      $address->setPeople($people);
55
+        $address = new Address();
56
+        $address->setNumber($streetNumber);
57
+        $address->setNickname($nickName);
58
+        $address->setComplement($complement);
59
+        $address->setStreet($street);
60
+        $address->setPeople($people);
61 61
     }
62 62
     if ($latitude > 0) $address->setLatitude($latitude);
63 63
     if ($longitude > 0) $address->setLongitude($longitude);
@@ -67,47 +67,47 @@  discard block
 block discarded – undo
67 67
     $this->manager->flush();
68 68
 
69 69
     return  $address;
70
-  }
70
+    }
71 71
 
72 72
 
73 73
 
74
-  public function discoveryCep(string $postalCode): Cep
75
-  {
74
+    public function discoveryCep(string $postalCode): Cep
75
+    {
76 76
     $cep = $this->manager->getRepository(Cep::class)->findOneBy(['cep' => $postalCode]);
77 77
 
78 78
     if (!$cep) {
79
-      $cep = new Cep();
80
-      $cep->setCep($postalCode);
81
-      $this->manager->persist($cep);
82
-      $this->manager->flush();
79
+        $cep = new Cep();
80
+        $cep->setCep($postalCode);
81
+        $this->manager->persist($cep);
82
+        $this->manager->flush();
83 83
     }
84 84
 
85 85
     return $cep;
86
-  }
87
-  public function discoveryStreet(Cep $cep, District $district, string $streetName): Street
88
-  {
86
+    }
87
+    public function discoveryStreet(Cep $cep, District $district, string $streetName): Street
88
+    {
89 89
     $search = [
90
-      'cep' => $cep,
91
-      'district' => $district,
92
-      'street' => $streetName
90
+        'cep' => $cep,
91
+        'district' => $district,
92
+        'street' => $streetName
93 93
     ];
94 94
     $street =  $this->manager->getRepository(Street::class)->findOneBy($search);
95 95
 
96 96
     if (!$street) {
97
-      $street = new Street();
98
-      $street->setCep($cep);
99
-      $street->setDistrict($district);
100
-      $street->setStreet($streetName);
101
-      $this->manager->persist($street);
102
-      $this->manager->flush();
97
+        $street = new Street();
98
+        $street->setCep($cep);
99
+        $street->setDistrict($district);
100
+        $street->setStreet($streetName);
101
+        $this->manager->persist($street);
102
+        $this->manager->flush();
103 103
     }
104 104
     return  $street;
105
-  }
105
+    }
106 106
 
107
-  public function discoveryDistrict(City $city, string $districtName): District
108
-  {
107
+    public function discoveryDistrict(City $city, string $districtName): District
108
+    {
109 109
     $search = [
110
-      'city' => $city
110
+        'city' => $city
111 111
     ];
112 112
 
113 113
     $search['district'] = $districtName;
@@ -115,71 +115,71 @@  discard block
 block discarded – undo
115 115
     $district =  $this->manager->getRepository(District::class)->findOneBy($search);
116 116
 
117 117
     if (!$district) {
118
-      $district = new District();
119
-      $district->setCity($city);
120
-      $district->setDistrict($districtName);
121
-      $this->manager->persist($district);
122
-      $this->manager->flush();
118
+        $district = new District();
119
+        $district->setCity($city);
120
+        $district->setDistrict($districtName);
121
+        $this->manager->persist($district);
122
+        $this->manager->flush();
123 123
     }
124 124
     return  $district;
125
-  }
126
-  public function discoveryCity(State $state, ?string $cityName = null, ?string $cod_ibge = null): City
127
-  {
125
+    }
126
+    public function discoveryCity(State $state, ?string $cityName = null, ?string $cod_ibge = null): City
127
+    {
128 128
     if (!$cityName && !$cod_ibge)
129
-      throw new Exception("Need a param to search city", 404);
129
+        throw new Exception("Need a param to search city", 404);
130 130
 
131 131
     $search = [
132
-      'state' => $state
132
+        'state' => $state
133 133
     ];
134 134
     if ($state)
135
-      $search['city'] = $cityName;
135
+        $search['city'] = $cityName;
136 136
     if ($cod_ibge)
137
-      $search['cod_ibge'] = $cod_ibge;
137
+        $search['cod_ibge'] = $cod_ibge;
138 138
 
139 139
     $city =  $this->manager->getRepository(City::class)->findOneBy($search);
140 140
 
141 141
     if (!$city) {
142
-      $city = new City();
143
-      $city->setCity($cityName);
144
-      $city->setState($state);
145
-      $city->setIbge($cod_ibge);
146
-      $this->manager->persist($city);
147
-      $this->manager->flush();
142
+        $city = new City();
143
+        $city->setCity($cityName);
144
+        $city->setState($state);
145
+        $city->setIbge($cod_ibge);
146
+        $this->manager->persist($city);
147
+        $this->manager->flush();
148 148
     }
149 149
     return  $city;
150
-  }
151
-  public function discoveryState(Country $country, ?string $uf = null, ?string $stateName = null, ?string $cod_ibge = null): State
152
-  {
150
+    }
151
+    public function discoveryState(Country $country, ?string $uf = null, ?string $stateName = null, ?string $cod_ibge = null): State
152
+    {
153 153
     if (!$uf && !$stateName && !$cod_ibge)
154
-      throw new Exception("Need a param to search state", 404);
154
+        throw new Exception("Need a param to search state", 404);
155 155
 
156 156
     $search = [
157
-      'country' => $country
157
+        'country' => $country
158 158
     ];
159 159
     if ($stateName)
160
-      $search['state'] = $stateName;
160
+        $search['state'] = $stateName;
161 161
     if ($cod_ibge)
162
-      $search['cod_ibge'] = $cod_ibge;
162
+        $search['cod_ibge'] = $cod_ibge;
163 163
     if ($uf)
164
-      $search['uf'] = $uf;
164
+        $search['uf'] = $uf;
165 165
 
166 166
     $state = $this->manager->getRepository(State::class)->findOneBy($search);
167 167
 
168 168
 
169 169
     if (!$state) {
170
-      $state = new State();
171
-      $state->setState($stateName);
172
-      $state->setIbge($cod_ibge);
173
-      $state->setUf($uf);
174
-      $state->setCountry($country);
175
-      $this->manager->persist($state);
176
-      $this->manager->flush();
170
+        $state = new State();
171
+        $state->setState($stateName);
172
+        $state->setIbge($cod_ibge);
173
+        $state->setUf($uf);
174
+        $state->setCountry($country);
175
+        $this->manager->persist($state);
176
+        $this->manager->flush();
177 177
     }
178 178
     return  $state;
179
-  }
179
+    }
180 180
 
181
-  public function getCountry(string $countryCode): Country
182
-  {
181
+    public function getCountry(string $countryCode): Country
182
+    {
183 183
     return $this->manager->getRepository(Country::class)->findOneBy(['countrycode' => $countryCode]);
184
-  }
184
+    }
185 185
 }
Please login to merge, or discard this patch.
src/Service/SkyNetService.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@
 block discarded – undo
17 17
 
18 18
     public function discoveryBotUser(): void
19 19
     {
20
-        if (!self::$botUser)
21
-            $bots = ['R2D2', 'C3PO', 'T800', 'SkyNet'];
20
+        if (!self::$botUser) {
21
+                    $bots = ['R2D2', 'C3PO', 'T800', 'SkyNet'];
22
+        }
22 23
 
23 24
         $online = array_rand($bots);
24 25
         $bot = $bots[$online];
Please login to merge, or discard this patch.