Completed
Push — master ( 96059f...fe2237 )
by Oleg
06:07
created
examples/Experiments/CreateExperiment.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 use WebMarketingROI\OptimizelyPHP\Resource\v2\Project;
18 18
 
19 19
 // Init class autloading.
20
-include dirname(__FILE__) . '/../../vendor/autoload.php';
20
+include dirname(__FILE__).'/../../vendor/autoload.php';
21 21
 
22 22
 // Include Utils.php - a file containing helper functions
23
-include dirname(__FILE__) . '/../Utils.php';
23
+include dirname(__FILE__).'/../Utils.php';
24 24
 
25 25
 // Get OAuth 2.0 credentials from auth_credentials.json and access_token.json files.
26 26
 $credentials = load_credentials_from_file();
@@ -117,6 +117,6 @@  discard block
 block discarded – undo
117 117
 
118 118
 // Save access token for later use
119 119
 $accessToken = $optimizelyClient->getAccessToken();
120
-file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken));
120
+file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken));
121 121
 
122 122
 echo "Done!\n";
123 123
\ No newline at end of file
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,6 @@
 block discarded – undo
14 14
 
15 15
 use WebMarketingROI\OptimizelyPHP\OptimizelyApiClient;
16 16
 use WebMarketingROI\OptimizelyPHP\Exception;
17
-use WebMarketingROI\OptimizelyPHP\Resource\v2\Project;
18 17
 
19 18
 // Init class autloading.
20 19
 include dirname(__FILE__) . '/../../vendor/autoload.php';
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -33,73 +33,73 @@
 block discarded – undo
33 33
     $experiment = new Experiment(array(
34 34
             "project_id" => 1000,
35 35
             "audience_ids" => array(
36
-              1234,
37
-              1212,
38
-              1432
36
+                1234,
37
+                1212,
38
+                1432
39 39
             ),
40 40
             "campaign_id" => 2000,
41 41
             "changes" => array(
42
-              array(
42
+                array(
43 43
                 "type" => "custom_code",
44 44
                 "allow_additional_redirect" => true,
45 45
                 "async" => true,
46 46
                 "css_selector" => "a[href*=\"optimizely\"]",
47 47
                 "dependencies" => array(
48
-                  24,
49
-                  26
48
+                    24,
49
+                    26
50 50
                 ),
51 51
                 "destination" => "https://app.optimizely.com/",
52 52
                 "extension_id" => 1234,
53 53
                 "preserve_parameters" => true,
54 54
                 "src" => 524,
55 55
                 "value" => "window.someGlobalFunction();"
56
-              )
56
+                )
57 57
             ),
58 58
             "description" => "string",
59 59
             "holdback" => 5000,
60 60
             "key" => "home_page_experiment",
61 61
             "metrics" => array(
62
-              array(
62
+                array(
63 63
                 "kind" => "string"
64
-              )
64
+                )
65 65
             ),
66 66
             "name" => "Blue Button Experiment",
67 67
             "schedule" => array(
68
-              "start_time" => "2016-10-17T07:04:59.724Z",
69
-              "stop_time" => "2016-10-17T07:04:59.724Z",
70
-              "time_zone" => "UTC"
68
+                "start_time" => "2016-10-17T07:04:59.724Z",
69
+                "stop_time" => "2016-10-17T07:04:59.724Z",
70
+                "time_zone" => "UTC"
71 71
             ),
72 72
             "status" => "active",
73 73
             "variations" => array(
74
-              array(
74
+                array(
75 75
                 "actions" => array(
76
-                  array(
76
+                    array(
77 77
                     "changes" => array(
78
-                      array(
78
+                        array(
79 79
                         "type" => "custom_code",
80 80
                         "allow_additional_redirect" => true,
81 81
                         "async" => true,
82 82
                         "css_selector" => "a[href*=\"optimizely\"]",
83 83
                         "dependencies" => array(
84
-                          24,
85
-                          26
84
+                            24,
85
+                            26
86 86
                         ),
87 87
                         "destination" => "https://app.optimizely.com/",
88 88
                         "extension_id" => 1234,
89 89
                         "preserve_parameters" => true,
90 90
                         "src" => 524,
91 91
                         "value" => "window.someGlobalFunction();"
92
-                      )
92
+                        )
93 93
                     ),
94 94
                     "page_id" => 0
95
-                  )
95
+                    )
96 96
                 ),
97 97
                 "archived" => true,
98 98
                 "key" => "blue_button_variation",
99 99
                 "name" => "Blue Button",
100 100
                 "variation_id" => 0,
101 101
                 "weight" => 0
102
-              )
102
+                )
103 103
             )
104 104
         ));
