Passed
Push — master ( fcacfd...c5e884 )
by Anatoliy
02:32
created
src/Api.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/stores/RegionBranchStoreUrlJson.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
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.
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
     public function __construct(?UrlValue $url)
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
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){
Please login to merge, or discard this patch.