Completed
Push — master ( 4f84cc...331858 )
by Oleg
02:30
created
tests/OptimizelyPHPTest/ResultTest.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@
 block discarded – undo
16 16
             "platform" => "web",
17 17
             "status" => "active",
18 18
             "web_snippet" => array(
19
-              "enable_force_variation" => false,
20
-              "exclude_disabled_experiments" => false,
21
-              "exclude_names" => true,
22
-              "include_jquery" => true,
23
-              "ip_anonymization" => false,
24
-              "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$",
25
-              "library" => "jquery-1.11.3-trim",
26
-              "project_javascript" => "alert(\"Active Experiment\")"
19
+                "enable_force_variation" => false,
20
+                "exclude_disabled_experiments" => false,
21
+                "exclude_names" => true,
22
+                "include_jquery" => true,
23
+                "ip_anonymization" => false,
24
+                "ip_filter" => "^206\\.23\\.100\\.([5-9][0-9]|1([0-4][0-9]|50))$",
25
+                "library" => "jquery-1.11.3-trim",
26
+                "project_javascript" => "alert(\"Active Experiment\")"
27 27
             ));
28 28
         
29 29
         $result = new Result($data, 200);
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Service/v2/Campaigns.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,21 +37,21 @@  discard block
 block discarded – undo
37 37
      * @return Result
38 38
      * @throws Exception
39 39
      */
