Completed
Push — master ( 61d59f...d8826f )
by Oleg
02:29
created
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/ExperimentMetricResults.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
                 case 'unit': $this->setUnit($value); break;
75 75
                 case 'variation_results': $this->setVariationResults($value); break;
76 76
                 default:
77
-                    throw new Exception('Unknown option: ' . $name);
77
+                    throw new Exception('Unknown option: '.$name);
78 78
             }
79 79
         }
80 80
     }
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.
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.
lib/WebMarketingROI/OptimizelyPHP/Service/v2/Experiments.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,17 +39,17 @@  discard block
 block discarded – undo
39 39
      * @return Result
40 40
      * @throws Exception
41 41
      */
42
-    public function listAll($projectId, $campaignId=null, $includeClassic=false, $page=1, $perPage=25)
42
+    public function listAll($projectId, $campaignId = null, $includeClassic = false, $page = 1, $perPage = 25)
43 43
     {
44
-        if ($projectId==null && $campaignId==null) {
44
+        if ($projectId == null && $campaignId == null) {
45 45
             throw new Exception('Project ID or Campaign ID must be non-null');
46 46
         }
47 47
         
48
-        if ($page<0) {
48
+        if ($page < 0) {
49 49
             throw new Exception('Invalid page number passed');
50 50
         }
51 51
         
52
-        if ($perPage<0 || $perPage>100) {
52
+        if ($perPage < 0 || $perPage > 100) {
53 53
             throw new Exception('Invalid page size passed');
54 54
         }
55 55
         
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
                     Exception::CODE_INVALID_ARG);
86 86
         }
87 87
         
88
-        if ($experimentId<0) {
88
+        if ($experimentId < 0) {
89 89
             throw new Exception("A positive experiment ID expected");
90 90
         }
91 91
         
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             throw new Exception("Expected argument of type Experiment");
176 176
         }
177 177
         
178
-        if ($experimentId<0) {
178
+        if ($experimentId < 0) {
179 179
             throw new Exception("Expected positive experiment ID argument");
180 180
         }
181 181
         
Please login to merge, or discard this patch.