Passed
Branch master (fc6f30)
by Edi
02:39
created
Validator/HtmlPdfApiValidator.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
         if (!empty($params['page_size']) && !is_string($params['page_size']))
50 50
             throw new InvalidParameterException('Page size must be a string of some standard page size.');
51 51
 
52
-        if (!empty($params['dpi']) && (!is_int($params['dpi']) || $params['dpi']<75))
52
+        if (!empty($params['dpi']) && (!is_int($params['dpi']) || $params['dpi'] < 75))
53 53
             throw new InvalidParameterException('DPI must be an integer larger than 75.');
54 54
 
55 55
         if (!empty($params['image_dpi']) && !is_int($params['image_dpi']))
56 56
             throw new InvalidParameterException('Image DPI must be an integer.');
57 57
 
58 58
         if (!empty($params['lowquality']) && (!is_int($params['lowquality']) || !in_array($params['lowquality'], array(
59
-                    0, 1 ) )))
59
+                    0, 1 ))))
60 60
             throw new InvalidParameterException(
61 61
                 'Lowquality must be either 0 or 1 (alternative: use bool values');
62 62
 
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
             throw new InvalidParameterException('Margin top must be an integer.');
78 78
 
79 79
         if (!empty($params['background']) && (!is_int($params['background']) || !in_array($params['background'], array(
80
-                    0, 1 ) )))
80
+                    0, 1 ))))
81 81
             throw new InvalidParameterException(
82 82
                 'Background must be either 0 or 1 (alternative: use bool values');
83 83
 
84 84
         if (!empty($params['images']) && (!is_int($params['images']) || !in_array($params['images'], array(
85
-                    0, 1 ) )))
85
+                    0, 1 ))))
86 86
             throw new InvalidParameterException(
87 87
                 'Images must be either 0 or 1 (alternative: use bool values');
88 88
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             throw new InvalidParameterException('Group must be a string.');
101 101
 
102 102
         if (!empty($params['engine_version']) && (!is_int($params['engine_version']) || !in_array($params['engine_version'],
103
-        array( 11, 12 ) )))
103
+        array(11, 12))))
104 104
             throw new InvalidParameterException(
105 105
                 'Engine version can be integer 11 or 12');
106 106
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             throw new InvalidParameterException('Title must be a string.');
109 109
 
110 110
         if (!empty($params['outline']) && (!is_int($params['outline']) || !in_array($params['outline'], array(
111
-                    0, 1 ) )))
111
+                    0, 1 ))))
112 112
             throw new InvalidParameterException(
113 113
                 'Outline must be either 0 or 1 (alternative: use bool values');
114 114
 
@@ -119,21 +119,21 @@  discard block
 block discarded – undo
119 119
             throw new InvalidParameterException('Encoding must be a string.');
120 120
 
121 121
         if (!empty($params['javascript']) && (!is_int($params['javascript']) || !in_array($params['javascript'], array(
122
-                    0, 1 ) )))
122
+                    0, 1 ))))
123 123
             throw new InvalidParameterException(
124 124
                 'Javascript must be either 0 or 1 (alternative: use bool values');
125 125
 
126 126
         if (!empty($params['javascript_delay']) &&
127
-            (!is_int($params['javascript_delay']) || $params['javascript_delay']<1 || $params['javascript_delay']>800))
127
+            (!is_int($params['javascript_delay']) || $params['javascript_delay'] < 1 || $params['javascript_delay'] > 800))
128 128
             throw new InvalidParameterException('Javascript delay must be an integer larger than 1, but smaller than 800.');
129 129
 
130 130
         if (!empty($params['internal_links']) &&
131
-            (!is_int($params['internal_links']) || !in_array($params['internal_links'], array( 0, 1 ) )))
131
+            (!is_int($params['internal_links']) || !in_array($params['internal_links'], array(0, 1))))
132 132
             throw new InvalidParameterException(
133 133
                 'Internal links must be either 0 or 1 (alternative: use bool values');
134 134
 
135 135
         if (!empty($params['external_links']) &&
136
-            (!is_int($params['external_links']) || !in_array($params['external_links'], array( 0, 1 ) )))
136
+            (!is_int($params['external_links']) || !in_array($params['external_links'], array(0, 1))))
137 137
             throw new InvalidParameterException(
138 138
                 'External links must be either 0 or 1 (alternative: use bool values');
