@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @param array $columns |
| 125 | 125 | * @param string $name |
| 126 | 126 | * @param $timePeriod |
| 127 | - * @param null $fileLocation |
|
| 127 | + * @param string $fileLocation |
|
| 128 | 128 | * |
| 129 | 129 | * @return array|string |
| 130 | 130 | */ |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | /** |
| 180 | 180 | * @param $reportRequest |
| 181 | - * @param $name |
|
| 181 | + * @param string $name |
|
| 182 | 182 | * @param $downloadFile |
| 183 | 183 | * |
| 184 | 184 | * @throws \Exception |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | * of minutes. You should stop polling and try again later if the request |
| 295 | 295 | * is taking longer than an hour. |
| 296 | 296 | * |
| 297 | - * @param $reportRequestId |
|
| 297 | + * @param string $reportRequestId |
|
| 298 | 298 | * |
| 299 | 299 | * @return string ReportRequestStatus |
| 300 | 300 | */ |
@@ -111,7 +111,7 @@ |
||
| 111 | 111 | public function setConfig($config) |
| 112 | 112 | { |
| 113 | 113 | $this->config = $config; |
| 114 | - $this->config['cache_dir'] = $this->config['cache_dir'] . '/' . 'BingAdsApiBundle'; //<-- important for the cache clear function |
|
| 114 | + $this->config['cache_dir'] = $this->config['cache_dir'].'/'.'BingAdsApiBundle'; //<-- important for the cache clear function |
|
| 115 | 115 | $this->config['csv']['fixHeader']['removeColumnHeader'] = true; //-- fix till i know how to do this |
| 116 | 116 | } |
| 117 | 117 | |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | class Csv |
| 7 | 7 | { |
| 8 | 8 | /** |
| 9 | - * @param array $lines |
|
| 9 | + * @param string[] $lines |
|
| 10 | 10 | * @param bool $includingColumnHeaders |
| 11 | 11 | * @param int $fileHeaders |
| 12 | 12 | * @param int $columnHeaders |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * @param array $lines |
|
| 31 | + * @param string[] $lines |
|
| 32 | 32 | * @param int $noOfLinesToRemove |
| 33 | 33 | * |
| 34 | 34 | * @return array |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * @param array $lines |
|
| 51 | + * @param string[] $lines |
|
| 52 | 52 | * @param string $separator |
| 53 | 53 | * @param string $enclosure |
| 54 | 54 | * |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | /** |
| 78 | 78 | * @param array $array |
| 79 | 79 | * @param string $separator |
| 80 | - * @param null $enclosure |
|
| 80 | + * @param string $enclosure |
|
| 81 | 81 | * |
| 82 | 82 | * @return string |
| 83 | 83 | */ |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | |
| 88 | 88 | for ($i = 0; $i < count($array); ++$i) { |
| 89 | 89 | if ($enclosure) { |
| 90 | - $csvStr .= $enclosure . str_replace($enclosure, $enclosure . $enclosure, $array[$i]) . $enclosure; |
|
| 90 | + $csvStr .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $array[$i]).$enclosure; |
|
| 91 | 91 | } else { |
| 92 | 92 | $csvStr .= $array[$i]; |
| 93 | 93 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * @param string $file zipFile we want to open |
| 78 | - * @param null $extractTo |
|
| 78 | + * @param boolean $extractTo |
|
| 79 | 79 | * @param bool $delete |
| 80 | 80 | * |
| 81 | 81 | * @throws Exception |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | * @param array|null $columns |
| 65 | 65 | * @param string|null $timePeriod (See BingAds SDK documentation) |
| 66 | 66 | * |
| 67 | - * @return mixed |
|
| 67 | + * @return ReportRequest |
|
| 68 | 68 | */ |
| 69 | 69 | public function getRequest(array $columns = null, $timePeriod = null) |
| 70 | 70 | { |
@@ -61,6 +61,7 @@ |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | + * @param integer $code |
|
| 64 | 65 | * @return Mockery\MockInterface |
| 65 | 66 | */ |
| 66 | 67 | private function runClientSoapException($code) |
@@ -276,6 +276,9 @@ |
||
| 276 | 276 | return $apiClient; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | + /** |
|
| 280 | + * @param integer $code |
|
| 281 | + */ |
|
| 279 | 282 | private function generateSoapFault($code) |
| 280 | 283 | { |
| 281 | 284 | $message = "an error message {$code}"; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $this->getTimeHelperMock() |
| 69 | 69 | ); |
| 70 | 70 | $result = $apiClient->get(['TimePeriod', 'AccountName', 'AdGroupId'], 'GeoLocationPerformanceReport', ReportTimePeriod::LastWeek); |
| 71 | - $this->assertEquals([ASSETS_DIR . 'report.csv'], $result); |
|
| 71 | + $this->assertEquals([ASSETS_DIR.'report.csv'], $result); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function testGeoLocationPerformanceReportMoveFile() |
@@ -81,12 +81,12 @@ discard block |
||
| 81 | 81 | $this->getCsvHelperMock(), |
| 82 | 82 | $this->getTimeHelperMock() |
| 83 | 83 | ); |
| 84 | - $result = $apiClient->get(['TimePeriod', 'AccountName', 'AdGroupId'], 'GeoLocationPerformanceReport', ReportTimePeriod::LastWeek, ASSETS_DIR . 'test.csv'); |
|
| 85 | - $this->assertEquals(ASSETS_DIR . 'test.csv', $result); |
|
| 84 | + $result = $apiClient->get(['TimePeriod', 'AccountName', 'AdGroupId'], 'GeoLocationPerformanceReport', ReportTimePeriod::LastWeek, ASSETS_DIR.'test.csv'); |
|
| 85 | + $this->assertEquals(ASSETS_DIR.'test.csv', $result); |
|
| 86 | 86 | |
| 87 | 87 | //--Move File back |
| 88 | 88 | $fileSystem = new Filesystem(); |
| 89 | - $fileSystem->rename(ASSETS_DIR . 'test.csv', ASSETS_DIR . 'report.csv'); |
|
| 89 | + $fileSystem->rename(ASSETS_DIR.'test.csv', ASSETS_DIR.'report.csv'); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | public function testGetRefreshToken() |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | ->once() |
| 225 | 225 | ->shouldReceive('unZip') |
| 226 | 226 | ->with('/tmp/report.zip') |
| 227 | - ->andReturn([ASSETS_DIR . 'report.csv']) |
|
| 227 | + ->andReturn([ASSETS_DIR.'report.csv']) |
|
| 228 | 228 | ->once(); |
| 229 | 229 | |
| 230 | 230 | return $zipHelperMock; |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | private function getCsvHelperMock() |
| 237 | 237 | { |
| 238 | - $lines = file(ASSETS_DIR . 'report.csv'); |
|
| 238 | + $lines = file(ASSETS_DIR.'report.csv'); |
|
| 239 | 239 | $csvHelperMock = Mockery::mock(Helper\Csv::class); |
| 240 | 240 | $csvHelperMock |
| 241 | 241 | ->shouldReceive('removeHeaders') |
@@ -25,10 +25,10 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | public function testGetFile() |
| 27 | 27 | { |
| 28 | - $nonExistingFile = ASSETS_DIR . 'iDoNotExist.txt'; |
|
| 29 | - $existingFile = ASSETS_DIR . 'report.csv'; |
|
| 28 | + $nonExistingFile = ASSETS_DIR.'iDoNotExist.txt'; |
|
| 29 | + $existingFile = ASSETS_DIR.'report.csv'; |
|
| 30 | 30 | $onlineFile = 'http://google.com/test.txt'; |
| 31 | - $file = ASSETS_DIR . 'example.txt'; |
|
| 31 | + $file = ASSETS_DIR.'example.txt'; |
|
| 32 | 32 | |
| 33 | 33 | $mock = new MockHandler([new Response(200, [])]); |
| 34 | 34 | $handler = HandlerStack::create($mock); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function testDownload() |
| 55 | 55 | { |
| 56 | 56 | $url = 'http://example.com'; |
| 57 | - $file = ASSETS_DIR . 'example.txt'; |
|
| 57 | + $file = ASSETS_DIR.'example.txt'; |
|
| 58 | 58 | |
| 59 | 59 | $clientMock = Mockery::mock(Client::class); |
| 60 | 60 | $clientMock |
@@ -82,14 +82,14 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | public function testUnZip() |
| 84 | 84 | { |
| 85 | - $file = ASSETS_DIR . 'test.zip'; |
|
| 85 | + $file = ASSETS_DIR.'test.zip'; |
|
| 86 | 86 | |
| 87 | - $this->fileSystem->copy(ASSETS_DIR . 'report.zip', $file); |
|
| 87 | + $this->fileSystem->copy(ASSETS_DIR.'report.zip', $file); |
|
| 88 | 88 | |
| 89 | 89 | $fileHelper = new File(); |
| 90 | 90 | $files = $fileHelper->unZip($file); |
| 91 | 91 | |
| 92 | - $this->assertEquals($files, [ASSETS_DIR . '0039202.csv']); |
|
| 92 | + $this->assertEquals($files, [ASSETS_DIR.'0039202.csv']); |
|
| 93 | 93 | |
| 94 | 94 | //-- Remove the files created by this test |
| 95 | 95 | foreach ($files as $file) { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function testCorruptUnZip() |
| 104 | 104 | { |
| 105 | - $file = ASSETS_DIR . 'corrupt.zip'; |
|
| 105 | + $file = ASSETS_DIR.'corrupt.zip'; |
|
| 106 | 106 | $fileHelper = new File(); |
| 107 | 107 | $fileHelper->unZip($file, false); |
| 108 | 108 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $configuration = new Configuration(); |
| 22 | 22 | $config = $this->processConfiguration($configuration, $configs); |
| 23 | 23 | |
| 24 | - $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
|
| 24 | + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
| 25 | 25 | $loader->load('services.yml'); |
| 26 | 26 | |
| 27 | 27 | // Once the services definition are read, get your service and add a method call to setConfig() |