Completed
Pull Request — master (#22)
by Hiraku
02:19
created
src/Aspects/HttpGetRequest.php 2 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -60,6 +60,9 @@  discard block
 block discarded – undo
60 60
         }
61 61
     }
62 62
 
63
+    /**
64
+     * @param string $url
65
+     */
63 66
     public function importURL($url)
64 67
     {
65 68
         $struct = parse_url($url);
@@ -78,6 +81,11 @@  discard block
 block discarded – undo
78 81
     }
79 82
 
80 83
     // utility for __construct
84
+
85
+    /**
86
+     * @param string $key
87
+     * @param string $default
88
+     */
81 89
     private static function setOr(array $struct, $key, $default=null)
82 90
     {
83 91
         if (!empty($struct[$key])) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function importURL($url)
64 64
     {
65 65
         $struct = parse_url($url);
66
-        if (! $struct) {
66
+        if (!$struct) {
67 67
             throw new \InvalidArgumentException("$url is not valid URL");
68 68
         }
69 69
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
         $this->username = self::setOr($struct, 'user', null);
75 75
         $this->password = self::setOr($struct, 'pass', null);
76 76
 
77
-        if (! empty($struct['query'])) {
77
+        if (!empty($struct['query'])) {
78 78
             parse_str($struct['query'], $this->query);
79 79
         }
80 80
     }
81 81
 
82 82
     // utility for __construct
83
-    private static function setOr(array $struct, $key, $default=null)
83
+    private static function setOr(array $struct, $key, $default = null)
84 84
     {
85 85
         if (!empty($struct[$key])) {
86 86
             return $struct[$key];
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             CURLOPT_USERAGENT => $this->genUA(),
101 101
         );
102 102
 
103
-        $curlOpts[CURLOPT_VERBOSE] = (bool) $this->verbose;
103
+        $curlOpts[CURLOPT_VERBOSE] = (bool)$this->verbose;
104 104
 
105 105
         if ($this->username && $this->password) {
106 106
             $curlOpts[CURLOPT_USERPWD] = "$this->username:$this->password";
Please login to merge, or discard this patch.
src/Factory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
      * @param bool $auth
47 47
      * @return resource<curl>
48 48
      */
49
-    public static function getConnection($origin, $auth=false)
49
+    public static function getConnection($origin, $auth = false)
50 50
     {
51 51
         $instance = self::getInstance();
52 52
         if ($auth) {
Please login to merge, or discard this patch.
src/Plugin.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         }
108 108
 
109 109
         $config = $this->config->get('prestissimo');
110
-        if (! is_array($config)) {
110
+        if (!is_array($config)) {
111 111
             $config = array();
112 112
         }
113 113
         $config += array(
@@ -118,16 +118,16 @@  discard block
 block discarded – undo
118 118
             'privatePackages' => array(),
119 119
         );
120 120
 
121
-        if (! is_int($config['maxConnections']) || $config['maxConnections'] < 1) {
121
+        if (!is_int($config['maxConnections']) || $config['maxConnections'] < 1) {
122 122
             $config['maxConnections'] = 6;
123 123
         }
124
-        if (! is_int($config['minConnections']) || $config['minConnections'] > $config['maxConnections']) {
124
+        if (!is_int($config['minConnections']) || $config['minConnections'] > $config['maxConnections']) {
125 125
             $config['minConnections'] = 3;
126 126
         }
127
-        if (! is_bool($config['pipeline'])) {
127
+        if (!is_bool($config['pipeline'])) {
128 128
             $config['pipeline'] = (bool)$config['pipeline'];
129 129
         }
130
-        if (! is_array($config['privatePackages'])) {
130
+        if (!is_array($config['privatePackages'])) {
131 131
             $config['privatePackages'] = (array)$config['privatePackages'];
132 132
         }
133 133
 
Please login to merge, or discard this patch.
src/CurlRemoteFilesystem.php 2 patches
Doc Comments   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     /**
82 82
      * Get the content.
83 83
      *
84
-     * @param string $originUrl The origin URL
84
+     * @param string $origin The origin URL
85 85
      * @param string $fileUrl   The file URL
86 86
      * @param bool   $progress  Display the progression
87 87
      * @param array  $options   Additional context options
@@ -101,6 +101,11 @@  discard block
 block discarded – undo
101 101
         });
102 102
     }
103 103
 
104
+    /**
105
+     * @param string $fileUrl
106
+     * @param boolean $progress
107
+     * @param \Closure $exec
108
+     */
104 109
     protected function fetch($origin, $fileUrl, $progress, $options, $exec)
105 110
     {
106 111
         do {
@@ -205,11 +210,6 @@  discard block
 block discarded – undo
205 210
     }
206 211
 
207 212
     /**
208
-     * @param  resource<curl> $ch
209
-     * @param  int $downBytesMax
210
-     * @param  int $downBytes
211
-     * @param  int $upBytesMax
212
-     * @param  int $upBytes
213 213
      */
214 214
     public function progress()
215 215
     {
@@ -230,6 +230,9 @@  discard block
 block discarded – undo
230 230
         return 0;
231 231
     }
232 232
 
233
+    /**
234
+     * @param string $fileName
235
+     */
233 236
     public static function createFile($fileName)
234 237
     {
235 238
         if (is_dir($fileName)) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
      *
57 57
      * @return bool true
58 58
      */
59
-    public function copy($origin, $fileUrl, $fileName, $progress=true, $options=array())
59
+    public function copy($origin, $fileUrl, $fileName, $progress = true, $options = array())
60 60
     {
61 61
         $that = $this; // for PHP5.3
62 62
 
63
-        return $this->fetch($origin, $fileUrl, $progress, $options, function ($ch, $request) use ($that, $fileName) {
63
+        return $this->fetch($origin, $fileUrl, $progress, $options, function($ch, $request) use ($that, $fileName) {
64 64
             $fp = $that->createFile($fileName);
65 65
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
66 66
             curl_setopt($ch, CURLOPT_FILE, $fp);
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
      *
89 89
      * @return bool|string The content
90 90
      */
91
-    public function getContents($origin, $fileUrl, $progress=true, $options=array())
91
+    public function getContents($origin, $fileUrl, $progress = true, $options = array())
92 92
     {
93 93
         $that = $this; // for PHP5.3
94 94
 
95
-        return $this->fetch($origin, $fileUrl, $progress, $options, function ($ch, $request) use ($that) {
95
+        return $this->fetch($origin, $fileUrl, $progress, $options, function($ch, $request) use ($that) {
96 96
             // This order is important.
97 97
             curl_setopt($ch, CURLOPT_FILE, STDOUT);
98 98
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
Please login to merge, or discard this patch.