1 | <?php |
||
11 | trait RecordTrait |
||
12 | { |
||
13 | use \ByTIC\Common\Records\Traits\AbstractTrait\RecordTrait; |
||
14 | |||
15 | /** |
||
16 | * @var ModelFile[] |
||
17 | */ |
||
18 | public $files = null; |
||
19 | |||
20 | /** |
||
21 | * @param ModelFile $file |
||
22 | * @return string |
||
23 | */ |
||
24 | public function getFileURL($file) |
||
28 | |||
29 | /** |
||
30 | * @param $fileData |
||
31 | * @return bool|ModelFile |
||
32 | */ |
||
33 | public function uploadFile($fileData) |
||
43 | |||
44 | /** |
||
45 | * File factory |
||
46 | * |
||
47 | * @param null $type |
||
48 | * |
||
49 | * @return ModelFile |
||
50 | */ |
||
51 | public function getNewFile($type = null) |
||
60 | |||
61 | /** |
||
62 | * @param null $type |
||
63 | * @return string |
||
64 | */ |
||
65 | public function getFileModelName($type = null) |
||
71 | |||
72 | /** |
||
73 | * @param null $type |
||
74 | * @return string |
||
75 | */ |
||
76 | public function getFileModelNamespaced($type = null) |
||
82 | |||
83 | /** |
||
84 | * @param null $type |
||
85 | * @return string |
||
86 | */ |
||
87 | public function getFileModelNameDefault($type = null) |
||
95 | |||
96 | /** |
||
97 | * @param $request |
||
98 | * @return bool |
||
99 | */ |
||
100 | public function removeFile($request) |
||
110 | |||
111 | /** |
||
112 | * Check if files have been inited |
||
113 | * |
||
114 | * @return ModelFile[]|null |
||
115 | */ |
||
116 | public function checkFiles() |
||
123 | |||
124 | /** |
||
125 | * Find files |
||
126 | * |
||
127 | * @return void |
||
128 | */ |
||
129 | public function findFiles() |
||
136 | |||
137 | /** |
||
138 | * @return string |
||
139 | */ |
||
140 | public function getFilesPath() |
||
144 | |||
145 | /** |
||
146 | * @param $data |
||
147 | */ |
||
148 | public function addNewFileFromArray($data) |
||
154 | |||
155 | /** |
||
156 | * @param ModelFile $file |
||
157 | */ |
||
158 | public function appendFile($file) |
||
162 | |||
163 | /** |
||
164 | * @return ModelFile[] |
||
165 | */ |
||
166 | public function getFiles(): array |
||
171 | |||
172 | /** |
||
173 | * @param array $files |
||
174 | */ |
||
175 | public function setFiles($files = []) |
||
186 | } |
||
187 |
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.