@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | use WebMarketingROI\OptimizelyPHP\Resource\v2\Audience; |
| 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 | // Read project ID from command line. |
| 26 | -if ($argc!=2) { |
|
| 27 | - die('Expected 1 command-line argument, while got ' . $argc-1); |
|
| 26 | +if ($argc != 2) { |
|
| 27 | + die('Expected 1 command-line argument, while got '.$argc - 1); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | $projectId = $argv[1]; |
@@ -59,6 +59,6 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | // Save access token for later use |
| 61 | 61 | $accessToken = $optimizelyClient->getAccessToken(); |
| 62 | -file_put_contents(dirname(__FILE__) . '/../access_token.json', json_encode($accessToken)); |
|
| 62 | +file_put_contents(dirname(__FILE__).'/../access_token.json', json_encode($accessToken)); |
|
| 63 | 63 | |
| 64 | 64 | 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 | $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"; |
@@ -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 | |
@@ -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; |