@@ -11,13 +11,13 @@ |
||
11 | 11 | /** |
12 | 12 | * @return RegionBranch[] |
13 | 13 | */ |
14 | - public function findAll():?array ; |
|
14 | + public function findAll(): ?array; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @param string $region |
18 | 18 | * @return RegionBranch|null |
19 | 19 | */ |
20 | - public function findByRegion(string $region):?RegionBranch; |
|
20 | + public function findByRegion(string $region): ?RegionBranch; |
|
21 | 21 | |
22 | - public function findById(int $id):?RegionBranch; |
|
22 | + public function findById(int $id): ?RegionBranch; |
|
23 | 23 | } |
24 | 24 | \ No newline at end of file |
@@ -149,12 +149,12 @@ |
||
149 | 149 | $this->agreement = $agreement; |
150 | 150 | } |
151 | 151 | |
152 | - public static function simpleCreate(int $partnerId,string $partnerName, InnValue $innValue, string $companyName, string $clientFio, |
|
153 | - PhoneValue $phoneValue, ?string $email, RegionBranch $regionBranch,?string $comment): self |
|
152 | + public static function simpleCreate(int $partnerId, string $partnerName, InnValue $innValue, string $companyName, string $clientFio, |
|
153 | + PhoneValue $phoneValue, ?string $email, RegionBranch $regionBranch, ?string $comment): self |
|
154 | 154 | { |
155 | - $fio=explode(' ',$clientFio); |
|
156 | - $clientfName=isset($fio[0])?$fio[0]:''; |
|
157 | - $clientlName=isset($fio[1])?$fio[1]:''; |
|
155 | + $fio = explode(' ', $clientFio); |
|
156 | + $clientfName = isset($fio[0]) ? $fio[0] : ''; |
|
157 | + $clientlName = isset($fio[1]) ? $fio[1] : ''; |
|
158 | 158 | return new self( |
159 | 159 | self::DEFAULT_FORM_ID, |
160 | 160 | self::DEFAULT_FORM_CODE, |
@@ -44,7 +44,7 @@ |
||
44 | 44 | /** |
45 | 45 | * @return string |
46 | 46 | */ |
47 | - public function getBody():?string |
|
47 | + public function getBody(): ?string |
|
48 | 48 | { |
49 | 49 | return $this->body; |
50 | 50 | } |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | */ |
28 | 28 | private function setInn(string $inn): void |
29 | 29 | { |
30 | - if($this->isValid($inn)){ |
|
31 | - $this->inn=$inn; |
|
32 | - }else{ |
|
30 | + if ($this->isValid($inn)) { |
|
31 | + $this->inn = $inn; |
|
32 | + } else { |
|
33 | 33 | throw new \InvalidArgumentException('INN not valid'); |
34 | 34 | } |
35 | 35 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | if (preg_match('/[^0-9]/', $inn)) { |
45 | 45 | return false; //'ИНН может состоять только из цифр'; |
46 | 46 | } elseif (!in_array($inn_length = strlen($inn), [10, 12])) { |
47 | - return false;// 'ИНН может состоять только из 10 или 12 цифр'; |
|
47 | + return false; // 'ИНН может состоять только из 10 или 12 цифр'; |
|
48 | 48 | } else { |
49 | 49 | $check_digit = function($inn, $coefficients) { |
50 | 50 | $n = 0; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | if($this->isValid($inn)){ |
31 | 31 | $this->inn=$inn; |
32 | - }else{ |
|
32 | + } else{ |
|
33 | 33 | throw new \InvalidArgumentException('INN not valid'); |
34 | 34 | } |
35 | 35 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | - $this->phone= '+7 (' . substr($phone, -10, 3) . ') ' . substr($phone, -7, 3) . '-' . substr($phone, -4, 2) . '-' . substr($phone, -2); |
|
52 | + $this->phone = '+7 (' . substr($phone, -10, 3) . ') ' . substr($phone, -7, 3) . '-' . substr($phone, -4, 2) . '-' . substr($phone, -2); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | } |
56 | 56 | \ No newline at end of file |
@@ -85,7 +85,7 @@ |
||
85 | 85 | mb_substr($response, $headers_size, null, 'utf-8')); |
86 | 86 | |
87 | 87 | return $res; |
88 | - } catch (\Exception $e) { |
|
88 | + }catch (\Exception $e) { |
|
89 | 89 | throw $e; |
90 | 90 | } finally { |
91 | 91 | curl_close($curl); |
@@ -51,7 +51,7 @@ |
||
51 | 51 | if(!$resource){ |
52 | 52 | return []; |
53 | 53 | } |
54 | - }catch (\Exception $e){ |
|
54 | + } catch (\Exception $e){ |
|
55 | 55 | return []; |
56 | 56 | } |
57 | 57 | foreach ($resource as $item){ |
@@ -15,17 +15,17 @@ discard block |
||
15 | 15 | private $url; |
16 | 16 | |
17 | 17 | /** @var RegionBranch[]|null */ |
18 | - private $all=null; |
|
18 | + private $all = null; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * RegionBranchStoreUrlJson constructor. |
22 | 22 | * @param $url |
23 | 23 | */ |
24 | - public function __construct(?UrlValue $url=null) |
|
24 | + public function __construct(?UrlValue $url = null) |
|
25 | 25 | { |
26 | 26 | $this->url = $url; |
27 | - if(empty($this->url)){ |
|
28 | - $this->url=new UrlValue('https://www.rshb.ru/promo/smb/rko-partner/js/region.json'); |
|
27 | + if (empty($this->url)) { |
|
28 | + $this->url = new UrlValue('https://www.rshb.ru/promo/smb/rko-partner/js/region.json'); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
@@ -36,27 +36,27 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function findAll(): array |
38 | 38 | { |
39 | - if($this->all){ |
|
39 | + if ($this->all) { |
|
40 | 40 | return $this->all; |
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | - $resource=file_get_contents($this->url->__toString()); |
|
45 | - if(empty($resource)){ |
|
44 | + $resource = file_get_contents($this->url->__toString()); |
|
45 | + if (empty($resource)) { |
|
46 | 46 | return []; |
47 | 47 | } |
48 | 48 | |
49 | - try{ |
|
50 | - $resource=json_decode($resource,true); |
|
51 | - if(!$resource){ |
|
49 | + try { |
|
50 | + $resource = json_decode($resource, true); |
|
51 | + if (!$resource) { |
|
52 | 52 | return []; |
53 | 53 | } |
54 | - }catch (\Exception $e){ |
|
54 | + }catch (\Exception $e) { |
|
55 | 55 | return []; |
56 | 56 | } |
57 | - foreach ($resource as $item){ |
|
58 | - $this->all[]=new RegionBranch( |
|
59 | - (int)$item['id'], |
|
57 | + foreach ($resource as $item) { |
|
58 | + $this->all[] = new RegionBranch( |
|
59 | + (int) $item['id'], |
|
60 | 60 | $item['origName'], |
61 | 61 | $item['newName'] |
62 | 62 | ); |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function findByRegion(string $region): ?RegionBranch |
71 | 71 | { |
72 | - foreach ($this->findAll() as $regionBranch){ |
|
73 | - if($regionBranch->getRegionName()==$region){ |
|
72 | + foreach ($this->findAll() as $regionBranch) { |
|
73 | + if ($regionBranch->getRegionName() == $region) { |
|
74 | 74 | return $regionBranch; |
75 | 75 | } |
76 | 76 | } |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | |
81 | 81 | public function findById(int $id): ?RegionBranch |
82 | 82 | { |
83 | - foreach ($this->findAll() as $regionBranch){ |
|
84 | - if($regionBranch->getId()==$id){ |
|
83 | + foreach ($this->findAll() as $regionBranch) { |
|
84 | + if ($regionBranch->getId() == $id) { |
|
85 | 85 | return $regionBranch; |
86 | 86 | } |
87 | 87 | } |