Passed
Push — master ( a5911f...28a360 )
by Luiz Kim
05:12 queued 02:40
created
src/Repository/AddressRepository.php 1 patch
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.
src/Service/WordPressService.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,24 +9,24 @@
 block discarded – undo
9 9
 class WordPressService
10 10
 {
11 11
 
12
-  public function __construct(private EntityManagerInterface $manager, private RequestStack $requestStack) {}
12
+    public function __construct(private EntityManagerInterface $manager, private RequestStack $requestStack) {}
13 13
 
14
-  public static function getAllPosts($domain, array $input): array
15
-  {
14
+    public static function getAllPosts($domain, array $input): array
15
+    {
16 16
 
17 17
     try {
18
-      $client   = new Client(['verify' => false]);
19
-      $response = $client->get($domain . '/wp-json/wp/v2/posts', [
18
+        $client   = new Client(['verify' => false]);
19
+        $response = $client->get($domain . '/wp-json/wp/v2/posts', [
20 20
         'query' => $input
21
-      ]);
21
+        ]);
22 22
 
23
-      $result   = json_decode($response->getBody());
23
+        $result   = json_decode($response->getBody());
24 24
 
25
-      return $result;
25
+        return $result;
26 26
     } catch (\Exception $e) {
27
-      print_r($e);
27
+        print_r($e);
28 28
     }
29 29
 
30 30
     return null;
31
-  }
31
+    }
32 32
 }
Please login to merge, or discard this patch.
src/Repository/ConfigRepository.php 1 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/Repository/ModuleRepository.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@
 block discarded – undo
14 14
  */
15 15
 class ModuleRepository extends ServiceEntityRepository
16 16
 {
17
-  public function __construct(ManagerRegistry $registry)
18
-  {
17
+    public function __construct(ManagerRegistry $registry)
18
+    {
19 19
     parent::__construct($registry, Module::class);
20
-  }
20
+    }
21 21
 }
Please login to merge, or discard this patch.
src/Controller/DiscoveryMainConfigsAction.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,22 +13,22 @@
 block discarded – undo
13 13
 
14 14
 class DiscoveryMainConfigsAction
15 15
 {
16
-  public function __construct(
16
+    public function __construct(
17 17
     private EntityManagerInterface $manager,
18 18
     private HydratorService $hydratorService,
19 19
     private ConfigService $configService
20
-  ) {}
20
+    ) {}
21 21
 
22
-  public function __invoke(Request $request): JsonResponse
23
-  {
22
+    public function __invoke(Request $request): JsonResponse
23
+    {
24 24
     try {
25
-      $json = json_decode($request->getContent(), true);
26
-      $device = $this->manager->getRepository(People::class)->findOneBy(['device' => $request->headers->get('device')]);
27
-      $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
28
-      $configs = $this->configService->discoveryMainConfigs($people, $device);
29
-      return new JsonResponse($this->hydratorService->collectionData($configs, Config::class, 'config:read'));
25
+        $json = json_decode($request->getContent(), true);
26
+        $device = $this->manager->getRepository(People::class)->findOneBy(['device' => $request->headers->get('device')]);
27
+        $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
28
+        $configs = $this->configService->discoveryMainConfigs($people, $device);
29
+        return new JsonResponse($this->hydratorService->collectionData($configs, Config::class, 'config:read'));
30 30
     } catch (Exception $e) {
31
-      return new JsonResponse($this->hydratorService->error($e));
31
+        return new JsonResponse($this->hydratorService->error($e));
32
+    }
32 33
     }
33
-  }
34 34
 }
Please login to merge, or discard this patch.
src/Controller/AddDeviceConfigAction.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,23 +14,23 @@
 block discarded – undo
14 14
 
15 15
 class AddDeviceConfigAction