40
-    public function listAll($projectId, $page=1, $perPage=25)
40
+    public function listAll($projectId, $page = 1, $perPage = 25)
41 41
     {
42 42
         if (!is_int($projectId)) {
43 43
             throw new Exception("Integer project ID expected, while got '$projectId'");
44 44
         }
45 45
         
46
-        if ($projectId<0) {
46
+        if ($projectId < 0) {
47 47
             throw new Exception("Expected positive integer project ID");
48 48
         }
49 49
         
50
-        if ($page<0) {
50
+        if ($page < 0) {
51 51
             throw new Exception('Invalid page number passed');
52 52
         }
53 53
         
54
-        if ($perPage<0 || $perPage>100) {
54
+        if ($perPage < 0 || $perPage > 100) {
55 55
             throw new Exception('Invalid page size passed');
56 56
         }
57 57
         
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                     Exception::CODE_INVALID_ARG);
108 108
         }
109 109
         
110
-        if ($campaignId<0) {
110
+        if ($campaignId < 0) {
111 111
             throw new Exception("Expected positive integer campaign ID",
112 112
                     Exception::CODE_INVALID_ARG);
113 113
         }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
     /**
96 96
      * Get campaign results
97 97
      * @param integer $campaignId The id for the campaign you want results for
98
-     * @param string $starTime The earliest time to count events in results. Defaults to the time that the campaign was first activated.
98
+     * @param string $startTime The earliest time to count events in results. Defaults to the time that the campaign was first activated.
99 99
      * @param string $endTime The latest time to count events in results. Defaults to the time the campaign was last active or the current time if the campaign is still running.
100 100
      * @return Result
101 101
      * @throws Exception
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Service/v2/Audiences.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@
 block discarded – undo
36 36
      * @return Result
37 37
      * @throws Exception
38 38
      */
39
-    public function listAll($projectId, $page=1, $perPage=25)
39
+    public function listAll($projectId, $page = 1, $perPage = 25)
40 40
     {
41
-        if ($page<0) {
41
+        if ($page < 0) {
42 42
             throw new Exception('Invalid page number passed');
43 43
         }
44 44
         
45
-        if ($perPage<0 || $perPage>100) {
45
+        if ($perPage < 0 || $perPage > 100) {
46 46
             throw new Exception('Invalid page size passed');
47 47
         }
48 48
         
Please login to merge, or discard this patch.
examples/Experiments/GetExperiments.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@  discard block
 block discarded – undo
16 16
 use WebMarketingROI\OptimizelyPHP\Exception;
17 17
 
18 18
 // Init class autloading.
19
-include dirname(__FILE__) . '/../../vendor/autoload.php';
19
+include dirname(__FILE__).'/../../vendor/autoload.php';
20 20
 
21 21
 // Include Utils.php - a file containing helper functions
22
-include dirname(__FILE__) . '/../Utils.php';
22
+include dirname(__FILE__).'/../Utils.php';
23 23
 
24 24
 // Read project ID from command line.
25
-if ($argc!=2) {
26
-    die('Expected 1 command-line argument, while got ' . $argc-1);
25
+if ($argc != 2) {
26
+    die('Expected 1 command-line argument, while got '.$argc - 1);
27 27
 }
28 28
 $projectId = $argv[1];
29 29
 
@@ -47,20 +47,20 @@  discard block
 block discarded – undo
47 47
         $experiments = $result->getPayload();
48 48
         
49 49
         foreach ($experiments as $experiment) {
50
-            echo "Name: " . $experiment->getName() . "\n";
51
-            echo "Description: " . $experiment->getDescription() . "\n";
52
-            echo "Status: " . $experiment->getStatus() . "\n";
53
-            echo "Created: " . $experiment->getCreated() . "\n";
50
+            echo "Name: ".$experiment->getName()."\n";
51
+            echo "Description: ".$experiment->getDescription()."\n";
52
+            echo "Status: ".$experiment->getStatus()."\n";
53
+            echo "Created: ".$experiment->getCreated()."\n";
54 54
             
55 55
             echo "\n";
56 56
         }
57 57
     
58 58
         // Determine if there are more projects.
59
-        if ($result->getNextPage()==null)
59
+        if ($result->getNextPage() == null)
60 60
             break;
61 61
         
62 62
         // Increment page counter.
63
-        $page ++;
63
+        $page++;
64 64
     }    
65 65
     
66 66
 } catch (Exception $e) {
@@ -74,6 +74,6 @@  discard block
 block discarded – undo
74 74
 
75 75
 // Save access token for later use
76 76
 $accessToken = $optimizelyClient->getAccessToken();
77
-file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken));
77
+file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken));
78 78
 
79 79
 echo "Done!\n";
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,9 @@
 block discarded – undo
55 55
         }
56 56
         
57 57
         // Determine if there are more projects.
58
-        if ($result->getNextPage()==null)
59
-            break;
58
+        if ($result->getNextPage()==null) {
59
+                    break;
60
+        }
60 61
         
61 62
         // Increment page counter.
62 63
         $page ++;
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Service/v2/Projects.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
      * @return Result
36 36
      * @throws Exception
37 37
      */
38
-    public function listAll($page=1, $perPage=25)
38
+    public function listAll($page = 1, $perPage = 25)
39 39
     {
40
-        if ($page<0) {
40
+        if ($page < 0) {
41 41
             throw new Exception('Invalid page number passed');
42 42
         }
43 43
         
44
-        if ($perPage<0 || $perPage>100) {
44
+        if ($perPage < 0 || $perPage > 100) {
45 45
             throw new Exception('Invalid page size passed');
46 46
         }
47 47
         
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public function get($projectId)
71 71
     {
72
-        $projectId = (string)$projectId;
72
+        $projectId = (string) $projectId;
73 73
         
74 74
         if (!preg_match('/^\d+$/', $projectId)) {
75 75
             throw new Exception("A positive integer project ID expected, while got $projectId");
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
      */
115 115
     public function update($projectId, $project) 
116 116
     {
117
-        $projectId = (string)$projectId;
117
+        $projectId = (string) $projectId;
118 118
         
119 119
         if (!preg_match('/\d+/', $projectId)) {
120 120
             throw new Exception("A positive integer project ID expected, while got $projectId");
121 121
         }
122 122
         
123
-        if ($projectId<0) {
123
+        if ($projectId < 0) {
124 124
             throw new Exception("A positive project ID expected");
125 125
         }
126 126
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Metric.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,9 @@
 block discarded – undo
91 91
         // Remove options with empty values
92 92
         $cleanedOptions = array();
93 93
         foreach ($options as $name=>$value) {
94
-            if ($value!==null)
95
-                $cleanedOptions[$name] = $value;
94
+            if ($value!==null) {
95
+                            $cleanedOptions[$name] = $value;
96
+            }
96 97
         }
97 98
         
98 99
         return $cleanedOptions;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                 case 'field': $this->setField($value); break;
60 60
                 case 'scope': $this->setScope($value); break;
61 61
                 default:
62
-                    throw new Exception('Unknown option found in the Metric entity: ' . $name);
62
+                    throw new Exception('Unknown option found in the Metric entity: '.$name);
63 63
             }
64 64
         }
65 65
     }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         // Remove options with empty values
80 80
         $cleanedOptions = array();
81 81
         foreach ($options as $name=>$value) {
82
-            if ($value!==null)
82
+            if ($value !== null)
83 83
                 $cleanedOptions[$name] = $value;
84 84
         }
85 85
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Change.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,9 @@
 block discarded – undo
91 91
         // Remove options with empty values
92 92
         $cleanedOptions = array();
93 93
         foreach ($options as $name=>$value) {
94
-            if ($value!==null)
95
-                $cleanedOptions[$name] = $value;
94
+            if ($value!==null) {
95
+                            $cleanedOptions[$name] = $value;
96
+            }
96 97
         }
97 98
         
98 99
         return $cleanedOptions;
Please login to merge, or discard this patch.
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -316,6 +316,9 @@  discard block
 block discarded – undo
316 316
         return $this->attributes;
317 317
     }
318 318
     
319
+    /**
320
+     * @param ChangeAttribute $attributes
321
+     */
319 322
     public function setAttributes($attributes)
320 323
     {
321 324
         $this->attributes = $attributes;
@@ -326,6 +329,9 @@  discard block
 block discarded – undo
326 329
         return $this->rearrange;
327 330
     }
328 331
     
332
+    /**
333
+     * @param string $rearrange
334
+     */
329 335
     public function setRearrange($rearrange)
330 336
     {
331 337
         $this->rearrange = $rearrange;
@@ -346,6 +352,9 @@  discard block
 block discarded – undo
346 352
         return $this->css;
347 353
     }
348 354
     
355
+    /**
356
+     * @param CssAttribute $css
357
+     */
349 358
     public function setCss($css)
350 359
     {
351 360
         $this->css = $css;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
                 case 'name': $this->setName($value); break;                
162 162
                 case 'operator': $this->setOperator($value); break;                
163 163
                 default:
164
-                    throw new Exception('Unknown option found in the Change entity: ' . $name);
164
+                    throw new Exception('Unknown option found in the Change entity: '.$name);
165 165
             }
166 166
         }
167 167
     }
@@ -183,10 +183,10 @@  discard block
 block discarded – undo
183 183
             'value' => $this->getValue(),
184 184
             'id' => $this->getId(),            
185 185
             'selector' => $this->getSelector(),
186
-            'attributes' => $this->getAttributes()?$this->getAttributes()->toArray():null,
186
+            'attributes' => $this->getAttributes() ? $this->getAttributes()->toArray() : null,
187 187
             'rearrange' => $this->getRearrange(),
188 188
             'config' => $this->getConfig(),
189
-            'css' => $this->getCss()?$this->getCss()->toArray():null,
189
+            'css' => $this->getCss() ? $this->getCss()->toArray() : null,
190 190
             'name' => $this->getName(),
191 191
             'operator' => $this->getOperator(),
192 192
         );
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         // Remove options with empty values
195 195
         $cleanedOptions = array();
196 196
         foreach ($options as $name=>$value) {
197
-            if ($value!==null)
197
+            if ($value !== null)
198 198
                 $cleanedOptions[$name] = $value;
199 199
         }
200 200
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Event.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,9 @@
 block discarded – undo
91 91
         // Remove options with empty values
92 92
         $cleanedOptions = array();
93 93
         foreach ($options as $name=>$value) {
94
-            if ($value!==null)
95
-                $cleanedOptions[$name] = $value;
94
+            if ($value!==null) {
95
+                            $cleanedOptions[$name] = $value;
96
+            }
96 97
         }
97 98
         
98 99
         return $cleanedOptions;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
                 case 'is_editable': $this->setIsEditable($value); break;                
133 133
                 case 'config': $this->setConfig(new InPageEventConfig($value)); break;
134 134
                 default:
135
-                    throw new Exception('Unknown option found in the Event entity: ' . $name);
135
+                    throw new Exception('Unknown option found in the Event entity: '.$name);
136 136
             }