105 105
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Service/v2/Events.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,14 +38,14 @@
 block discarded – undo
38 38
      * @return Result
39 39
      * @throws Exception
40 40
      */
41
-    public function listAll($projectId, $includeClassic, $page=1, $perPage=25)
41
+    public function listAll($projectId, $includeClassic, $page = 1, $perPage = 25)
42 42
     {
43
-        if ($page<0) {
43
+        if ($page < 0) {
44 44
             throw new Exception('Invalid page number passed',
45 45
                     Exception::CODE_INVALID_ARG);
46 46
         }
47 47
         
48
-        if ($perPage<0) {
48
+        if ($perPage < 0) {
49 49
             throw new Exception('Invalid page size passed',
50 50
                     Exception::CODE_INVALID_ARG);
51 51
         }
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Service/v2/Pages.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) {
45
+        if ($perPage < 0) {
46 46
             throw new Exception('Invalid page size passed');
47 47
         }
48 48
         
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Resource/v2/ExperimentVariationReach.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
                     break;                
72 72
                 }
73 73
                 default:
74
-                    throw new Exception('Unknown option: ' . $name);
74
+                    throw new Exception('Unknown option: '.$name);
75 75
             }
76 76
         }
77 77
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         // Remove options with empty values
98 98
         $cleanedOptions = array();
99 99
         foreach ($options as $name=>$value) {
100
-            if ($value!==null)
100
+            if ($value !== null)
101 101
                 $cleanedOptions[$name] = $value;
102 102
         }
103 103
         
Please login to merge, or discard this patch.
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.
lib/WebMarketingROI/OptimizelyPHP/Exception.php 2 patches
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -55,20 +55,25 @@
 block discarded – undo
55 55
     {
56 56
         parent::__construct($message, $code);
57 57
         
58
-        if (isset($options['http_code']))
59
-            $this->setHttpCode($options['http_code']);
58
+        if (isset($options['http_code'])) {
59
+                    $this->setHttpCode($options['http_code']);
60
+        }
60 61
                 
61
-        if (isset($options['uuid']))
62
-            $this->setUuid($options['uuid']);
62
+        if (isset($options['uuid'])) {
63
+                    $this->setUuid($options['uuid']);
64
+        }
63 65
         
64
-        if (isset($options['rate_limit']))
65
-            $this->setRateLimit($options['rate_limit']);
66
+        if (isset($options['rate_limit'])) {
67
+                    $this->setRateLimit($options['rate_limit']);
68
+        }
66 69
         
67
-        if (isset($options['rate_limit_remaining']))
68
-            $this->setRateLimitRemaining($options['rate_limit_remaining']);
70
+        if (isset($options['rate_limit_remaining'])) {
71
+                    $this->setRateLimitRemaining($options['rate_limit_remaining']);
72
+        }
69 73
         
70
-        if (isset($options['rate_limit_reset']))
71
-            $this->setRateLimitReset($options['rate_limit_reset']);
74
+        if (isset($options['rate_limit_reset'])) {
75
+                    $this->setRateLimitReset($options['rate_limit_reset']);
76
+        }
72 77
     }
73 78
     
