@@ -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,21 +47,21 @@ discard block |
||
47 | 47 | $experiments = $result->getPayload(); |
48 | 48 | |
49 | 49 | foreach ($experiments as $experiment) { |
50 | - echo "ID: " . $experiment->getId() . "\n"; |
|
51 | - echo "Name: " . $experiment->getName() . "\n"; |
|
52 | - echo "Description: " . $experiment->getDescription() . "\n"; |
|
53 | - echo "Status: " . $experiment->getStatus() . "\n"; |
|
54 | - echo "Created: " . $experiment->getCreated() . "\n"; |
|
50 | + echo "ID: ".$experiment->getId()."\n"; |
|
51 | + echo "Name: ".$experiment->getName()."\n"; |
|
52 | + echo "Description: ".$experiment->getDescription()."\n"; |
|
53 | + echo "Status: ".$experiment->getStatus()."\n"; |
|
54 | + echo "Created: ".$experiment->getCreated()."\n"; |
|
55 | 55 | |
56 | 56 | echo "\n"; |
57 | 57 | } |
58 | 58 | |
59 | 59 | // Determine if there are more projects. |
60 | - if ($result->getNextPage()==null) |
|
60 | + if ($result->getNextPage() == null) |
|
61 | 61 | break; |
62 | 62 | |
63 | 63 | // Increment page counter. |
64 | - $page ++; |
|
64 | + $page++; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | } catch (Exception $e) { |
@@ -75,6 +75,6 @@ discard block |
||
75 | 75 | |
76 | 76 | // Save access token for later use |
77 | 77 | $accessToken = $optimizelyClient->getAccessToken(); |
78 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
78 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
79 | 79 | |
80 | 80 | echo "Done!\n"; |
@@ -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"; |
@@ -128,7 +128,7 @@ |
||
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 | } |
@@ -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 |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | case 'start_time': $this->setStartTime($value); break; |
84 | 84 | case 'stats_config': $this->setStatsConfig(new StatsConfig($value)); break; |
85 | 85 | default: |
86 | - throw new Exception('Unknown option found in the ExperimentResults entity: ' . $name); |
|
86 | + throw new Exception('Unknown option found in the ExperimentResults entity: '.$name); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'end_time' => $this->getEndTime(), |
99 | 99 | 'experiment_id' => $this->getExperimentId(), |
100 | 100 | 'metrics' => array(), |
101 | - 'reach' => $this->getReach()?$this->getReach()->toArray():null, |
|
101 | + 'reach' => $this->getReach() ? $this->getReach()->toArray() : null, |
|
102 | 102 | 'start_time' => $this->getStartTime(), |
103 | 103 | 'stats_config' => $this->getStatsConfig()->toArray(), |
104 | 104 | ); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | // Remove options with empty values |
111 | 111 | $cleanedOptions = array(); |
112 | 112 | foreach ($options as $name=>$value) { |
113 | - if ($value!==null) |
|
113 | + if ($value !== null) |
|
114 | 114 | $cleanedOptions[$name] = $value; |
115 | 115 | } |
116 | 116 |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | case 'samples': $this->setSamples($value); break; |
110 | 110 | case 'variance': $this->setVariance($value); break; |
111 | 111 | default: |
112 | - throw new Exception('Unknown option found in the VariantResults entity: ' . $name); |
|
112 | + throw new Exception('Unknown option found in the VariantResults entity: '.$name); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | } |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | 'experiment_id' => $this->getExperimentId(), |
124 | 124 | 'is_baseline' => $this->getIsBaseline(), |
125 | 125 | 'level' => $this->getLevel(), |
126 | - 'lift' => $this->getLift()?$this->getLift()->toArray():null, |
|
126 | + 'lift' => $this->getLift() ? $this->getLift()->toArray() : null, |
|
127 | 127 | 'name' => $this->getName(), |
128 | 128 | 'rate' => $this->getRate(), |
129 | 129 | 'scope' => $this->getScope(), |
130 | - 'total_increase' => $this->getTotalIncrease()?$this->getTotalIncrease()->toArray():null, |
|
130 | + 'total_increase' => $this->getTotalIncrease() ? $this->getTotalIncrease()->toArray() : null, |
|
131 | 131 | 'value' => $this->getValue(), |
132 | 132 | 'variation_id' => $this->getVariationId(), |
133 | 133 | 'samples' => $this->getSamples(), |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | // Remove options with empty values |
138 | 138 | $cleanedOptions = array(); |
139 | 139 | foreach ($options as $name=>$value) { |
140 | - if ($value!==null) |
|
140 | + if ($value !== null) |
|
141 | 141 | $cleanedOptions[$name] = $value; |
142 | 142 | } |
143 | 143 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | case 'visitors_remaining': $this->setVisitorsRemaining($value); break; |
77 | 77 | case 'lift_status': $this->setLiftStatus($value); break; |
78 | 78 | default: |
79 | - throw new Exception('Unknown option found in the Datapoint entity: ' . $name); |
|
79 | + throw new Exception('Unknown option found in the Datapoint entity: '.$name); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // Remove options with empty values |
100 | 100 | $cleanedOptions = array(); |
101 | 101 | foreach ($options as $name=>$value) { |
102 | - if ($value!==null) |
|
102 | + if ($value !== null) |
|
103 | 103 | $cleanedOptions[$name] = $value; |
104 | 104 | } |
105 | 105 |