@@ -16,14 +16,14 @@ discard block |
||
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,17 +47,17 @@ discard block |
||
47 | 47 | $audiences = $result->getPayload(); |
48 | 48 | |
49 | 49 | foreach ($audiences as $audience) { |
50 | - echo "Name: " . $audience->getName() . "\n"; |
|
51 | - echo "Conditions: " . $audience->getConditions() . "\n"; |
|
50 | + echo "Name: ".$audience->getName()."\n"; |
|
51 | + echo "Conditions: ".$audience->getConditions()."\n"; |
|
52 | 52 | echo "\n"; |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Determine if there are more audiences. |
56 | - if ($result->getNextPage()==null) |
|
56 | + if ($result->getNextPage() == null) |
|
57 | 57 | break; |
58 | 58 | |
59 | 59 | // Increment page counter. |
60 | - $page ++; |
|
60 | + $page++; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | } catch (Exception $e) { |
@@ -71,6 +71,6 @@ discard block |
||
71 | 71 | |
72 | 72 | // Save access token for later use |
73 | 73 | $accessToken = $optimizelyClient->getAccessToken(); |
74 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
74 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
75 | 75 | |
76 | 76 | echo "Done!\n"; |
@@ -53,8 +53,9 @@ |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | // Determine if there are more audiences. |
56 | - if ($result->getNextPage()==null) |
|
57 | - break; |
|
56 | + if ($result->getNextPage()==null) { |
|
57 | + break; |
|
58 | + } |
|
58 | 59 | |
59 | 60 | // Increment page counter. |
60 | 61 | $page ++; |
@@ -16,14 +16,14 @@ discard block |
||
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 | $experimentId = $argv[1]; |
29 | 29 | |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | |
45 | 45 | $experimentResults = $result->getPayload(); |
46 | 46 | |
47 | - echo "Confidence threshold: " . $experimentResults->getConfidenceThreshold(). "\n"; |
|
48 | - echo "Start time: " . $experimentResults->getStartTime(). "\n"; |
|
49 | - echo "End time: " . $experimentResults->getEndTime(). "\n"; |
|
47 | + echo "Confidence threshold: ".$experimentResults->getConfidenceThreshold()."\n"; |
|
48 | + echo "Start time: ".$experimentResults->getStartTime()."\n"; |
|
49 | + echo "End time: ".$experimentResults->getEndTime()."\n"; |
|
50 | 50 | echo "Metrics:\n"; |
51 | 51 | |
52 | 52 | foreach ($experimentResults->getMetrics() as $metric) { |
53 | - echo " - Metric Name: " . $metric->getName() . "\n"; |
|
53 | + echo " - Metric Name: ".$metric->getName()."\n"; |
|
54 | 54 | foreach ($metric->getResults() as $metricResult) { |
55 | - echo " - Variation Name: " . $metricResult->getName() . "\n"; |
|
56 | - echo " Is baseline: " . ($metricResult->getIsBaseline()?'true':'false') . "\n"; |
|
55 | + echo " - Variation Name: ".$metricResult->getName()."\n"; |
|
56 | + echo " Is baseline: ".($metricResult->getIsBaseline() ? 'true' : 'false')."\n"; |
|
57 | 57 | if ($metricResult->getLift()) { |
58 | - echo " Is significant: " . ($metricResult->getLift()->getIsSignificant()?'true':'false') . "\n"; |
|
58 | + echo " Is significant: ".($metricResult->getLift()->getIsSignificant() ? 'true' : 'false')."\n"; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
@@ -73,6 +73,6 @@ discard block |
||
73 | 73 | |
74 | 74 | // Save access token for later use |
75 | 75 | $accessToken = $optimizelyClient->getAccessToken(); |
76 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
76 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
77 | 77 | |
78 | 78 | echo "Done!\n"; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | case 'difference_type': $this->setDifferenceType($value); break; |
43 | 43 | case 'epoch_enabled': $this->setEpochEnabled($value); break; |
44 | 44 | default: |
45 | - throw new Exception('Unknown option found in the StatsConfig entity: ' . $name); |
|
45 | + throw new Exception('Unknown option found in the StatsConfig entity: '.$name); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | // Remove options with empty values |
62 | 62 | $cleanedOptions = array(); |
63 | 63 | foreach ($options as $name=>$value) { |
64 | - if ($value!==null) |
|
64 | + if ($value !== null) |
|
65 | 65 | $cleanedOptions[$name] = $value; |
66 | 66 | } |
67 | 67 |
@@ -91,8 +91,9 @@ |
||
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; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | "end_time" => "2016-10-14T05:08:43.031Z", |
14 | 14 | "experiment_id" => 3000, |
15 | 15 | "metrics" => array( |
16 | - array( |
|
16 | + array( |
|
17 | 17 | "event_id" => "string", |
18 | 18 | "event_name" => "string", |
19 | 19 | "measure" => "conversions", |
@@ -21,54 +21,54 @@ discard block |
||
21 | 21 | "priority" => 1, |
22 | 22 | "unit" => "session", |
23 | 23 | "results" => array( |
24 | - "9000" => array( |
|
24 | + "9000" => array( |
|
25 | 25 | "experiment_id" => 0, |
26 | 26 | "is_baseline" => true, |
27 | 27 | "lift" => array( |
28 | - "confidence_interval" => array( |
|
28 | + "confidence_interval" => array( |
|
29 | 29 | 0.010399560300730457, |
30 | 30 | 0.0850821459929161 |
31 | - ), |
|
32 | - "is_most_conclusive" => true, |
|
33 | - "is_significant" => true, |
|
34 | - "significance" => 0, |
|
35 | - "value" => 0, |
|
36 | - "visitors_remaining" => 0 |
|
31 | + ), |
|
32 | + "is_most_conclusive" => true, |
|
33 | + "is_significant" => true, |
|
34 | + "significance" => 0, |
|
35 | + "value" => 0, |
|
36 | + "visitors_remaining" => 0 |
|
37 | 37 | ), |
38 | 38 | "name" => "Blue Button", |
39 | 39 | "rate" => 0, |
40 | 40 | "scope" => "variation", |
41 | 41 | "total_increase" => array( |
42 | - "confidence_interval" => array( |
|
42 | + "confidence_interval" => array( |
|
43 | 43 | 0.010399560300730457, |
44 | 44 | 0.0850821459929161 |
45 | - ), |
|
46 | - "is_most_conclusive" => true, |
|
47 | - "is_significant" => true, |
|
48 | - "significance" => 0, |
|
49 | - "value" => 0, |
|
50 | - "visitors_remaining" => 0 |
|
45 | + ), |
|
46 | + "is_most_conclusive" => true, |
|
47 | + "is_significant" => true, |
|
48 | + "significance" => 0, |
|
49 | + "value" => 0, |
|
50 | + "visitors_remaining" => 0 |
|
51 | 51 | ), |
52 | 52 | "value" => 0, |
53 | 53 | "variation_id" => "string" |
54 | - ) |
|
54 | + ) |
|
55 | + ) |
|
55 | 56 | ) |
56 | - ) |
|
57 | 57 | ), |
58 | 58 | "reach" => array( |
59 | - "baseline_count" => 0, |
|
60 | - "baseline_reach" => 0, |
|
61 | - "total_count" => 0, |
|
62 | - "treatment_count" => 0, |
|
63 | - "treatment_reach" => 0, |
|
64 | - "variations" => array( |
|
59 | + "baseline_count" => 0, |
|
60 | + "baseline_reach" => 0, |
|
61 | + "total_count" => 0, |
|
62 | + "treatment_count" => 0, |
|
63 | + "treatment_reach" => 0, |
|
64 | + "variations" => array( |
|
65 | 65 | "9000" => array( |
66 | - "count" => 0, |
|
67 | - "name" => "Blue Button", |
|
68 | - "variation_id" => "string", |
|
69 | - "variation_reach" => 0 |
|
66 | + "count" => 0, |
|
67 | + "name" => "Blue Button", |
|
68 | + "variation_id" => "string", |
|
69 | + "variation_reach" => 0 |
|
70 | + ) |
|
70 | 71 | ) |
71 | - ) |
|
72 | 72 | ), |
73 | 73 | "start_time" => "2016-10-14T05:08:43.032Z" |
74 | 74 | ); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | "end_time" => "2016-10-14T05:08:43.031Z", |
87 | 87 | "experiment_id" => 3000, |
88 | 88 | "metrics" => array( |
89 | - array( |
|
89 | + array( |
|
90 | 90 | "event_id" => "string", |
91 | 91 | "event_name" => "string", |
92 | 92 | "measure" => "conversions", |
@@ -94,54 +94,54 @@ discard block |
||
94 | 94 | "priority" => 1, |
95 | 95 | "unit" => "session", |
96 | 96 | "results" => array( |
97 | - "9000" => array( |
|
97 | + "9000" => array( |
|
98 | 98 | "experiment_id" => 0, |
99 | 99 | "is_baseline" => true, |
100 | 100 | "lift" => array( |
101 | - "confidence_interval" => array( |
|
101 | + "confidence_interval" => array( |
|
102 | 102 | 0.010399560300730457, |
103 | 103 | 0.0850821459929161 |
104 | - ), |
|
105 | - "is_most_conclusive" => true, |
|
106 | - "is_significant" => true, |
|
107 | - "significance" => 0, |
|
108 | - "value" => 0, |
|
109 | - "visitors_remaining" => 0 |
|
104 | + ), |
|
105 | + "is_most_conclusive" => true, |
|
106 | + "is_significant" => true, |
|
107 | + "significance" => 0, |
|
108 | + "value" => 0, |
|
109 | + "visitors_remaining" => 0 |
|
110 | 110 | ), |
111 | 111 | "name" => "Blue Button", |
112 | 112 | "rate" => 0, |
113 | 113 | "scope" => "variation", |
114 | 114 | "total_increase" => array( |
115 | - "confidence_interval" => array( |
|
115 | + "confidence_interval" => array( |
|
116 | 116 | 0.010399560300730457, |
117 | 117 | 0.0850821459929161 |
118 | - ), |
|
119 | - "is_most_conclusive" => true, |
|
120 | - "is_significant" => true, |
|
121 | - "significance" => 0, |
|
122 | - "value" => 0, |
|
123 | - "visitors_remaining" => 0 |
|
118 | + ), |
|
119 | + "is_most_conclusive" => true, |
|
120 | + "is_significant" => true, |
|
121 | + "significance" => 0, |
|
122 | + "value" => 0, |
|
123 | + "visitors_remaining" => 0 |
|
124 | 124 | ), |
125 | 125 | "value" => 0, |
126 | 126 | "variation_id" => "string" |
127 | - ) |
|
127 | + ) |
|
128 | + ) |
|
128 | 129 | ) |
129 | - ) |
|
130 | 130 | ), |
131 | 131 | "reach" => array( |
132 | - "baseline_count" => 0, |
|
133 | - "baseline_reach" => 0, |
|
134 | - "total_count" => 0, |
|
135 | - "treatment_count" => 0, |
|
136 | - "treatment_reach" => 0, |
|
137 | - "variations" => array( |
|
132 | + "baseline_count" => 0, |
|
133 | + "baseline_reach" => 0, |
|
134 | + "total_count" => 0, |
|
135 | + "treatment_count" => 0, |
|
136 | + "treatment_reach" => 0, |
|
137 | + "variations" => array( |
|
138 | 138 | "9000" => array( |
139 | - "count" => 0, |
|
140 | - "name" => "Blue Button", |
|
141 | - "variation_id" => "string", |
|
142 | - "variation_reach" => 0 |
|
139 | + "count" => 0, |
|
140 | + "name" => "Blue Button", |
|
141 | + "variation_id" => "string", |
|
142 | + "variation_reach" => 0 |
|
143 | + ) |
|
143 | 144 | ) |
144 | - ) |
|
145 | 145 | ), |
146 | 146 | "start_time" => "2016-10-14T05:08:43.032Z" |
147 | 147 | ); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | case 'scope': $this->setScope($value); break; |
129 | 129 | case 'winning_direction': $this->setWinningDirection($value); break; |
130 | 130 | default: |
131 | - throw new Exception('Unknown option found in the ExperimentMetricResults entity: ' . $name); |
|
131 | + throw new Exception('Unknown option found in the ExperimentMetricResults entity: '.$name); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | // Remove options with empty values |
161 | 161 | $cleanedOptions = array(); |
162 | 162 | foreach ($options as $name=>$value) { |
163 | - if ($value!==null) |
|
163 | + if ($value !== null) |
|
164 | 164 | $cleanedOptions[$name] = $value; |
165 | 165 | } |
166 | 166 |
@@ -91,8 +91,9 @@ |
||
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; |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use OptimizelyPHPTest\Service\v2\BaseServiceTest; |
5 | 5 | use WebMarketingROI\OptimizelyPHP\OptimizelyApiClient; |
6 | -use WebMarketingROI\OptimizelyPHP\Exception; |
|
7 | 6 | use WebMarketingROI\OptimizelyPHP\Result; |
8 | 7 | use WebMarketingROI\OptimizelyPHP\Resource\v2\Plan as PlanResource; |
9 | 8 | use WebMarketingROI\OptimizelyPHP\Service\v2\Plan; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $plan = $result->getPayload(); |
47 | 47 | |
48 | 48 | $this->assertTrue($plan instanceof PlanResource); |
49 | - $this->assertTrue($plan->getPlanName()=='premium'); |
|
49 | + $this->assertTrue($plan->getPlanName() == 'premium'); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function testIntegration() |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $credentials = $this->loadCredentialsFromFile(); |
58 | 58 | |
59 | 59 | $optimizelyClient = new OptimizelyApiClient($credentials, 'v2'); |
60 | - $this->assertTrue($optimizelyClient!=null); |
|
60 | + $this->assertTrue($optimizelyClient != null); |
|
61 | 61 | |
62 | 62 | // Retrieve plan |
63 | 63 | $result = $optimizelyClient->plan()->get(); |
@@ -465,8 +465,9 @@ |
||
465 | 465 | |
466 | 466 | public function testIntegration() |
467 | 467 | { |
468 | - if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) |
|
469 | - $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set'); |
|
468 | + if (!getenv('OPTIMIZELY_PHP_TEST_INTEGRATION')) { |
|
469 | + $this->markTestSkipped('OPTIMIZELY_PHP_TEST_INTEGRATION env var is not set'); |
|
470 | + } |
|
470 | 471 | |
471 | 472 | $credentials = $this->loadCredentialsFromFile(); |
472 | 473 |
@@ -16,10 +16,10 @@ discard block |
||
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 | // Get OAuth 2.0 credentials from auth_credentials.json and access_token.json files. |
25 | 25 | $credentials = load_credentials_from_file(); |
@@ -38,10 +38,10 @@ discard block |
||
38 | 38 | |
39 | 39 | $plan = $result->getPayload(); |
40 | 40 | |
41 | - echo "Account ID: " . $plan->getAccountId() . "\n"; |
|
42 | - echo "Plan Name: " . $plan->getPlanName() . "\n"; |
|
43 | - echo "Status: " . $plan->getStatus() . "\n"; |
|
44 | - echo "Unit Of Measurement: " . $plan->getUnitOfMeasurement() . "\n"; |
|
41 | + echo "Account ID: ".$plan->getAccountId()."\n"; |
|
42 | + echo "Plan Name: ".$plan->getPlanName()."\n"; |
|
43 | + echo "Status: ".$plan->getStatus()."\n"; |
|
44 | + echo "Unit Of Measurement: ".$plan->getUnitOfMeasurement()."\n"; |
|
45 | 45 | |
46 | 46 | } catch (Exception $e) { |
47 | 47 | // Handle error. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | // Save access token for later use |
56 | 56 | $accessToken = $optimizelyClient->getAccessToken(); |
57 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
57 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
58 | 58 | |
59 | 59 | echo "Done!\n"; |
60 | 60 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | case 'status': $this->setStatus($value); break; |
63 | 63 | case 'unit_of_measurement': $this->setUnitOfMeasurement($value); break; |
64 | 64 | default: |
65 | - throw new Exception('Unknown option found in the Plan entity: ' . $name); |
|
65 | + throw new Exception('Unknown option found in the Plan entity: '.$name); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | // Remove options with empty values |
88 | 88 | $cleanedOptions = array(); |
89 | 89 | foreach ($options as $name=>$value) { |
90 | - if ($value!==null) |
|
90 | + if ($value !== null) |
|
91 | 91 | $cleanedOptions[$name] = $value; |
92 | 92 | } |
93 | 93 |
@@ -91,8 +91,9 @@ |
||
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; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | case 'usage': $this->setUsage($value); break; |
93 | 93 | case 'usage_allowance': $this->setUsageAllowance($value); break; |
94 | 94 | default: |
95 | - throw new Exception('Unknown option found in the ProductUsage entity: ' . $name); |
|
95 | + throw new Exception('Unknown option found in the ProductUsage entity: '.$name); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | // Remove options with empty values |
118 | 118 | $cleanedOptions = array(); |
119 | 119 | foreach ($options as $name=>$value) { |
120 | - if ($value!==null) |
|
120 | + if ($value !== null) |
|
121 | 121 | $cleanedOptions[$name] = $value; |
122 | 122 | } |
123 | 123 |
@@ -91,8 +91,9 @@ |
||
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; |