137 137
         }
138 138
     }
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             'category' => $this->getCategory(),
149 149
             'created' => $this->getCreated(),
150 150
             'description' => $this->getDescription(),
151
-            'event_filter' => $this->getEventFilter()?$this->getEventFilter()->toArray():null,
151
+            'event_filter' => $this->getEventFilter() ? $this->getEventFilter()->toArray() : null,
152 152
             'event_type' => $this->getEventType(),
153 153
             'key' => $this->getKey(),
154 154
             'name' => $this->getName(),
@@ -157,13 +157,13 @@  discard block
 block discarded – undo
157 157
             'id' => $this->getId(),
158 158
             'is_classic' => $this->getIsClassic(),
159 159
             'is_editable' => $this->getIsEditable(),            
160
-            'config' => $this->getConfig()?$this->getConfig()->toArray():null,
160
+            'config' => $this->getConfig() ? $this->getConfig()->toArray() : null,
161 161
         );
162 162
         
163 163
         // Remove options with empty values
164 164
         $cleanedOptions = array();
165 165
         foreach ($options as $name=>$value) {
166
-            if ($value!==null)
166
+            if ($value !== null)
167 167
                 $cleanedOptions[$name] = $value;
168 168
         }
169 169
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/Audience.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,9 @@
 block discarded – undo
91 91
         // Remove options with empty values
92 92
         $cleanedOptions = array();
93 93
         foreach ($options as $name=>$value) {
94
-            if ($value!==null)
95
-                $cleanedOptions[$name] = $value;
94
+            if ($value!==null) {
95
+                            $cleanedOptions[$name] = $value;
96
+            }
96 97
         }
97 98
         
98 99
         return $cleanedOptions;
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                 case 'last_modified': $this->setLastModified($value); break;
94 94
                 case 'is_classic': $this->getIsClassic($value); break;
95 95
                 default:
96
-                    throw new Exception('Unknown option: ' . $name);
96
+                    throw new Exception('Unknown option: '.$name);
97 97
             }
98 98
         }
99 99
     }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         // Remove options with empty values
120 120
         $cleanedOptions = array();
121 121
         foreach ($options as $name=>$value) {
122
-            if ($value!==null)
122
+            if ($value !== null)
123 123
                 $cleanedOptions[$name] = $value;
124 124
         }
125 125
         
Please login to merge, or discard this patch.