Skip to content

Commit 1e71dda

Browse files
committed
use php functions
1 parent b9cc8fa commit 1e71dda

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/Commands/Optimize.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
use DutchCodingCompany\LaravelJsonSchema\JsonSchemaRepository;
66
use Illuminate\Console\Command;
7-
use Illuminate\Contracts\Filesystem\Factory as FilesystemFactory;
8-
use Illuminate\Contracts\Filesystem\Filesystem;
9-
use Illuminate\Support\Facades\App;
107

118
class Optimize extends Command
129
{
@@ -27,11 +24,11 @@ class Optimize extends Command
2724
/**
2825
* Execute the console command.
2926
*/
30-
public function handle(FilesystemFactory $filesystem, JsonSchemaRepository $repository): int
27+
public function handle(JsonSchemaRepository $repository): int
3128
{
3229
$this->call('json-schema:optimize-clear');
3330

34-
$filesystem->disk('local')->put(
31+
file_put_contents(
3532
$repository->fullCachePath(),
3633
'<?php return '.var_export($repository->schemaFiles(true), true).';'.PHP_EOL,
3734
);

src/Commands/OptimizeClear.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use DutchCodingCompany\LaravelJsonSchema\JsonSchemaRepository;
66
use Illuminate\Console\Command;
7-
use Illuminate\Contracts\Filesystem\Factory as FilesystemFactory;
87

98
class OptimizeClear extends Command
109
{
@@ -25,9 +24,11 @@ class OptimizeClear extends Command
2524
/**
2625
* Execute the console command.
2726
*/
28-
public function handle(FilesystemFactory $filesystem, JsonSchemaRepository $repository): int
27+
public function handle(JsonSchemaRepository $repository): int
2928
{
30-
$filesystem->disk('local')->delete($repository->fullCachePath());
29+
if (file_exists($path = $repository->fullCachePath())) {
30+
unlink($path);
31+
}
3132

3233
$this->outputComponents()->info('Json schemas cache cleared successfully!');
3334

src/JsonSchemaRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ final public function fullCachePath(): string
7171
*/
7272
protected function findSchemaFiles(): array
7373
{
74-
if ($this->filesystem->disk('local')->exists($path = $this->fullCachePath())) {
74+
if (file_exists($path = $this->fullCachePath())) {
7575
return include $path;
7676
}
7777

0 commit comments

Comments
 (0)