diff --git a/src/Command/AbstractPhraseKeyCommand.php b/src/Command/AbstractPhraseKeyCommand.php
index 1fdf340..7f91823 100644
--- a/src/Command/AbstractPhraseKeyCommand.php
+++ b/src/Command/AbstractPhraseKeyCommand.php
@@ -77,7 +77,7 @@ private function list(OutputInterface $output, ?string $key, array $tags): int
try {
$result = $this->tagService->list($key, $tags);
} catch (ProviderException $e) {
- $output->writeln(sprintf('%s', $e->getMessage()));
+ $output->writeln(\sprintf('%s', $e->getMessage()));
return Command::FAILURE;
}
@@ -91,7 +91,7 @@ private function list(OutputInterface $output, ?string $key, array $tags): int
$output->writeln('your query would match the following keys (sample):');
foreach ($result as $item) {
- $output->writeln(sprintf('> %s', $item));
+ $output->writeln(\sprintf('> %s', $item));
}
return Command::SUCCESS;
diff --git a/src/Command/PhraseKeyTagCommand.php b/src/Command/PhraseKeyTagCommand.php
index 43cd83a..76f611c 100644
--- a/src/Command/PhraseKeyTagCommand.php
+++ b/src/Command/PhraseKeyTagCommand.php
@@ -46,12 +46,12 @@ protected function executeCommand(InputInterface $input, OutputInterface $output
try {
$keys = $this->tagService->tag($queryKey, $queryTag, $tag);
} catch (ProviderException $e) {
- $output->writeln(sprintf('%s', $e->getMessage()));
+ $output->writeln(\sprintf('%s', $e->getMessage()));
return Command::FAILURE;
}
- $output->writeln(sprintf('successfully tagged %d keys with "%s"', $keys, implode(', ', $tag)));
+ $output->writeln(sprintf('successfully tagged %d keys with "%s"', $keys, \implode(', ', $tag)));
return Command::SUCCESS;
}
diff --git a/src/Command/PhraseKeyUntagCommand.php b/src/Command/PhraseKeyUntagCommand.php
index 0505087..4a98b1e 100644
--- a/src/Command/PhraseKeyUntagCommand.php
+++ b/src/Command/PhraseKeyUntagCommand.php
@@ -51,7 +51,7 @@ protected function executeCommand(InputInterface $input, OutputInterface $output
return Command::FAILURE;
}
- $output->writeln(sprintf('successfully untagged %d keys with "%s"', $keys, implode(', ', $tag)));
+ $output->writeln(\sprintf('successfully untagged %d keys with "%s"', $keys, \implode(', ', $tag)));
return Command::SUCCESS;
}
diff --git a/src/Service/PhraseTagService.php b/src/Service/PhraseTagService.php
index df1ffd7..bf40fd2 100644
--- a/src/Service/PhraseTagService.php
+++ b/src/Service/PhraseTagService.php
@@ -43,13 +43,13 @@ public function list(?string $key, array $tags): array
]);
if (200 !== $statusCode = $response->getStatusCode()) {
- throw new ProviderException(sprintf('phrase replied with an error (%d): "%s"', $statusCode, $response->getContent(false)), $response);
+ throw new ProviderException(\sprintf('phrase replied with an error (%d): "%s"', $statusCode, $response->getContent(false)), $response);
}
/** @var array{name: string} $arr */
$arr = $response->toArray();
- return array_column($arr, 'name');
+ return \array_column($arr, 'name');
}
/**
@@ -66,19 +66,19 @@ public function tag(?string $key, array $tags, array $addTags): int
],
'body' => [
'q' => $query,
- 'tags' => implode(',', $addTags),
+ 'tags' => \implode(',', $addTags),
],
]);
if (200 !== $statusCode = $response->getStatusCode()) {
- throw new ProviderException(sprintf('phrase replied with an error (%d): "%s"', $statusCode, $response->getContent(false)), $response);
+ throw new ProviderException(\sprintf('phrase replied with an error (%d): "%s"', $statusCode, $response->getContent(false)), $response);
}
/** @var array{records_affected: string} $arr */
$arr = $response->toArray();
$records = $arr['records_affected'];
- $this->logger->info(sprintf('tagged %d keys matching "%s" with tag(s) "%s"', $records, $query, implode(', ', $addTags)));
+ $this->logger->info(\sprintf('tagged %d keys matching "%s" with tag(s) "%s"', $records, $query, \implode(', ', $addTags)));
return (int) $records;
}
@@ -97,19 +97,19 @@ public function untag(?string $key, array $tags, array $removeTags): int
],
'body' => [
'q' => $query,
- 'tags' => implode(',', $removeTags),
+ 'tags' => \implode(',', $removeTags),
],
]);
if (200 !== $statusCode = $response->getStatusCode()) {
- throw new ProviderException(sprintf('phrase replied with an error (%d): "%s"', $statusCode, $response->getContent(false)), $response);
+ throw new ProviderException(\sprintf('phrase replied with an error (%d): "%s"', $statusCode, $response->getContent(false)), $response);
}
/** @var array{records_affected: string} $arr */
$arr = $response->toArray();
$records = $arr['records_affected'];
- $this->logger->info(sprintf('untagged %d keys matching "%s" with tag(s) "%s"', $records, $query, implode(', ', $removeTags)));
+ $this->logger->info(\sprintf('untagged %d keys matching "%s" with tag(s) "%s"', $records, $query, \implode(', ', $removeTags)));
return (int) $records;
}
@@ -120,8 +120,8 @@ public function untag(?string $key, array $tags, array $removeTags): int
private function createQuery(?string $key, array $tags): string
{
$query = $key ?? '';
- $query .= [] !== $tags ? ' tags:'.implode(',', $tags) : '';
+ $query .= [] !== $tags ? ' tags:'.\implode(',', $tags) : '';
- return trim($query);
+ return \trim($query);
}
}
diff --git a/tests/Unit/Service/PhraseTagServiceTest.php b/tests/Unit/Service/PhraseTagServiceTest.php
index a2b58be..a0a4e30 100644
--- a/tests/Unit/Service/PhraseTagServiceTest.php
+++ b/tests/Unit/Service/PhraseTagServiceTest.php
@@ -103,16 +103,16 @@ public function testTag(?string $key, array $tags, array $newTags): void
$this->getLogger()
->expects(self::once())
->method('info')
- ->with(sprintf('tagged 10 keys matching "%s" with tag(s) "%s"', $this->query($key, $tags), implode(', ', $newTags)));
+ ->with(\sprintf('tagged 10 keys matching "%s" with tag(s) "%s"', $this->query($key, $tags), \implode(', ', $newTags)));
$responses = [
'tag keys' => function (string $method, string $url, array $options = []) use ($key, $tags, $newTags): ResponseInterface {
- $body = ['q' => $this->query($key, $tags), 'tags' => implode(',', $newTags)];
+ $body = ['q' => $this->query($key, $tags), 'tags' => \implode(',', $newTags)];
$this->assertSame('PATCH', $method);
$this->assertSame('https://api.phrase.com/api/v2/projects/1/keys/tag?page=1&per_page=100', $url);
- $this->assertSame(http_build_query($body), $options['body']);
+ $this->assertSame(\http_build_query($body), $options['body']);
- return new MockResponse(json_encode(['records_affected' => '10'], \JSON_THROW_ON_ERROR));
+ return new MockResponse(\json_encode(['records_affected' => '10'], \JSON_THROW_ON_ERROR));
},
];
@@ -158,16 +158,16 @@ public function testUnTag(?string $key, array $tags, array $newTags): void
$this->getLogger()
->expects(self::once())
->method('info')
- ->with(sprintf('untagged 10 keys matching "%s" with tag(s) "%s"', $this->query($key, $tags), implode(', ', $newTags)));
+ ->with(\sprintf('untagged 10 keys matching "%s" with tag(s) "%s"', $this->query($key, $tags), \implode(', ', $newTags)));
$responses = [
'untag keys' => function (string $method, string $url, array $options = []) use ($key, $tags, $newTags): ResponseInterface {
- $body = ['q' => $this->query($key, $tags), 'tags' => implode(',', $newTags)];
+ $body = ['q' => $this->query($key, $tags), 'tags' => \implode(',', $newTags)];
$this->assertSame('PATCH', $method);
$this->assertSame('https://api.phrase.com/api/v2/projects/1/keys/untag?page=1&per_page=100', $url);
- $this->assertSame(http_build_query($body), $options['body']);
+ $this->assertSame(\http_build_query($body), $options['body']);
- return new MockResponse(json_encode(['records_affected' => '10'], \JSON_THROW_ON_ERROR));
+ return new MockResponse(\json_encode(['records_affected' => '10'], \JSON_THROW_ON_ERROR));
},
];
@@ -294,8 +294,8 @@ private function getLogger(): LoggerInterface&MockObject
private function query(?string $key, array $tags): string
{
$query = $key ?? '';
- $query .= [] !== $tags ? ' tags:'.implode(',', $tags) : '';
+ $query .= [] !== $tags ? ' tags:'.\implode(',', $tags) : '';
- return trim($query);
+ return \trim($query);
}
}