74 79
     /**
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,7 +82,6 @@  discard block
 block discarded – undo
82 82
             
83 83
     /**
84 84
      * Set HTTP response code.
85
-     * @param integer $code
86 85
      */
87 86
     public function setHttpCode($httpCode)
88 87
     {
@@ -100,7 +99,6 @@  discard block
 block discarded – undo
100 99
             
101 100
     /**
102 101
      * Set message
103
-     * @param string $message
104 102
      */
105 103
     public function setUuid($uuid)
106 104
     {
@@ -145,7 +143,7 @@  discard block
 block discarded – undo
145 143
     
146 144
     /**
147 145
      * Return the exact time that your fresh new rate limit kicks in.
148
-     * @return integer|null
146
+     * @return string
149 147
      */
150 148
     public function getRateLimitReset()
151 149
     {
Please login to merge, or discard this patch.
examples/Projects/CreateProject.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 use WebMarketingROI\OptimizelyPHP\Resource\v2\Project;
18 18
 
19 19
 // Init class autloading.
20
-include dirname(__FILE__) . '/../../vendor/autoload.php';
20
+include dirname(__FILE__).'/../../vendor/autoload.php';
21 21
 
22 22
 // Include Utils.php - a file containing helper functions
23
-include dirname(__FILE__) . '/../Utils.php';
23
+include dirname(__FILE__).'/../Utils.php';
24 24
 
25 25
 // Get OAuth 2.0 credentials from auth_credentials.json and access_token.json files.
26 26
 $credentials = load_credentials_from_file();
@@ -117,6 +117,6 @@  discard block
 block discarded – undo
117 117
 
118 118
 // Save access token for later use
119 119
 $accessToken = $optimizelyClient->getAccessToken();
120
-file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken));
120
+file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken));
121 121
 
122 122
 echo "Done!\n";
123 123
\ No newline at end of file
Please login to merge, or discard this patch.
lib/WebMarketingROI/OptimizelyPHP/Result.php 1 patch
Doc Comments   +2 added lines, -5 removed lines patch added patch discarded remove patch
@@ -70,8 +70,6 @@  discard block
 block discarded – undo
70 70
     /**
71 71
      * Constructor.
72 72
      * @param array $decodedJsonData
73
-     * @param string $rawHttpResponseData
74
-     * @param array[string] $rawHttpResponseHeaders
75 73
      */
76 74
     public function __construct($decodedJsonData, $httpCode)
77 75
     {
@@ -90,7 +88,6 @@  discard block
 block discarded – undo
90 88
             
91 89
     /**
92 90
      * Set HTTP response code.
93
-     * @param integer $code
94 91
      */
95 92
     public function setHttpCode($httpCode)
96 93
     {
@@ -108,7 +105,7 @@  discard block
 block discarded – undo
108 105
     
109 106
     /**
110 107
      * Set payload (parsed and wrapped response data).
111
-     * @param mixed $payload
108
+     * @param integer $payload
112 109
      */
113 110
     public function setPayload($payload)
114 111
     {
@@ -225,7 +222,7 @@  discard block
 block discarded – undo
225 222
     
226 223
     /**
227 224
      * Return the exact time that your fresh new rate limit kicks in.
228
-     * @return integer|null
225
+     * @return string
229 226
      */
230 227
     public function getRateLimitReset()
231 228
     {
Please login to merge, or discard this patch.
tests/OptimizelyPHPTest/OptimizelyApiClientTest.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -163,8 +163,7 @@
 block discarded – undo
163 163
         // refresh token, since the provided access token is invalid.
164 164
         try {
165 165
             $result = $client->sendApiRequest('/projects');        
166
-        }
167
-        catch (Exception $e) {
166
+        } catch (Exception $e) {
168 167
             $this->assertEquals(Exception::CODE_API_ERROR, $e->getCode());
169 168
             $this->assertEquals(400, $e->getHttpCode());            
170 169
         }
Please login to merge, or discard this patch.
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.