16 16
 {
17
-  public function __construct(
17
+    public function __construct(
18 18
     private EntityManagerInterface $manager,
19 19
     private HydratorService $hydratorService,
20 20
     private DeviceService $deviceService
21
-  ) {}
21
+    ) {}
22 22
 
23
-  public function __invoke(Request $request): JsonResponse
24
-  {
23
+    public function __invoke(Request $request): JsonResponse
24
+    {
25 25
     try {
26
-      $json = json_decode($request->getContent(), true);
27
-      $device = $request->headers->get('device');
28
-      $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
29
-      $configs = json_decode($json['configs'], true);
30
-      $device_config = $this->deviceService->addDeviceConfigs($people, $configs, $device);
31
-      return new JsonResponse($this->hydratorService->item(DeviceConfig::class, $device_config->getId(), 'device_config:read'), Response::HTTP_OK);
26
+        $json = json_decode($request->getContent(), true);
27
+        $device = $request->headers->get('device');
28
+        $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
29
+        $configs = json_decode($json['configs'], true);
30
+        $device_config = $this->deviceService->addDeviceConfigs($people, $configs, $device);
31
+        return new JsonResponse($this->hydratorService->item(DeviceConfig::class, $device_config->getId(), 'device_config:read'), Response::HTTP_OK);
32 32
     } catch (Exception $e) {
33
-      return new JsonResponse($this->hydratorService->error($e));
33
+        return new JsonResponse($this->hydratorService->error($e));
34
+    }
34 35
     }
35
-  }
36 36
 }
Please login to merge, or discard this patch.
src/Service/NotificationService.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,21 +6,21 @@
 block discarded – undo
6 6
 use Doctrine\ORM\EntityManagerInterface;
7 7
 use Symfony\Component\HttpFoundation\RequestStack;
8 8
 use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface
9
- AS Security;
9
+    AS Security;
10 10
 
11 11
 class NotificationService
12 12
 {
13 13
 
14
-  public function __construct(
14
+    public function __construct(
15 15
     private EntityManagerInterface $manager,
16 16
     private Security               $security,
17 17
     private RequestStack $requestStack,
18 18
     private PusherService $pusher
19
-  ) {
20
-  }
19
+    ) {
20
+    }
21 21
 
22
-  public function postPersist(Notification $notification)
23
-  {
22
+    public function postPersist(Notification $notification)
23
+    {
24 24
     $this->pusher->push(['company' => 1, 'people' => 1], 'my_topic');
25
-  }
25
+    }
26 26
 }
Please login to merge, or discard this patch.
src/Service/HydratorService.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 namespace ControleOnline\Service;
4 4
 
5 5
 use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface
6
- AS Security;
6
+    AS Security;
7 7
 use Symfony\Component\Serializer\SerializerInterface;
8 8
 use Symfony\Component\HttpFoundation\RequestStack;
9 9
 
Please login to merge, or discard this patch.
src/Controller/AddAppConfigAction.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -13,37 +13,37 @@
 block discarded – undo
13 13
 use Exception;
14 14
 use Symfony\Component\HttpFoundation\JsonResponse;
15 15
 use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface
16
- AS Security;
16
+    AS Security;
17 17
 
18 18
 
19 19
 
20 20
 class AddAppConfigAction
21 21
 {
22
-  public function __construct(
22
+    public function __construct(
23 23
     private Security $security,
24 24
     private EntityManagerInterface $manager,
25 25
     private ConfigService $configService,
26 26
     private HydratorService $hydratorService
27
-  ) {}
27
+    ) {}
28 28
 
29
-  public function __invoke(Request $request): JsonResponse
30
-  {
29
+    public function __invoke(Request $request): JsonResponse
30
+    {
31 31
     try {
32
-      $json = json_decode($request->getContent(), true);
33
-      $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
34
-      $module = $this->manager->getRepository(Module::class)->find(preg_replace("/[^0-9]/", "", $json['module']));
35
-      $configValue = json_decode($json['configValue'], true);
36
-      $config = $this->configService->addConfig(
32
+        $json = json_decode($request->getContent(), true);
33
+        $people = $this->manager->getRepository(People::class)->find(preg_replace("/[^0-9]/", "", $json['people']));
34
+        $module = $this->manager->getRepository(Module::class)->find(preg_replace("/[^0-9]/", "", $json['module']));
35
+        $configValue = json_decode($json['configValue'], true);
36
+        $config = $this->configService->addConfig(
37 37
         $people,
38 38
         $json['configKey'],
39 39
         $configValue,
40 40
         $module,
41 41
         $json['visibility']
42
-      );
42
+        );
43 43
 
44
-      return new JsonResponse($this->hydratorService->item(Config::class, $config->getId(), "config:read"), Response::HTTP_OK);
44
+        return new JsonResponse($this->hydratorService->item(Config::class, $config->getId(), "config:read"), Response::HTTP_OK);
45 45
     } catch (Exception $e) {
46
-      return new JsonResponse($this->hydratorService->error($e));
46
+        return new JsonResponse($this->hydratorService->error($e));
47
+    }
47 48
     }
48
-  }
49 49
 }
Please login to merge, or discard this patch.