Passed
Push — master ( efc233...7383db )
by Ferry
04:51
created
src/helpers/CurlHelper.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     public function headers(array $headers) {
51 51
         $newHeaders = [];
52
-        foreach($headers as $key=>$val) {
52
+        foreach ($headers as $key=>$val) {
53 53
             $newHeaders[] = $key.": ".$val;
54 54
         }
55 55
         $this->headers = $newHeaders;
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
69 69
         curl_setopt($ch, CURLOPT_POSTFIELDS, $this->data);
70 70
         curl_setopt($ch, CURLOPT_HTTPHEADER, $this->headers);
71
-        curl_setopt($ch,CURLOPT_USERAGENT,$this->user_agent);
71
+        curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
72 72
         curl_setopt($ch, CURLOPT_REFERER, $this->referer);
73
-        if($this->cookie === true) {
73
+        if ($this->cookie === true) {
74 74
             $cookie_dir = storage_path("cookies");
75
-            if(!file_exists($cookie_dir)) mkdir($cookie_dir);
75
+            if (!file_exists($cookie_dir)) mkdir($cookie_dir);
76 76
             $cookie_file = $cookie_dir."/".md5(request()->ip()).".txt";
77 77
             curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
78 78
             curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
         $err = curl_error($ch);
83 83
         curl_close($ch);
84 84
 
85
-        if($err) {
85
+        if ($err) {
86 86
             return $err;
87
-        }else {
87
+        } else {
88 88
             return $response;
89 89
         }
90 90
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,9 @@  discard block
 block discarded – undo
72 72
         curl_setopt($ch, CURLOPT_REFERER, $this->referer);
73 73
         if($this->cookie === true) {
74 74
             $cookie_dir = storage_path("cookies");
75
-            if(!file_exists($cookie_dir)) mkdir($cookie_dir);
75
+            if(!file_exists($cookie_dir)) {
76
+                mkdir($cookie_dir);
77
+            }
76 78
             $cookie_file = $cookie_dir."/".md5(request()->ip()).".txt";
77 79
             curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
78 80
             curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
@@ -84,7 +86,7 @@  discard block
 block discarded – undo
84 86
 
85 87
         if($err) {
86 88
             return $err;
87
-        }else {
89
+        } else {
88 90
             return $response;
89 91
         }
90 92
     }
Please login to merge, or discard this patch.