1 | <?php |
||||
2 | |||||
3 | namespace OkayBueno\Repositories\Commands; |
||||
4 | |||||
5 | use Illuminate\Console\Command; |
||||
6 | use Illuminate\Filesystem\Filesystem; |
||||
7 | |||||
8 | /** |
||||
9 | * Class MakeBaseCommand |
||||
10 | * @package OkayBueno\Repositories\Commands |
||||
11 | */ |
||||
12 | class MakeBaseCommand extends Command |
||||
13 | { |
||||
14 | protected $filesystem; |
||||
15 | protected $composer; |
||||
16 | |||||
17 | |||||
18 | /** |
||||
19 | * @param Filesystem $filesystem |
||||
20 | */ |
||||
21 | public function __construct( |
||||
22 | Filesystem $filesystem |
||||
23 | ) |
||||
24 | { |
||||
25 | parent::__construct(); |
||||
26 | $this->filesystem = $filesystem; |
||||
27 | $this->composer = app()['composer']; |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
28 | } |
||||
29 | |||||
30 | |||||
31 | /** |
||||
32 | * @param $path |
||||
33 | */ |
||||
34 | protected function makeDirectory( $path ) |
||||
35 | { |
||||
36 | if ( !$this->filesystem->isDirectory( $path ) ) |
||||
37 | { |
||||
38 | $this->filesystem->makeDirectory( $path, 0775, true, true); |
||||
39 | } |
||||
40 | } |
||||
41 | |||||
42 | |||||
43 | /** |
||||
44 | * @return array|mixed|string |
||||
45 | */ |
||||
46 | protected function findDefaultImplementation() |
||||
47 | { |
||||
48 | $implementationBindings = config( 'repositories.bindings' ); |
||||
0 ignored issues
–
show
The function
config 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
![]() |
|||||
49 | |||||
50 | $filtered = array_filter( $implementationBindings, function( $k ) { |
||||
51 | return $k === 'default'; |
||||
52 | }); |
||||
53 | |||||
54 | $default = array_keys($filtered); |
||||
55 | $default = is_array( $default ) ? $default[0] : $default; |
||||
0 ignored issues
–
show
|
|||||
56 | |||||
57 | return $default ? $default : 'eloquent'; |
||||
58 | } |
||||
59 | |||||
60 | } |