Skip to content

Commit 88a49c2

Browse files
orkhanahmadovStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent d37216c commit 88a49c2

File tree

5 files changed

+25
-23
lines changed

5 files changed

+25
-23
lines changed

src/Console/RepositoryMakeCommand.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function getStub()
4444
$stub = '/stubs/repository.stub';
4545
}
4646

47-
return __DIR__.$stub;
47+
return __DIR__ . $stub;
4848
}
4949

5050
/**
@@ -63,7 +63,9 @@ protected function buildClass($name)
6363
}
6464

6565
return str_replace(
66-
array_keys($replace), array_values($replace), parent::buildClass($name)
66+
array_keys($replace),
67+
array_values($replace),
68+
parent::buildClass($name)
6769
);
6870
}
6971

@@ -106,7 +108,7 @@ protected function parseModel($model)
106108
$model = trim(str_replace('/', '\\', $model), '\\');
107109

108110
if (! Str::startsWith($model, $rootNamespace = $this->laravel->getNamespace())) {
109-
$model = $rootNamespace.$model;
111+
$model = $rootNamespace . $model;
110112
}
111113

112114
return $model;
@@ -132,6 +134,6 @@ protected function getOptions()
132134
*/
133135
protected function getDefaultNamespace($rootNamespace)
134136
{
135-
return $rootNamespace.'\Repositories';
137+
return $rootNamespace . '\Repositories';
136138
}
137139
}

src/EloquentRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ public function cacheKey(): string
113113
public function invalidateCache($model): void
114114
{
115115
$this->cache->forget(
116-
$this->cacheKey().'.*'
116+
$this->cacheKey() . '.*'
117117
);
118118
$this->cache->forget(
119-
$this->cacheKey().'.'.$model->id
119+
$this->cacheKey() . '.' . $model->id
120120
);
121121
}
122122

src/Repository/Concerns/SelectsEntity.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function all()
2626
{
2727
if ($this instanceof Cacheable) {
2828
return $this->cache->remember(
29-
$this->cacheKey().'.*',
29+
$this->cacheKey() . '.*',
3030
$this->cacheTTLValue(),
3131
function () {
3232
return $this->get();
@@ -66,7 +66,7 @@ public function find($modelId)
6666
{
6767
if ($this instanceof Cacheable) {
6868
$model = $this->cache->remember(
69-
$this->cacheKey().'.'.$modelId,
69+
$this->cacheKey() . '.' . $modelId,
7070
$this->cacheTTLValue(),
7171
function () use ($modelId) {
7272
return $this->model->find($modelId);

tests/Console/RepositoryMakeCommandTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function testCreatesRepositoryWithoutModel()
1212
$this->artisan('make:repository', ['name' => 'FooRepository'])
1313
->assertExitCode(0);
1414

15-
$this->assertTrue(is_file(app_path().'/Repositories/FooRepository.php'));
15+
$this->assertTrue(is_file(app_path() . '/Repositories/FooRepository.php'));
1616
}
1717

1818
public function testCreatesRepositoryWithModel()
@@ -21,7 +21,7 @@ public function testCreatesRepositoryWithModel()
2121
->expectsQuestion('A App\FooModel model does not exist. Do you want to generate it?', 'yes')
2222
->assertExitCode(0);
2323

24-
$this->assertTrue(is_file(app_path().'/Repositories/FooModelRepository.php'));
24+
$this->assertTrue(is_file(app_path() . '/Repositories/FooModelRepository.php'));
2525
}
2626

2727
public function testThrowsExceptionWhenInvalidModelNameSpecified()
@@ -35,13 +35,13 @@ public function testThrowsExceptionWhenInvalidModelNameSpecified()
3535

3636
protected function tearDown(): void
3737
{
38-
if (file_exists(app_path().'/Repositories/FooRepository.php')) {
39-
unlink(app_path().'/Repositories/FooRepository.php');
38+
if (file_exists(app_path() . '/Repositories/FooRepository.php')) {
39+
unlink(app_path() . '/Repositories/FooRepository.php');
4040
}
4141

42-
if (file_exists(app_path().'/Repositories/FooModelRepository.php')) {
43-
unlink(app_path().'/Repositories/FooModelRepository.php');
44-
unlink(app_path().'/FooModel.php');
42+
if (file_exists(app_path() . '/Repositories/FooModelRepository.php')) {
43+
unlink(app_path() . '/Repositories/FooModelRepository.php');
44+
unlink(app_path() . '/FooModel.php');
4545
}
4646

4747
parent::tearDown();

tests/Repository/EloquentRepositoryTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,14 @@ public function testFindAndUpdate()
218218
public function testUpdate()
219219
{
220220
$model = Model::create(['id' => 5, 'name' => 'model name']);
221-
Cache::put('models.'.$model->id, $model, 100);
221+
Cache::put('models.' . $model->id, $model, 100);
222222

223-
$this->assertNotNull(Cache::get('models.'.$model->id));
223+
$this->assertNotNull(Cache::get('models.' . $model->id));
224224
$result = $this->cachedModelRepository->update($model, [
225225
'name' => 'updated name',
226226
]);
227227

228-
$this->assertNull(Cache::get('models.'.$model->id));
228+
$this->assertNull(Cache::get('models.' . $model->id));
229229
$this->assertEquals('updated name', $result->name);
230230
$this->assertEquals('updated name', $model->refresh()->name);
231231
}
@@ -244,13 +244,13 @@ public function testFindAndDelete()
244244
public function testDelete()
245245
{
246246
$model = Model::create(['id' => 5, 'name' => 'model name']);
247-
Cache::put('models.'.$model->id, $model, 100);
248-
$this->assertNotNull(Cache::get('models.'.$model->id));
247+
Cache::put('models.' . $model->id, $model, 100);
248+
$this->assertNotNull(Cache::get('models.' . $model->id));
249249
$this->assertNull($model->deleted_at);
250250

251251
$result = $this->cachedModelRepository->delete($model);
252252

253-
$this->assertNull(Cache::get('models.'.$model->id));
253+
$this->assertNull(Cache::get('models.' . $model->id));
254254
$this->assertNotNull($model->refresh()->deleted_at);
255255
$this->assertTrue($result);
256256
}
@@ -357,11 +357,11 @@ public function testCacheTTLValueWithMethod()
357357
public function testInvalidateCache()
358358
{
359359
$model = Model::create(['id' => 5, 'name' => 'model name']);
360-
Cache::put('models.'.$model->id, $model, 100);
360+
Cache::put('models.' . $model->id, $model, 100);
361361

362362
$this->cachedModelRepository->invalidateCache($model);
363363

364-
$this->assertNull(Cache::get('models.'.$model->id));
364+
$this->assertNull(Cache::get('models.' . $model->id));
365365
}
366366

367367
protected function setUp(): void

0 commit comments

Comments
 (0)