| @@ -34,7 +34,7 @@ | ||
| 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, [ | 
| @@ -89,11 +89,13 @@ | ||
| 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 | |
| @@ -3,7 +3,7 @@ | ||
| 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 | |
| @@ -32,23 +32,23 @@ discard block | ||
| 32 | 32 | return $e; | 
| 33 | 33 | } | 
| 34 | 34 | |
| 35 | - public function collectionData($data, $class, $groups, mixed $arguments = []) | |
| 35 | + public function collectionData($data, $class, $groups, mixed $arguments = []) | |
| 36 | 36 |      { | 
| 37 | 37 | $response = $this->getBasicResponse($class); | 
| 38 | 38 | |
| 39 | - $response['member'] = $this->data($data, $groups); | |
| 40 | - $response['search'] = $this->getSearch($class); | |
| 41 | - $response['totalItems'] = $this->getCount($class, $arguments); | |
| 39 | + $response['member'] = $this->data($data, $groups); | |
| 40 | + $response['search'] = $this->getSearch($class); | |
| 41 | + $response['totalItems'] = $this->getCount($class, $arguments); | |
| 42 | 42 | |
| 43 | 43 | return $response; | 
| 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['member'] = $this->getMembers($class, $groups, $arguments, $limit, $page, $orderby); | |
| 50 | - $response['search'] = $this->getSearch($class); | |
| 51 | - $response['totalItems'] = $this->getCount($class, $arguments); | |
| 49 | + $response['member'] = $this->getMembers($class, $groups, $arguments, $limit, $page, $orderby); | |
| 50 | + $response['search'] = $this->getSearch($class); | |
| 51 | + $response['totalItems'] = $this->getCount($class, $arguments); | |
| 52 | 52 | |
| 53 | 53 | return $response; | 
| 54 | 54 | } | 
| @@ -58,8 +58,8 @@ discard block | ||
| 58 | 58 | //$response = $this->getBasicResponse($class); | 
| 59 | 59 | //$response['search'] = $this->getSearch($class); | 
| 60 | 60 | |
| 61 | - $response['member'] = $result; | |
| 62 | - $response['totalItems'] = count($response['member']); | |
| 61 | + $response['member'] = $result; | |
| 62 | + $response['totalItems'] = count($response['member']); | |
| 63 | 63 | |
| 64 | 64 | return $response; | 
| 65 | 65 | } | 
| @@ -82,8 +82,8 @@ discard block | ||
| 82 | 82 | $className = substr($class, strrpos($class, '\\') + 1); | 
| 83 | 83 | |
| 84 | 84 |          $response['@id']        = '/' . strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $className)) . 's'; | 
| 85 | - $response['@context'] = "/contexts/" . $className; | |
| 86 | - $response['@type'] = "Collection"; | |
| 85 | + $response['@context'] = "/contexts/" . $className; | |
| 86 | + $response['@type'] = "Collection"; | |
| 87 | 87 | |
| 88 | 88 | $response['view'] = [ | 
| 89 | 89 | '@id' => $this->uri, | 
| @@ -101,7 +101,7 @@ discard block | ||
| 101 | 101 | if ($page == 1) | 
| 102 | 102 |              $offset = (($page = $this->request->get('page') ?: 1) - 1) * $limit; | 
| 103 | 103 | |
| 104 | - $data = $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset); | |
| 104 | + $data = $this->manager->getRepository($class)->findBy($arguments, $orderby, $limit, $offset); | |
| 105 | 105 | |
| 106 | 106 | return $this->serialize($data, ['groups' => $groups]); | 
| 107 | 107 | } | 
| @@ -22,65 +22,65 @@ | ||
| 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 | } | 
| @@ -23,21 +23,21 @@ discard block | ||
| 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 | ||
| 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() | 
| @@ -43,8 +43,9 @@ discard block | ||
| 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 | ||
| 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 | } | 
| @@ -56,15 +56,17 @@ | ||
| 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 | |
| @@ -9,98 +9,98 @@ discard block | ||
| 9 | 9 | use Exception; | 
| 10 | 10 | use Symfony\Component\HttpFoundation\JsonResponse; | 
| 11 | 11 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface | 
| 12 | - AS Security; | |
| 12 | + AS Security; | |
| 13 | 13 | use ControleOnline\Repository\MenuRepository; | 
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | class GetMenuByPeopleAction | 
| 17 | 17 |  { | 
| 18 | - /** | |
| 19 | - * Entity Manager | |
| 20 | - * | |
| 21 | - * @var EntityManagerInterface | |
| 22 | - */ | |
| 23 | - private $manager = null; | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * Request | |
| 27 | - * | |
| 28 | - * @var Request | |
| 29 | - */ | |
| 30 | - private $request = null; | |
| 31 | - | |
| 32 | - /** | |
| 33 | - * Security | |
| 34 | - * | |
| 35 | - * @var Security | |
| 36 | - */ | |
| 37 | - private $security = null; | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * @var \ControleOnline\Repository\MenuRepository | |
| 41 | - */ | |
| 42 | - private $repository = null; | |
| 43 | - | |
| 44 | - | |
| 45 | - public function __construct(Security $security, EntityManagerInterface $entityManager) | |
| 46 | -  { | |
| 18 | + /** | |
| 19 | + * Entity Manager | |
| 20 | + * | |
| 21 | + * @var EntityManagerInterface | |
| 22 | + */ | |
| 23 | + private $manager = null; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * Request | |
| 27 | + * | |
| 28 | + * @var Request | |
| 29 | + */ | |
| 30 | + private $request = null; | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * Security | |
| 34 | + * | |
| 35 | + * @var Security | |
| 36 | + */ | |
| 37 | + private $security = null; | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * @var \ControleOnline\Repository\MenuRepository | |
| 41 | + */ | |
| 42 | + private $repository = null; | |
| 43 | + | |
| 44 | + | |
| 45 | + public function __construct(Security $security, EntityManagerInterface $entityManager) | |
| 46 | +    { | |
| 47 | 47 | $this->manager = $entityManager; | 
| 48 | 48 | $this->security = $security; | 
| 49 | 49 | $this->repository = $this->manager->getRepository(Menu::class); | 
| 50 | - } | |
| 50 | + } | |
| 51 | 51 | |
| 52 | - public function __invoke(Request $request): JsonResponse | |
| 53 | -  { | |
| 52 | + public function __invoke(Request $request): JsonResponse | |
| 53 | +    { | |
| 54 | 54 |      try { | 
| 55 | 55 | |
| 56 | - $menu = []; | |
| 56 | + $menu = []; | |
| 57 | 57 | |
| 58 | -      $company = $request->query->get('myCompany', null); | |
| 58 | +        $company = $request->query->get('myCompany', null); | |
| 59 | 59 | |
| 60 | - if ($company === null) | |
| 60 | + if ($company === null) | |
| 61 | 61 |          throw new Exception("Company not found", 404); | 
| 62 | 62 | |
| 63 | 63 | |
| 64 | - $myCompany = $this->manager->getRepository(People::class) | |
| 64 | + $myCompany = $this->manager->getRepository(People::class) | |
| 65 | 65 | ->find($company); | 
| 66 | 66 | |
| 67 | - if ($myCompany === null) | |
| 67 | + if ($myCompany === null) | |
| 68 | 68 |          throw new Exception("Company not found", 404); | 
| 69 | 69 | |
| 70 | 70 | |
| 71 | 71 | |
| 72 | - $currentUser = $this->security->getToken()->getUser(); | |
| 73 | - /** | |
| 74 | - * @var People | |
| 75 | - */ | |
| 76 | - $userPeople = $currentUser->getPeople(); | |
| 72 | + $currentUser = $this->security->getToken()->getUser(); | |
| 73 | + /** | |
| 74 | + * @var People | |
| 75 | + */ | |
| 76 | + $userPeople = $currentUser->getPeople(); | |
| 77 | 77 | |
| 78 | - $menu = $this->getMenuByPeople($userPeople, $myCompany); | |
| 78 | + $menu = $this->getMenuByPeople($userPeople, $myCompany); | |
| 79 | 79 | |
| 80 | 80 | |
| 81 | - return new JsonResponse([ | |
| 81 | + return new JsonResponse([ | |
| 82 | 82 | 'response' => [ | 
| 83 | - 'data' => $menu, | |
| 84 | - 'count' => 1, | |
| 85 | - 'error' => '', | |
| 86 | - 'success' => true, | |
| 83 | + 'data' => $menu, | |
| 84 | + 'count' => 1, | |
| 85 | + 'error' => '', | |
| 86 | + 'success' => true, | |
| 87 | 87 | ], | 
| 88 | - ]); | |
| 88 | + ]); | |
| 89 | 89 |      } catch (\Exception $e) { | 
| 90 | 90 | |
| 91 | - return new JsonResponse([ | |
| 91 | + return new JsonResponse([ | |
| 92 | 92 | 'response' => [ | 
| 93 | - 'data' => [], | |
| 94 | - 'count' => 0, | |
| 95 | - 'error' => $e->getMessage(), | |
| 96 | - 'success' => false, | |
| 93 | + 'data' => [], | |
| 94 | + 'count' => 0, | |
| 95 | + 'error' => $e->getMessage(), | |
| 96 | + 'success' => false, | |
| 97 | 97 | ], | 
| 98 | - ]); | |
| 98 | + ]); | |
| 99 | + } | |
| 99 | 100 | } | 
| 100 | - } | |
| 101 | 101 | |
| 102 | - private function getMenuByPeople(People $userPeople, People $myCompany) | |
| 103 | -  { | |
| 102 | + private function getMenuByPeople(People $userPeople, People $myCompany) | |
| 103 | +    { | |
| 104 | 104 | |
| 105 | 105 | $return = []; | 
| 106 | 106 | $connection = $this->manager->getConnection(); | 
| @@ -134,22 +134,22 @@ discard block | ||
| 134 | 134 | |
| 135 | 135 |      foreach ($result as $menu) { | 
| 136 | 136 | |
| 137 | - $return['modules'][$menu['category_id']]['id'] = $menu['category_id']; | |
| 138 | - $return['modules'][$menu['category_id']]['label'] = $menu['category_label']; | |
| 139 | - $return['modules'][$menu['category_id']]['color'] = $menu['category_color']; | |
| 140 | - $return['modules'][$menu['category_id']]['icon'] = $menu['category_icon']; | |
| 141 | - $return['modules'][$menu['category_id']]['menus'][] = [ | |
| 137 | + $return['modules'][$menu['category_id']]['id'] = $menu['category_id']; | |
| 138 | + $return['modules'][$menu['category_id']]['label'] = $menu['category_label']; | |
| 139 | + $return['modules'][$menu['category_id']]['color'] = $menu['category_color']; | |
| 140 | + $return['modules'][$menu['category_id']]['icon'] = $menu['category_icon']; | |
| 141 | + $return['modules'][$menu['category_id']]['menus'][] = [ | |
| 142 | 142 | 'id' => $menu['id'], | 
| 143 | 143 | 'label' => $menu['menu'], | 
| 144 | 144 | 'icon' => $menu['icon'], | 
| 145 | 145 | 'color' => $menu['color'], | 
| 146 | 146 | 'route' => $menu['route'], | 
| 147 | 147 | 'module' => '/modules/' . $menu['module'], | 
| 148 | - ]; | |
| 148 | + ]; | |
| 149 | 149 | } | 
| 150 | 150 | |
| 151 | 151 | |
| 152 | 152 | |
| 153 | 153 | return $return; | 
| 154 | - } | |
| 154 | + } | |
| 155 | 155 | } | 
| 156 | 156 | \ No newline at end of file | 
| @@ -27,7 +27,7 @@ discard block | ||
| 27 | 27 | * | 
| 28 | 28 | * @var Request | 
| 29 | 29 | */ | 
| 30 | - private $request = null; | |
| 30 | + private $request = null; | |
| 31 | 31 | |
| 32 | 32 | /** | 
| 33 | 33 | * Security | 
| @@ -53,7 +53,7 @@ discard block | ||
| 53 | 53 |    { | 
| 54 | 54 |      try { | 
| 55 | 55 | |
| 56 | - $menu = []; | |
| 56 | + $menu = []; | |
| 57 | 57 | |
| 58 | 58 |        $company = $request->query->get('myCompany', null); | 
| 59 | 59 | |
| @@ -75,7 +75,7 @@ discard block | ||
| 75 | 75 | */ | 
| 76 | 76 | $userPeople = $currentUser->getPeople(); | 
| 77 | 77 | |
| 78 | - $menu = $this->getMenuByPeople($userPeople, $myCompany); | |
| 78 | + $menu = $this->getMenuByPeople($userPeople, $myCompany); | |
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | return new JsonResponse([ | 
| @@ -107,7 +107,7 @@ discard block | ||
| 107 | 107 | |
| 108 | 108 | // build query | 
| 109 | 109 | |
| 110 | - $sql = 'SELECT menu.*, | |
| 110 | + $sql = 'SELECT menu.*, | |
| 111 | 111 | category.name AS category_label, | 
| 112 | 112 | category.color AS category_color, | 
| 113 | 113 | routes.route AS route, | 
| @@ -126,8 +126,8 @@ discard block | ||
| 126 | 126 | |
| 127 | 127 | $params = []; | 
| 128 | 128 | |
| 129 | - $params['myCompany'] = $myCompany->getId(); | |
| 130 | - $params['userPeople'] = $userPeople->getId(); | |
| 129 | + $params['myCompany'] = $myCompany->getId(); | |
| 130 | + $params['userPeople'] = $userPeople->getId(); | |
| 131 | 131 | // execute query | 
| 132 | 132 | |
| 133 | 133 | $result = $connection->executeQuery($sql, $params)->fetchAllAssociative(); | 
| @@ -64,8 +64,9 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | |
| @@ -15,57 +15,57 @@ discard block | ||
| 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 | ||
| 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 | ||
| 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 | ||
| 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 | } | 
| @@ -35,7 +35,7 @@ discard block | ||
| 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 | ||
| 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 | |
| @@ -41,8 +41,9 @@ discard block | ||
| 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 | ||
| 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 | |
| @@ -13,7 +13,7 @@ | ||
| 13 | 13 | |
| 14 | 14 | public function showPdf($content) | 
| 15 | 15 |      { | 
| 16 | -        $response = new StreamedResponse(function () use ($content) { | |
| 16 | +        $response = new StreamedResponse(function() use ($content) { | |
| 17 | 17 |              fputs(fopen('php://output', 'wb'), $content); | 
| 18 | 18 | }); | 
| 19 | 19 | |
| @@ -846,8 +846,9 @@ | ||
| 846 | 846 | |
| 847 | 847 | protected function getPeopleAddress(People $people): ?array | 
| 848 | 848 |      { | 
| 849 | - if (($address = $people->getAddress()->first()) === false) | |
| 850 | - return null; | |
| 849 | +        if (($address = $people->getAddress()->first()) === false) { | |
| 850 | + return null; | |
| 851 | + } | |
| 851 | 852 | |
| 852 | 853 | return $this->getAddress($address); | 
| 853 | 854 | } | 
| @@ -483,7 +483,7 @@ discard block | ||
| 483 | 483 | $origin = $order->getQuote()->getCityOrigin(); | 
| 484 | 484 | } | 
| 485 | 485 | |
| 486 | - $adresO = $this->getAddress($origin); | |
| 486 | + $adresO = $this->getAddress($origin); | |
| 487 | 487 |              if ($adresO) { | 
| 488 | 488 |                  $resOrigin = $this->getAddressVars('origin', $adresO); | 
| 489 | 489 | $data["origin_address"] = $resOrigin["origin_address"]; | 
| @@ -500,7 +500,7 @@ discard block | ||
| 500 | 500 | $destination = $order->getQuote()->getCityDestination(); | 
| 501 | 501 | } | 
| 502 | 502 | |
| 503 | - $adresD = $this->getAddress($destination); | |
| 503 | + $adresD = $this->getAddress($destination); | |
| 504 | 504 |              if ($adresD) { | 
| 505 | 505 |                  $resDestination = $this->getAddressVars('destination', $adresD); | 
| 506 | 506 | $data["destination_address"] = $resDestination["destination_address"]; | 
| @@ -561,7 +561,7 @@ discard block | ||
| 561 | 561 | ]; | 
| 562 | 562 | |
| 563 | 563 | $peopleContract = $myContract->getPeoples() | 
| 564 | -            ->filter(function ($contractPeople) { | |
| 564 | +            ->filter(function($contractPeople) { | |
| 565 | 565 | return $contractPeople->getPeopleType() == 'Payer'; | 
| 566 | 566 | }); | 
| 567 | 567 |          if (!$peopleContract->isEmpty()) { | 
| @@ -586,7 +586,7 @@ discard block | ||
| 586 | 586 | } | 
| 587 | 587 | |
| 588 | 588 |                  if (isset($contact['documents']['R.G'])) { | 
| 589 | - $data['student_rg'] = $contact['documents']['R.G']; | |
| 589 | + $data['student_rg'] = $contact['documents']['R.G']; | |
| 590 | 590 | } | 
| 591 | 591 | } | 
| 592 | 592 | |
| @@ -638,7 +638,7 @@ discard block | ||
| 638 | 638 | //// total per month | 
| 639 | 639 | $products = array_filter( | 
| 640 | 640 | $contractProducts, | 
| 641 | -            function ($contractProduct) { | |
| 641 | +            function($contractProduct) { | |
| 642 | 642 | return $contractProduct['product_subtype'] == 'Package' | 
| 643 | 643 | && $contractProduct['billing_unit'] == 'Monthly'; | 
| 644 | 644 | } | 
| @@ -656,7 +656,7 @@ discard block | ||
| 656 | 656 | //// contract tax | 
| 657 | 657 | $products = array_filter( | 
| 658 | 658 | $contractProducts, | 
| 659 | -            function ($contractProduct) { | |
| 659 | +            function($contractProduct) { | |
| 660 | 660 | return $contractProduct['product_type'] == 'Registration' | 
| 661 | 661 | && $contractProduct['billing_unit'] == 'Single'; | 
| 662 | 662 | } | 
| @@ -802,7 +802,7 @@ discard block | ||
| 802 | 802 | // monthly products | 
| 803 | 803 | |
| 804 | 804 | $contractProduct = $myContract->getContractProduct() | 
| 805 | -            ->filter(function ($contractProduct) { | |
| 805 | +            ->filter(function($contractProduct) { | |
| 806 | 806 | return $contractProduct->getProduct()->getProductSubtype() == 'Package' | 
| 807 | 807 | && $contractProduct->getProduct()->getBillingUnit() == 'Monthly' | 
| 808 | 808 | && $contractProduct->getPrice() > 0; | 
| @@ -815,7 +815,7 @@ discard block | ||
| 815 | 815 | // contract tax | 
| 816 | 816 | |
| 817 | 817 | $contractProduct = $myContract->getContractProduct() | 
| 818 | -            ->filter(function ($contractProduct) { | |
| 818 | +            ->filter(function($contractProduct) { | |
| 819 | 819 | return $contractProduct->getProduct()->getProductType() == 'Registration' | 
| 820 | 820 | && $contractProduct->getProduct()->getBillingUnit() == 'Single' | 
| 821 | 821 | && $contractProduct->getPrice() > 0; | 
| @@ -883,15 +883,15 @@ discard block | ||
| 883 | 883 | |
| 884 | 884 | |
| 885 | 885 | return [ | 
| 886 | - 'id' => $isAddress ? $address->getId() : '', | |
| 887 | - 'country' => !empty($state) ? $this->fixCountryName($state->getCountry()->getCountryName()) : '', | |
| 888 | - 'state' => !empty($state) ? $state->getUF() : '', | |
| 889 | - 'city' => !empty($city) ? $city->getCity() : '', | |
| 886 | + 'id' => $isAddress ? $address->getId() : '', | |
| 887 | + 'country' => !empty($state) ? $this->fixCountryName($state->getCountry()->getCountryName()) : '', | |
| 888 | + 'state' => !empty($state) ? $state->getUF() : '', | |
| 889 | + 'city' => !empty($city) ? $city->getCity() : '', | |
| 890 | 890 | 'district' => !empty($district) ? $district->getDistrict() : '', | 
| 891 | - 'postalCode' => !empty($street) ? $this->fixPostalCode($street->getCep()->getCep()) : '', | |
| 892 | - 'street' => !empty($street) ? $street->getStreet() : '', | |
| 893 | - 'number' => $isAddress ? $address->getNumber() : '', | |
| 894 | - 'complement' => $isAddress ? $address->getComplement() : '', | |
| 891 | + 'postalCode' => !empty($street) ? $this->fixPostalCode($street->getCep()->getCep()) : '', | |
| 892 | + 'street' => !empty($street) ? $street->getStreet() : '', | |
| 893 | + 'number' => $isAddress ? $address->getNumber() : '', | |
| 894 | + 'complement' => $isAddress ? $address->getComplement() : '', | |
| 895 | 895 | ]; | 
| 896 | 896 | } | 
| 897 | 897 | |
| @@ -902,14 +902,14 @@ discard block | ||
| 902 | 902 | |
| 903 | 903 | protected function fixPostalCode(int $postalCode): string | 
| 904 | 904 |      { | 
| 905 | - $code = (string)$postalCode; | |
| 905 | + $code = (string) $postalCode; | |
| 906 | 906 | return strlen($code) == 7 ? '0' . $code : $code; | 
| 907 | 907 | } | 
| 908 | 908 | |
| 909 | 909 | protected function getContractPeoplePayers(MyContract $contract): array | 
| 910 | 910 |      { | 
| 911 | 911 | $contractPeople = $contract->getPeoples() | 
| 912 | -            ->filter(function ($contractPeople) { | |
| 912 | +            ->filter(function($contractPeople) { | |
| 913 | 913 | return $contractPeople->getPeopleType() == 'Payer' && $contractPeople->getContractPercentage() > 0; | 
| 914 | 914 | }); | 
| 915 | 915 | |
| @@ -9,24 +9,24 @@ | ||
| 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 | } | 
| @@ -20,7 +20,7 @@ | ||
| 20 | 20 | 'query' => $input | 
| 21 | 21 | ]); | 
| 22 | 22 | |
| 23 | - $result = json_decode($response->getBody()); | |
| 23 | + $result = json_decode($response->getBody()); | |
| 24 | 24 | |
| 25 | 25 | return $result; | 
| 26 | 26 |      } catch (\Exception $e) { |