1 | <?php |
||
13 | trait UploadsFiles |
||
14 | { |
||
15 | /** |
||
16 | * @param $source |
||
17 | * @param $destinationPath |
||
18 | * @param bool $shouldQueue |
||
19 | * @param null $queueJob |
||
20 | * |
||
21 | * @return bool |
||
22 | */ |
||
23 | public function upload($source, $destinationPath = null, $shouldQueue = true, $queueJob = null) |
||
43 | |||
44 | /** |
||
45 | * @param $source |
||
46 | * @param null $destinationPath |
||
47 | * |
||
48 | * @return array |
||
49 | */ |
||
50 | protected function preparePaths($source, $destinationPath = null) |
||
66 | |||
67 | /** |
||
68 | * @param $sourcePath |
||
69 | * @param $destinationPath |
||
70 | * @param null $targetModel |
||
71 | * |
||
72 | * @return bool |
||
73 | */ |
||
74 | protected function handleUpload($sourcePath, $destinationPath, $targetModel = null) |
||
89 | |||
90 | /** |
||
91 | * @param UploadException $exception |
||
92 | * @param null $job |
||
93 | * @param null $targetModel |
||
94 | * |
||
95 | * @return mixed |
||
96 | */ |
||
97 | protected function handleUploadError(UploadException $exception, $job = null, $targetModel = null) |
||
119 | } |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.