1 | <?php |
||||||
2 | |||||||
3 | namespace UniSharp\LaravelFilemanager\Controllers; |
||||||
4 | |||||||
5 | use UniSharp\LaravelFilemanager\Events\FolderIsCreating; |
||||||
6 | use UniSharp\LaravelFilemanager\Events\FolderWasCreated; |
||||||
7 | |||||||
8 | class FolderController extends LfmController |
||||||
9 | { |
||||||
10 | /** |
||||||
11 | * Get list of folders as json to populate treeview. |
||||||
12 | * |
||||||
13 | * @return mixed |
||||||
14 | */ |
||||||
15 | public function getFolders() |
||||||
16 | { |
||||||
17 | $folder_types = array_filter(['user', 'share'], function ($type) { |
||||||
18 | return $this->helper->allowFolderType($type); |
||||||
0 ignored issues
–
show
The property
helper does not exist on UniSharp\LaravelFilemana...ollers\FolderController . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
19 | }); |
||||||
20 | |||||||
21 | return view('laravel-filemanager::tree') |
||||||
0 ignored issues
–
show
The function
view 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
![]() |
|||||||
22 | ->with([ |
||||||
23 | 'root_folders' => array_map(function ($type) use ($folder_types) { |
||||||
24 | $path = $this->lfm->dir($this->helper->getRootFolder($type)); |
||||||
0 ignored issues
–
show
The property
helper does not exist on UniSharp\LaravelFilemana...ollers\FolderController . Since you implemented __get , consider adding a @property annotation.
![]() The property
lfm does not exist on UniSharp\LaravelFilemana...ollers\FolderController . Since you implemented __get , consider adding a @property annotation.
![]() The method
dir() does not exist on null .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||
25 | |||||||
26 | return (object) [ |
||||||
27 | 'name' => trans('laravel-filemanager::lfm.title-' . $type), |
||||||
0 ignored issues
–
show
The function
trans 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
![]() |
|||||||
28 | 'url' => $path->path('working_dir'), |
||||||
29 | 'children' => $path->folders(), |
||||||
30 | 'has_next' => ! ($type == end($folder_types)), |
||||||
31 | ]; |
||||||
32 | }, $folder_types), |
||||||
33 | ]); |
||||||
34 | } |
||||||
35 | |||||||
36 | /** |
||||||
37 | * Add a new folder. |
||||||
38 | * |
||||||
39 | * @return mixed |
||||||
40 | */ |
||||||
41 | public function getAddfolder() |
||||||
42 | { |
||||||
43 | $folder_name = $this->helper->input('name'); |
||||||
0 ignored issues
–
show
The property
helper does not exist on UniSharp\LaravelFilemana...ollers\FolderController . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
44 | |||||||
45 | $new_path = $this->lfm->setName($folder_name)->path('absolute'); |
||||||
0 ignored issues
–
show
The property
lfm does not exist on UniSharp\LaravelFilemana...ollers\FolderController . Since you implemented __get , consider adding a @property annotation.
![]() |
|||||||
46 | |||||||
47 | event(new FolderIsCreating($new_path)); |
||||||
0 ignored issues
–
show
The function
event 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
![]() |
|||||||
48 | |||||||
49 | try { |
||||||
50 | if ($folder_name === null || $folder_name == '') { |
||||||
51 | return $this->helper->error('folder-name'); |
||||||
52 | } elseif ($this->lfm->setName($folder_name)->exists()) { |
||||||
53 | return $this->helper->error('folder-exist'); |
||||||
54 | } elseif (config('lfm.alphanumeric_directory') && preg_match('/[^\w-]/i', $folder_name)) { |
||||||
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
![]() |
|||||||
55 | return $this->helper->error('folder-alnum'); |
||||||
56 | } else { |
||||||
57 | $this->lfm->setName($folder_name)->createFolder(); |
||||||
58 | } |
||||||
59 | } catch (\Exception $e) { |
||||||
60 | return $e->getMessage(); |
||||||
61 | } |
||||||
62 | |||||||
63 | event(new FolderWasCreated($new_path)); |
||||||
64 | |||||||
65 | return parent::$success_response; |
||||||
66 | } |
||||||
67 | } |
||||||
68 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.