@@ -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) { |
@@ -76,7 +76,6 @@ |
||
| 76 | 76 | * |
| 77 | 77 | * @ORM\Column(name="visibility", type="string", length=255, nullable=false) |
| 78 | 78 | * @Groups({"config:read","config:write"}) |
| 79 | - |
|
| 80 | 79 | */ |
| 81 | 80 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['visibility' => 'exact'])] |
| 82 | 81 | |
@@ -66,7 +66,6 @@ |
||
| 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 | /** |
@@ -19,13 +19,13 @@ |
||
| 19 | 19 | |
| 20 | 20 | public function getFileUrl(People $people): ?array |
| 21 | 21 | { |
| 22 | - if ($people->getImage() instanceof File) |
|
| 22 | + if ($people->getImage() instanceof File) |
|
| 23 | 23 | return [ |
| 24 | - 'id' => $people->getImage()->getId(), |
|
| 25 | - 'domain' => $this->domainService->getMainDomain(), |
|
| 26 | - 'url' => '/files/' . $people->getImage()->getId() . '/download' |
|
| 24 | + 'id' => $people->getImage()->getId(), |
|
| 25 | + 'domain' => $this->domainService->getMainDomain(), |
|
| 26 | + 'url' => '/files/' . $people->getImage()->getId() . '/download' |
|
| 27 | 27 | ]; |
| 28 | 28 | |
| 29 | - return null; |
|
| 29 | + return null; |
|
| 30 | 30 | } |
| 31 | 31 | } |
@@ -19,12 +19,13 @@ |
||
| 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 | } |
@@ -51,7 +51,6 @@ |
||
| 51 | 51 | * |
| 52 | 52 | * @ORM\Column(name="cod_ibge", type="integer", nullable=true) |
| 53 | 53 | * @Groups({"city:read","logistic:read","state:read", "order_details:read", "people:read", "address:read", "delivery_region:read"}) |
| 54 | - |
|
| 55 | 54 | */ |
| 56 | 55 | private $cod_ibge; |
| 57 | 56 | /** |
@@ -59,7 +59,6 @@ |
||
| 59 | 59 | * |
| 60 | 60 | * @ORM\Column(name="cod_ibge", type="integer", nullable=true) |
| 61 | 61 | * @Groups({"city:read","logistic:read","order_details:read","order:write", "people:read", "address:read", "delivery_region:read"}) |
| 62 | - |
|
| 63 | 62 | */ |
| 64 | 63 | private $cod_ibge; |
| 65 | 64 | /** |
@@ -33,7 +33,6 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @ORM\Column(name="countryCode", type="string", length=3, nullable=false) |
| 35 | 35 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 36 | - |
|
| 37 | 36 | */ |
| 38 | 37 | private $countrycode; |
| 39 | 38 | /** |
@@ -48,7 +47,6 @@ discard block |
||
| 48 | 47 | * |
| 49 | 48 | * @ORM\Column(name="currencyCode", type="string", length=3, nullable=true) |
| 50 | 49 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 51 | - |
|
| 52 | 50 | */ |
| 53 | 51 | private $currencycode; |
| 54 | 52 | /** |
@@ -56,7 +54,6 @@ discard block |
||
| 56 | 54 | * |
| 57 | 55 | * @ORM\Column(name="population", type="integer", nullable=true) |
| 58 | 56 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 59 | - |
|
| 60 | 57 | */ |
| 61 | 58 | private $population; |
| 62 | 59 | /** |
@@ -64,7 +61,6 @@ discard block |
||
| 64 | 61 | * |
| 65 | 62 | * @ORM\Column(name="fipsCode", type="string", length=2, nullable=true) |
| 66 | 63 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 67 | - |
|
| 68 | 64 | */ |
| 69 | 65 | private $fipscode; |
| 70 | 66 | /** |
@@ -80,7 +76,6 @@ discard block |
||
| 80 | 76 | * |
| 81 | 77 | * @ORM\Column(name="north", type="string", length=30, nullable=true) |
| 82 | 78 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 83 | - |
|
| 84 | 79 | */ |
| 85 | 80 | private $north; |
| 86 | 81 | /** |
@@ -88,7 +83,6 @@ discard block |
||
| 88 | 83 | * |
| 89 | 84 | * @ORM\Column(name="south", type="string", length=30, nullable=true) |
| 90 | 85 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 91 | - |
|
| 92 | 86 | */ |
| 93 | 87 | private $south; |
| 94 | 88 | /** |
@@ -97,7 +91,6 @@ discard block |
||
| 97 | 91 | * @ORM\Column(name="east", type="string", length=30, nullable=true) |
| 98 | 92 | * |
| 99 | 93 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 100 | - |
|
| 101 | 94 | */ |
| 102 | 95 | private $east; |
| 103 | 96 | /** |
@@ -105,7 +98,6 @@ discard block |
||
| 105 | 98 | * |
| 106 | 99 | * @ORM\Column(name="west", type="string", length=30, nullable=true) |
| 107 | 100 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 108 | - |
|
| 109 | 101 | */ |
| 110 | 102 | private $west; |
| 111 | 103 | /** |
@@ -113,7 +105,6 @@ discard block |
||
| 113 | 105 | * |
| 114 | 106 | * @ORM\Column(name="capital", type="string", length=30, nullable=true) |
| 115 | 107 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 116 | - |
|
| 117 | 108 | */ |
| 118 | 109 | private $capital; |
| 119 | 110 | /** |
@@ -121,7 +112,6 @@ discard block |
||
| 121 | 112 | * |
| 122 | 113 | * @ORM\Column(name="continentName", type="string", length=15, nullable=true) |
| 123 | 114 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 124 | - |
|
| 125 | 115 | */ |
| 126 | 116 | private $continentname; |
| 127 | 117 | /** |
@@ -129,7 +119,6 @@ discard block |
||
| 129 | 119 | * |
| 130 | 120 | * @ORM\Column(name="continent", type="string", length=2, nullable=true) |
| 131 | 121 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 132 | - |
|
| 133 | 122 | */ |
| 134 | 123 | private $continent; |
| 135 | 124 | /** |
@@ -137,7 +126,6 @@ discard block |
||
| 137 | 126 | * |
| 138 | 127 | * @ORM\Column(name="areaInSqKm", type="string", length=20, nullable=true) |
| 139 | 128 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 140 | - |
|
| 141 | 129 | */ |
| 142 | 130 | private $areainsqkm; |
| 143 | 131 | /** |
@@ -145,7 +133,6 @@ discard block |
||
| 145 | 133 | * |
| 146 | 134 | * @ORM\Column(name="isoAlpha3", type="string", length=3, nullable=true) |
| 147 | 135 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 148 | - |
|
| 149 | 136 | */ |
| 150 | 137 | private $isoalpha3; |
| 151 | 138 | /** |
@@ -153,7 +140,6 @@ discard block |
||
| 153 | 140 | * |
| 154 | 141 | * @ORM\Column(name="geonameId", type="integer", nullable=true) |
| 155 | 142 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 156 | - |
|
| 157 | 143 | */ |
| 158 | 144 | private $geonameid; |
| 159 | 145 | /** |
@@ -161,7 +147,6 @@ discard block |
||
| 161 | 147 | * |
| 162 | 148 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\LanguageCountry", mappedBy="country") |
| 163 | 149 | * @Groups({"city:read","logistic:read","state:read", "people:read","order_details:read","order:write", "address:read"}) |
| 164 | - |
|
| 165 | 150 | */ |
| 166 | 151 | private $languageCountry; |
| 167 | 152 | /** |
@@ -57,11 +57,11 @@ |
||
| 57 | 57 | { |
| 58 | 58 | if (self::$peopleDomain) return self::$peopleDomain; |
| 59 | 59 | |
| 60 | - $domain = $this->getDomain(); |
|
| 60 | + $domain = $this->getDomain(); |
|
| 61 | 61 | self::$peopleDomain = $this->manager->getRepository(PeopleDomain::class)->findOneBy(['domain' => $domain]); |
| 62 | 62 | |
| 63 | 63 | if (!self::$peopleDomain) { |
| 64 | - $domain = $this->getMainDomain(); |
|
| 64 | + $domain = $this->getMainDomain(); |
|
| 65 | 65 | self::$peopleDomain = $this->manager->getRepository(PeopleDomain::class)->findOneBy(['domain' => $domain]); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -43,8 +43,9 @@ discard block |
||
| 43 | 43 | ) |
| 44 | 44 | )); |
| 45 | 45 | |
| 46 | - if (!$domain) |
|
| 47 | - throw new InvalidArgumentException('Please define header or get param "app-domain"', 301); |
|
| 46 | + if (!$domain) { |
|
| 47 | + throw new InvalidArgumentException('Please define header or get param "app-domain"', 301); |
|
| 48 | + } |
|
| 48 | 49 | return $domain; |
| 49 | 50 | } |
| 50 | 51 | |
@@ -55,7 +56,9 @@ discard block |
||
| 55 | 56 | |
| 56 | 57 | public function getPeopleDomain(): PeopleDomain |
| 57 | 58 | { |
| 58 | - if (self::$peopleDomain) return self::$peopleDomain; |
|
| 59 | + if (self::$peopleDomain) { |
|
| 60 | + return self::$peopleDomain; |
|
| 61 | + } |
|
| 59 | 62 | |
| 60 | 63 | $domain = $this->getDomain(); |
| 61 | 64 | self::$peopleDomain = $this->manager->getRepository(PeopleDomain::class)->findOneBy(['domain' => $domain]); |
@@ -65,10 +68,11 @@ discard block |
||
| 65 | 68 | self::$peopleDomain = $this->manager->getRepository(PeopleDomain::class)->findOneBy(['domain' => $domain]); |
| 66 | 69 | } |
| 67 | 70 | |
| 68 | - if (self::$peopleDomain === null) |
|
| 69 | - throw new \Exception( |
|
| 71 | + if (self::$peopleDomain === null) { |
|
| 72 | + throw new \Exception( |
|
| 70 | 73 | sprintf('Main company "%s" not found', $domain) |
| 71 | 74 | ); |
| 75 | + } |
|
| 72 | 76 | |
| 73 | 77 | return self::$peopleDomain; |
| 74 | 78 | } |