1 | <?php |
||
39 | trait CrudTrait |
||
40 | { |
||
41 | /** |
||
42 | * Upload the attachment. |
||
43 | * |
||
44 | * @param array $input |
||
45 | * @param Project $project |
||
46 | * @param User $user |
||
47 | * |
||
48 | * @return Eloquent\Model |
||
49 | */ |
||
50 | 3 | public function upload(array $input, Project $project, User $user) |
|
51 | { |
||
52 | 3 | $relativePath = '/' . config('tinyissue.uploads_dir') . '/' . $project->id . '/' . $input['upload_token']; |
|
53 | 3 | \Storage::disk('local')->makeDirectory($relativePath, 0777, true); |
|
|
|||
54 | 3 | $path = config('filesystems.disks.local.root') . $relativePath; |
|
55 | |||
56 | /* @var $uploadedFile \Symfony\Component\HttpFoundation\File\UploadedFile */ |
||
57 | 3 | $uploadedFile = $input['upload']; |
|
58 | 3 | $file = $uploadedFile->move($path, $uploadedFile->getClientOriginalName()); |
|
59 | |||
60 | 3 | $this->uploaded_by = $user->id; |
|
61 | 3 | $this->filename = $file->getFilename(); |
|
62 | 3 | $this->fileextension = $file->getExtension(); |
|
63 | 3 | $this->filesize = $file->getSize(); |
|
64 | 3 | $this->upload_token = $input['upload_token']; |
|
65 | |||
66 | 3 | return $this->save(); |
|
67 | } |
||
68 | |||
69 | /** |
||
70 | * Remove a attachment that is pending from a issue/comment. |
||
71 | * |
||
72 | * @param array $input |
||
73 | * @param Project $project |
||
74 | * @param User $user |
||
75 | * |
||
76 | * @return void |
||
77 | */ |
||
78 | 1 | public function remove(array $input, Project $project, User $user) |
|
88 | |||
89 | /** |
||
90 | * Delete the physical file of an attachment. |
||
91 | * |
||
92 | * @param string $path |
||
93 | * @param string $filename |
||
94 | */ |
||
95 | 1 | public function deleteFile($path, $filename) |
|
106 | } |
||
107 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.