Skip to content

Commit 1aac54e

Browse files
dazzyandywer
authored andcommitted
Code quality fixes (andywer#55)
Best effort fixes of code style issues introduced by me and some other low hanging fruits.
1 parent 7f413f8 commit 1aac54e

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

src/Caching/ConfigCachingService.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,15 @@ public function refreshCache()
4848
}
4949

5050
/**
51-
* @param bool $noCache
51+
* Returns the config (already JSON encoded).
52+
* Refreshes the cache if necessary.
53+
*
54+
* @param bool $noCache (optional) Defines if cache should be ignored.
5255
* @return mixed|string string The JSON-encoded config exports.
5356
*/
5457
public function getConfigJson($noCache = false)
5558
{
56-
if ($noCache or $this->isDisabled()) {
59+
if ($noCache || $this->isDisabled()) {
5760
return $this->createConfigJson();
5861
} else {
5962
return $this->getData();

src/Caching/MessageCachingService.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ public function __construct()
3636
}
3737

3838
/**
39-
* Returns the messages (already JSON encoded), fresh if wanted.
40-
* Creates the necessary cache item if necessary.
39+
* Returns the messages (already JSON encoded).
40+
* Refreshes the cache if necessary.
4141
*
42+
* @param bool $noCache (optional) Defines if cache should be ignored.
4243
* @return string JSON encoded messages object.
4344
*/
4445
public function getMessagesJson($noCache = false)

src/Console/ExportCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected function getOptions()
5353
*/
5454
public function handle()
5555
{
56-
$noCache = $this->option('no-cache');
56+
$noCache = (bool)$this->option('no-cache');
5757
if ($noCache == true) $this->line('Exporting messages and config...');
5858
else $this->line('Refreshing and exporting the message and config cache...');
5959

tests/JsLocalization/Http/Responses/StaticFileResponseTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
class StaticFileResponseTest extends TestCase
77
{
8-
protected $testFilePath, $testFileContent;
8+
protected $testFilePath;
9+
protected $testFileContent;
910

1011
public function setUp()
1112
{
@@ -34,7 +35,6 @@ public function testExceptionHandling()
3435
$filePath = "/tmp/x/y/z/does-not-exist";
3536
$this->setExpectedException('Exception', "Cannot read file: $filePath");
3637

37-
$response = new StaticFileResponse($filePath);
38+
new StaticFileResponse($filePath);
3839
}
3940
}
40-
?>

0 commit comments

Comments
 (0)