@@ -17,10 +17,10 @@ discard block |
||
| 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 |
||
| 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 |
@@ -14,7 +14,6 @@ |
||
| 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'; |
@@ -33,73 +33,73 @@ |
||
| 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 | |
@@ -38,14 +38,14 @@ |
||
| 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 | } |
@@ -36,13 +36,13 @@ |
||
| 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 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | case 'unit': $this->setUnit($value); break; |
| 90 | 90 | default: |
| 91 | - throw new Exception('Unknown option: ' . $name); |
|
| 91 | + throw new Exception('Unknown option: '.$name); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | // Remove options with empty values |
| 116 | 116 | $cleanedOptions = array(); |
| 117 | 117 | foreach ($options as $name=>$value) { |
| 118 | - if ($value!==null) |
|
| 118 | + if ($value !== null) |
|
| 119 | 119 | $cleanedOptions[$name] = $value; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -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; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | case 'code_revision': $this->setCodeRevision($value); break; |
| 99 | 99 | case 'js_file_size': $this->setJsFileSize($value); break; |
| 100 | 100 | default: |
| 101 | - throw new Exception('Unknown option: ' . $name); |
|
| 101 | + throw new Exception('Unknown option: '.$name); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | // Remove options with empty values |
| 125 | 125 | $cleanedOptions = array(); |
| 126 | 126 | foreach ($options as $name=>$value) { |
| 127 | - if ($value!==null) |
|
| 127 | + if ($value !== null) |
|
| 128 | 128 | $cleanedOptions[$name] = $value; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -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; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | case 'stop_time': $this->setStopTime($value); break; |
| 43 | 43 | case 'time_zone': $this->setTimezone($value); break; |
| 44 | 44 | default: |
| 45 | - throw new Exception('Unknown option: ' . $name); |
|
| 45 | + throw new Exception('Unknown option: '.$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; |
@@ -74,7 +74,7 @@ |
||
| 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 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | case 'value': $this->setValue($value); break; |
| 69 | 69 | case 'visitors_remaining': $this->setVisitorsRemaining($value); break; |
| 70 | 70 | default: |
| 71 | - throw new Exception('Unknown option: ' . $name); |
|
| 71 | + throw new Exception('Unknown option: '.$name); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | // Remove options with empty values |
| 91 | 91 | $cleanedOptions = array(); |
| 92 | 92 | foreach ($options as $name=>$value) { |
| 93 | - if ($value!==null) |
|
| 93 | + if ($value !== null) |
|
| 94 | 94 | $cleanedOptions[$name] = $value; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -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; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | case 'reach': $this->setReach(new ExperimentVariationReach($value)); break; |
| 76 | 76 | case 'start_time': $this->setStartTime($value); break; |
| 77 | 77 | default: |
| 78 | - throw new Exception('Unknown option: ' . $name); |
|
| 78 | + throw new Exception('Unknown option: '.$name); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | 'end_time' => $this->getEndTime(), |
| 91 | 91 | 'experiment_id' => $this->getExperimentId(), |
| 92 | 92 | 'metrics' => array(), |
| 93 | - 'reach' => $this->getReach()?$this->getReach()->toArray():null, |
|
| 93 | + 'reach' => $this->getReach() ? $this->getReach()->toArray() : null, |
|
| 94 | 94 | 'start_time' => $this->getStartTime() |
| 95 | 95 | ); |
| 96 | 96 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | // Remove options with empty values |
| 102 | 102 | $cleanedOptions = array(); |
| 103 | 103 | foreach ($options as $name=>$value) { |
| 104 | - if ($value!==null) |
|
| 104 | + if ($value !== null) |
|
| 105 | 105 | $cleanedOptions[$name] = $value; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -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; |