@@ -26,8 +26,8 @@ |
||
| 26 | 26 | $loader->load('services.yml'); |
| 27 | 27 | |
| 28 | 28 | // Once the services definition are read, get your service and add a method call to setConfig() |
| 29 | - $sillyServiceDefintion = $container->getDefinition( 'werkspot.bing_ads_api_client' ); |
|
| 30 | - $sillyServiceDefintion->addMethodCall( 'setConfig', [ $config ] ); |
|
| 29 | + $sillyServiceDefintion = $container->getDefinition('werkspot.bing_ads_api_client'); |
|
| 30 | + $sillyServiceDefintion->addMethodCall('setConfig', [$config]); |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | public function setConfig($config) |
| 78 | 78 | { |
| 79 | 79 | $this->config = $config; |
| 80 | - $this->config['cache_dir'] = $this->config['cache_dir'] . '/' . 'BingAdsApiBundle'; //<-- important for the cache clear function |
|
| 80 | + $this->config['cache_dir'] = $this->config['cache_dir'].'/'.'BingAdsApiBundle'; //<-- important for the cache clear function |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function setApiDetails($refreshToken, $clientId, $secret, $redirectUri, $devToken) |
@@ -249,16 +249,16 @@ discard block |
||
| 249 | 249 | if ($incrementTime) { |
| 250 | 250 | switch ($count) { |
| 251 | 251 | case 31: // after 5 minutes |
| 252 | - $sleep = (1*60); |
|
| 252 | + $sleep = (1 * 60); |
|
| 253 | 253 | break; |
| 254 | 254 | case 35: // after 10 minutes |
| 255 | - $sleep = (5*60); |
|
| 255 | + $sleep = (5 * 60); |
|
| 256 | 256 | break; |
| 257 | 257 | case 40: // after 30 minutes |
| 258 | - $sleep = (15*60); |
|
| 258 | + $sleep = (15 * 60); |
|
| 259 | 259 | break; |
| 260 | 260 | case 44: // after 1,5 hours |
| 261 | - $sleep = (30*60); |
|
| 261 | + $sleep = (30 * 60); |
|
| 262 | 262 | break; |
| 263 | 263 | } |
| 264 | 264 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | if ($reportRequestStatus->Status == "Error") { |
| 270 | - throw new Exceptions\ReportRequestErrorException("The request failed. Try requesting the report later.\nIf the request continues to fail, contact support.", $reportRequestStatus->Status, $reportRequestId ); |
|
| 270 | + throw new Exceptions\ReportRequestErrorException("The request failed. Try requesting the report later.\nIf the request continues to fail, contact support.", $reportRequestStatus->Status, $reportRequestId); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | return $reportRequestStatus; |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | $totalLines = count($lines); |
| 373 | 373 | $removeFrom = $totalLines - $noOfLinesToRemove; |
| 374 | 374 | |
| 375 | - for( $i = $removeFrom; $i < $totalLines; $i++ ) { |
|
| 375 | + for ($i = $removeFrom; $i < $totalLines; $i++) { |
|
| 376 | 376 | unset($lines[$i]); |
| 377 | 377 | } |
| 378 | 378 | return $lines; |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | private function fixDate(array $lines, $separator = ',', $enclosure = '"') |
| 389 | 389 | { |
| 390 | 390 | foreach ($lines as $key => $line) { |
| 391 | - $columns = str_getcsv($line, $separator ); |
|
| 391 | + $columns = str_getcsv($line, $separator); |
|
| 392 | 392 | $isChanged = false; |
| 393 | 393 | foreach ($columns as $columnKey => $column) |
| 394 | 394 | { |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | $isChanged = true; |
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | - if ($isChanged){ |
|
| 402 | + if ($isChanged) { |
|
| 403 | 403 | $lines[$key] = $this->arrayToCsvLine($columns, $separator, $enclosure); |
| 404 | 404 | } |
| 405 | 405 | } |
@@ -417,15 +417,15 @@ discard block |
||
| 417 | 417 | { |
| 418 | 418 | $csvStr = ""; |
| 419 | 419 | |
| 420 | - for( $i = 0; $i < count($array); $i++ ) { |
|
| 420 | + for ($i = 0; $i < count($array); $i++) { |
|
| 421 | 421 | |
| 422 | 422 | if ($enclosure) { |
| 423 | - $csvStr .= $enclosure . str_replace($enclosure, $enclosure.$enclosure, $array[$i]) . $enclosure; |
|
| 423 | + $csvStr .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $array[$i]).$enclosure; |
|
| 424 | 424 | } else { |
| 425 | 425 | $csvStr .= $array[$i]; |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | - $csvStr .= ($i < count($array) - 1) ? $separator : "\r\n" ; |
|
| 428 | + $csvStr .= ($i < count($array) - 1) ? $separator : "\r\n"; |
|
| 429 | 429 | } |
| 430 | 430 | return $csvStr; |
| 431 | 431 | } |
@@ -487,8 +487,8 @@ discard block |
||
| 487 | 487 | { |
| 488 | 488 | $error = $e->detail->AdApiFaultDetail->Errors->AdApiError; |
| 489 | 489 | } else if (isset($e->detail->ApiFaultDetail)) { |
| 490 | - if (!empty($e->detail->ApiFaultDetail->BatchErrors)){ |
|
| 491 | - $error = $error =$e->detail->ApiFaultDetail->Errors->AdApiError; |
|
| 490 | + if (!empty($e->detail->ApiFaultDetail->BatchErrors)) { |
|
| 491 | + $error = $error = $e->detail->ApiFaultDetail->Errors->AdApiError; |
|
| 492 | 492 | } elseif (!empty($e->detail->ApiFaultDetail->OperationErrors)) { |
| 493 | 493 | $error = $e->detail->ApiFaultDetail->OperationErrors->OperationError; |
| 494 | 494 | } |