139 139
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
         if (!empty($params['use_print_media']) &&
150 150
             (!is_int($params['use_print_media']) || !in_array($params['use_print_media'], array(
151
-                    0, 1 ) )))
151
+                    0, 1 ))))
152 152
             throw new InvalidParameterException(
153 153
                 'Use print media must be either 0 or 1 (alternative: use bool values');
154 154
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
         $path_parts = pathinfo($filePath);
187 187
 
188
-        if( !in_array($path_parts['extension'], array(
188
+        if (!in_array($path_parts['extension'], array(
189 189
             "js", "css", "png", "jpg", "jpeg", "gif", "ttf", "otf", "woff"
190 190
         )))
191 191
             throw new WrongFileExtensionException("Wrong file format\n
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
         $path_parts = pathinfo($filePath);
211 211
 
212
-        if( !in_array($path_parts['extension'], array(
212
+        if (!in_array($path_parts['extension'], array(
213 213
             "html", "htm", "zip", "tar.gz", "tgz", "tar.bz2"
214 214
         )))
215 215
             throw new WrongFileExtensionException("Wrong file format\n
Please login to merge, or discard this patch.
HttpClient/Curl.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     private function initiatePost($url, $params)
44 44
     {
45 45
         $ch = curl_init($this->host.'/'.$url);
46
-        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authentication: Token ". $this->token));
46
+        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authentication: Token ".$this->token));
47 47
         curl_setopt($ch, CURLOPT_POST, 1);
48 48
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
49 49
         curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
@@ -61,11 +61,11 @@  discard block
 block discarded – undo
61 61
     {;
62 62
         if (!empty($params))
63 63
         {
64
-            $parameter=implode(array_values($params));
64
+            $parameter = implode(array_values($params));
65 65
             $url .= '/'.$parameter;
66 66
         }
67 67
         $ch = curl_init($this->host.'/'.$url);
68
-        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authentication: Token ". $this->token));
68
+        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authentication: Token ".$this->token));
69 69
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
70 70
 
71 71
         return $ch;
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 
84 84
         if (!empty($params))
85 85
         {
86
-            $parameter=implode(array_values($params));
86
+            $parameter = implode(array_values($params));
87 87
             $url .= '/'.$parameter;
88 88
         }
89 89
         $ch = curl_init($this->host.'/'.$url);
90
-        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authentication: Token ". $this->token));
90
+        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authentication: Token ".$this->token));
91 91
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
92 92
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
93 93
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         }
112 112
 
113 113
         curl_setopt($ch, CURLOPT_HTTPHEADER, array(
114
-            "Authentication: Token ". $this->token
114
+            "Authentication: Token ".$this->token
115 115
         ));
116 116
         curl_setopt($ch, CURLOPT_POST, 1);
117 117
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@@ -130,26 +130,26 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function sendRequest($url, $params, $method)
132 132
     {
133
-        if($method=='POST')
133
+        if ($method=='POST')
134 134
         {
135 135
             if (!empty($params['file']))
136 136
                 $ch = $this->initiateUpload($url, $params);
137 137
             else
138 138
                 $ch = $this->initiatePost($url, $params);
139 139
         }
140
-        else if($method=='GET')
140
+        else if ($method=='GET')
141 141
         {
142 142
             $ch = $this->initiateGet($url, $params);
143 143
         }
144
-        else if($method=='DELETE')
144
+        else if ($method=='DELETE')
145 145
         {
146 146
             $ch = $this->initiateDelete($url, $params);
147 147
         }
148
-        else{
148
+        else {
149 149
             throw new \Exception("Method ".$method." not supported!");
150 150
         }
151 151
 
152
-        if (! $ret = curl_exec($ch))
152
+        if (!$ret = curl_exec($ch))
153 153
         {
154 154
             trigger_error(curl_error($ch));
155 155
         }
Please login to merge, or discard this patch.
HttpClient/Guzzle.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         $this->setDescription(ServiceDescription::factory($json_location));
38 38
 
39
-        $header = array( 'Authentication' => 'Token' . " " . $config->get('token') );
39
+        $header = array('Authentication' => 'Token'." ".$config->get('token'));
40 40
         $this->setDefaultOption("headers", $header);
41 41
     }
42 42
 
@@ -51,21 +51,21 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function sendRequest($url, $params, $method)
53 53
     {
54
-        try{
55
-            if (!empty($params['html'])){
54
+        try {
55
+            if (!empty($params['html'])) {
56 56
                 $commandName = 'GenerateFromHTML';
57 57
             }
58
-            else if (!empty($params['url'])){
58
+            else if (!empty($params['url'])) {
59 59
                 $commandName = 'GenerateFromURL';
60 60
             }
61
-            else if (!empty($params['file'])&& $url=='pdf'){
61
+            else if (!empty($params['file']) && $url=='pdf') {
62 62
                 $commandName = 'GenerateFromFile';
63 63
             }
64 64
             else {
65 65
                 $operations = $this->getDescription()->getOperations();
66 66
                 foreach ($operations as $operation)
67 67
                 {
68
-                    if ($operation->getUri()==$url && $operation->getHttpMethod() == $method)
68
+                    if ($operation->getUri()==$url && $operation->getHttpMethod()==$method)
69 69
                     {
70 70
                         $commandName = $operation->getName();
71 71
                     }
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
             $command = $this->getCommand($commandName, $params);
75 75
             $ret = $this->execute($command);
76 76
 
77
-            if ( $commandName == 'GetAssetList' || $commandName == 'UploadAsset' )
77
+            if ($commandName=='GetAssetList' || $commandName=='UploadAsset')
78 78
             {
79 79
                 return json_encode($ret);
80 80
             }
81 81
             return $ret->getBody(true);
82 82
 
83
-        }catch(ClientErrorResponseException $exception){
83
+        } catch (ClientErrorResponseException $exception) {
84 84
             throw new \Exception($exception->getResponse()->getBody(true), $exception->getResponse()->getStatusCode());
85 85
         }
86 86
     }
Please login to merge, or discard this patch.
HtmlPdfApi.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function generateFromURL($params)
41 41
     {
42
-        if(empty($params['url']))
43
-            throw new \Exception('Parameter \'url\' must be set' );
42
+        if (empty($params['url']))
43
+            throw new \Exception('Parameter \'url\' must be set');
44 44
 
45 45
         $params = $this->validator->validate($params);
46 46
 
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function generateFromHTML($params)
63 63
     {
64
-        if(empty($params['html']))
65
-            throw new \Exception('Parameter \'html\' must be set' );
64
+        if (empty($params['html']))
65
+            throw new \Exception('Parameter \'html\' must be set');
66 66
 
67 67
         $params = $this->validator->validate($params);
68 68
 
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function generateFromFile($params)
84 84
     {
85
-        if(empty($params['file']))
86
-            throw new \Exception('Parameter \'file\' must be set' );
85
+        if (empty($params['file']))
86
+            throw new \Exception('Parameter \'file\' must be set');
87 87
 
88 88
         $params['file'] = '@'.$params['file'];
89 89
         $params = $this->validator->validate($params);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function uploadAsset($filePath)
124 124
     {
125
-        $params = array( 'file' => '@'.$filePath );
125
+        $params = array('file' => '@'.$filePath);
126 126
         $params = $this->validator->validate($params);
127 127
         $this->validator->validateAssetFile($params['file']);
128 128
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function getAsset($id)
144 144
     {
145
-        $params = array( 'id' => $id );
145
+        $params = array('id' => $id);
146 146
         $params = $this->validator->validate($params);
147 147
 
148 148
         try {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      */
162 162
     public function deleteAsset($id)
163 163
     {
164
-        $params = array( 'id' => $id );
164
+        $params = array('id' => $id);
165 165
         $params = $this->validator->validate($params);
166 166
 
167 167
         try {
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
         foreach ($list_json as $asset)
205 205
         {
206
-            if ($asset['name'] == $name)
206
+            if ($asset['name']==$name)
207 207
             {
208 208
                 return $asset['id'];
209 209
             }
Please login to merge, or discard this patch.
Exception/InvalidParameterException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      *
12 12
      * @param string $message   Message of the exception
13 13
      */
14
-    public function __construct ($message)
14
+    public function __construct($message)
15 15
     {
16 16
         parent::__construct($message);
17 17
     }
Please login to merge, or discard this patch.
Exception/FileNotFoundException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      *
12 12
      * @param string $message   Message of the exception
13 13
      */
14
-    public function __construct ($message)
14
+    public function __construct($message)
15 15
     {
16 16
         parent::__construct($message);
17 17
     }
Please login to merge, or discard this patch.
Exception/WrongFileExtensionException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      *
12 12
      * @param string $message   Message of the exception
13 13
      */
14
-    public function __construct ($message)
14
+    public function __construct($message)
15 15
     {
16 16
         parent::__construct($message);
17 17
     }
Please login to merge, or discard this patch.