andes2912 /
indobank
| 1 | <?php |
||||
| 2 | |||||
| 3 | /* |
||||
| 4 | * This file is part of the IndoBank package. |
||||
| 5 | * |
||||
| 6 | * (c) Andri Desmana <andridesmana.pw | [email protected]> |
||||
| 7 | * |
||||
| 8 | */ |
||||
| 9 | |||||
| 10 | namespace Andes2912\IndoBank; |
||||
| 11 | |||||
| 12 | use Illuminate\Console\Command; |
||||
|
0 ignored issues
–
show
|
|||||
| 13 | use Illuminate\Support\Facades\File; |
||||
|
0 ignored issues
–
show
The type
Illuminate\Support\Facades\File was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 14 | |||||
| 15 | class IndoBankPublishCommand extends Command |
||||
| 16 | { |
||||
| 17 | /** |
||||
| 18 | * The console command signature. |
||||
| 19 | * |
||||
| 20 | * @var string |
||||
| 21 | */ |
||||
| 22 | protected $signature = 'indobank:publish'; |
||||
| 23 | |||||
| 24 | /** |
||||
| 25 | * The console command description. |
||||
| 26 | * |
||||
| 27 | * @var string |
||||
| 28 | */ |
||||
| 29 | protected $description = 'Publish IndoBank assets from vendor packages'; |
||||
| 30 | |||||
| 31 | /** |
||||
| 32 | * Compatiblity for Lumen 5.5. |
||||
| 33 | * |
||||
| 34 | * @return void |
||||
| 35 | */ |
||||
| 36 | public function handle() |
||||
| 37 | { |
||||
| 38 | $this->fire(); |
||||
| 39 | } |
||||
| 40 | |||||
| 41 | /** |
||||
| 42 | * Execute the console command. |
||||
| 43 | * |
||||
| 44 | * @return void |
||||
| 45 | */ |
||||
| 46 | public function fire() |
||||
| 47 | { |
||||
| 48 | $this->publishModels(); |
||||
| 49 | $this->publishMigrations(); |
||||
| 50 | $this->publishSeeds(); |
||||
| 51 | |||||
| 52 | $this->info("Publishing IndoBank complete"); |
||||
| 53 | } |
||||
| 54 | |||||
| 55 | |||||
| 56 | /** |
||||
| 57 | * Publish the directory to the given directory. |
||||
| 58 | * |
||||
| 59 | * @param string $from |
||||
| 60 | * @param string $to |
||||
| 61 | * @return void |
||||
| 62 | */ |
||||
| 63 | protected function publishDirectory($from , $to) |
||||
| 64 | { |
||||
| 65 | $exclude = array('..' , '.' , '.DS_Store'); |
||||
| 66 | $source = array_diff(scandir($from) , $exclude); |
||||
| 67 | |||||
| 68 | foreach ($source as $item) { |
||||
| 69 | $this->info("Copying file: " . $to . $item); |
||||
| 70 | File::copy($from . $item , $to . $item); |
||||
| 71 | } |
||||
| 72 | } |
||||
| 73 | |||||
| 74 | /** |
||||
| 75 | * Publish model. |
||||
| 76 | * |
||||
| 77 | * @return void |
||||
| 78 | */ |
||||
| 79 | protected function publishModels() |
||||
| 80 | { |
||||
| 81 | $targetPath = app()->path()."/Models/"; |
||||
|
0 ignored issues
–
show
The function
app was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 82 | |||||
| 83 | if (!File::isDirectory($targetPath)){ |
||||
| 84 | File::makeDirectory($targetPath, 0777, true, true); |
||||
| 85 | } |
||||
| 86 | |||||
| 87 | $this->publishDirectory(__DIR__.'/database/models/', app()->path()."/Models/"); |
||||
| 88 | } |
||||
| 89 | |||||
| 90 | /** |
||||
| 91 | * Publish migrations. |
||||
| 92 | * |
||||
| 93 | * @return void |
||||
| 94 | */ |
||||
| 95 | protected function publishMigrations() |
||||
| 96 | { |
||||
| 97 | $this->publishDirectory(__DIR__.'/database/migrations/', app()->databasePath()."/migrations/"); |
||||
|
0 ignored issues
–
show
The function
app was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 98 | } |
||||
| 99 | |||||
| 100 | /** |
||||
| 101 | * Publish seeds. |
||||
| 102 | * |
||||
| 103 | * @return void |
||||
| 104 | */ |
||||
| 105 | protected function publishSeeds() |
||||
| 106 | { |
||||
| 107 | $this->publishDirectory(__DIR__.'/database/seeders/', app()->databasePath()."/seeders/"); |
||||
|
0 ignored issues
–
show
The function
app was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 108 | } |
||||
| 109 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths