@@ -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 |
@@ -36,21 +36,21 @@ discard block |
||
| 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 | 41 | if (!is_int($projectId)) { |
| 42 | 42 | throw new Exception("Integer project ID expected, while got '$projectId'"); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if ($projectId<0) { |
|
| 45 | + if ($projectId < 0) { |
|
| 46 | 46 | throw new Exception("Expected positive integer project ID"); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if ($page<0) { |
|
| 49 | + if ($page < 0) { |
|
| 50 | 50 | throw new Exception('Invalid page number passed'); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if ($perPage<0) { |
|
| 53 | + if ($perPage < 0) { |
|
| 54 | 54 | throw new Exception('Invalid page size passed'); |
| 55 | 55 | } |
| 56 | 56 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | Exception::CODE_INVALID_ARG); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if ($campaignId<0) { |
|
| 109 | + if ($campaignId < 0) { |
|
| 110 | 110 | throw new Exception("Expected positive integer campaign ID", |
| 111 | 111 | Exception::CODE_INVALID_ARG); |
| 112 | 112 | } |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | * @return Result |
| 35 | 35 | * @throws Exception |
| 36 | 36 | */ |
| 37 | - public function listAll($page=1, $perPage=25) |
|
| 37 | + public function listAll($page = 1, $perPage = 25) |
|
| 38 | 38 | { |
| 39 | - if ($page<0) { |
|
| 39 | + if ($page < 0) { |
|
| 40 | 40 | throw new Exception('Invalid page number passed'); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if ($perPage<0 || $perPage>100) { |
|
| 43 | + if ($perPage < 0 || $perPage > 100) { |
|
| 44 | 44 | throw new Exception('Invalid page size passed'); |
| 45 | 45 | } |
| 46 | 46 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | throw new Exception("Integer project ID expected, while got '$projectId'"); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if ($projectId<0) { |
|
| 75 | + if ($projectId < 0) { |
|
| 76 | 76 | throw new Exception("A positive project ID expected"); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | throw new Exception("Integer project ID expected, while got '$projectId'"); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if ($projectId<0) { |
|
| 122 | + if ($projectId < 0) { |
|
| 123 | 123 | throw new Exception("A positive project ID expected"); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -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 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @return Result |
| 39 | 39 | * @throws Exception |
| 40 | 40 | */ |
| 41 | - public function listAll($projectId, $campaignId=null, $includeClassic=false, $page=1, $perPage=25) |
|
| 41 | + public function listAll($projectId, $campaignId = null, $includeClassic = false, $page = 1, $perPage = 25) |
|
| 42 | 42 | { |
| 43 | 43 | if (empty($projectId) && empty($campaignId)) { |
| 44 | 44 | throw new Exception('Project ID or Campaign ID must be non-empty', |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | throw new Exception("Expected argument of type Experiment"); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if ($experimentId<0) { |
|
| 166 | + if ($experimentId < 0) { |
|
| 167 | 167 | throw new Exception("Expected positive experiment ID argument"); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -35,14 +35,14 @@ |
||
| 35 | 35 | * @return Result |
| 36 | 36 | * @throws Exception |
| 37 | 37 | */ |
| 38 | - public function listAll($projectId, $page=1, $perPage=25) |
|
| 38 | + public function listAll($projectId, $page = 1, $perPage = 25) |
|
| 39 | 39 | { |
| 40 | - if ($page<0) { |
|
| 40 | + if ($page < 0) { |
|
| 41 | 41 | throw new Exception('Invalid page number passed', |
| 42 | 42 | Exception::CODE_INVALID_ARG); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if ($perPage<0) { |
|
| 45 | + if ($perPage < 0) { |
|
| 46 | 46 | throw new Exception('Invalid page size passed', |
| 47 | 47 | Exception::CODE_INVALID_ARG); |
| 48 | 48 | } |
@@ -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 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | case 'value': $this->setValue($value); break; |
| 104 | 104 | case 'id': $this->setId($value); break; |
| 105 | 105 | default: |
| 106 | - throw new Exception('Unknown option: ' . $name); |
|
| 106 | + throw new Exception('Unknown option: '.$name); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | // Remove options with empty values |
| 131 | 131 | $cleanedOptions = array(); |
| 132 | 132 | foreach ($options as $name=>$value) { |
| 133 | - if ($value!==null) |
|
| 133 | + if ($value !== null) |
|
| 134 | 134 | $cleanedOptions[$name] = $value; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | case 'kind': $this->setKind($value); break; |
| 36 | 36 | case 'id': $this->setId($value); break; |
| 37 | 37 | default: |
| 38 | - throw new Exception('Unknown option: ' . $name); |
|
| 38 | + throw new Exception('Unknown option: '.$name); |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | // Remove options with empty values |
| 54 | 54 | $cleanedOptions = array(); |
| 55 | 55 | foreach ($options as $name=>$value) { |
| 56 | - if ($value!==null) |
|
| 56 | + if ($value !== null) |
|
| 57 | 57 | $cleanedOptions[$name] = $value; |
| 58 | 58 | } |
| 59 | 59 | |