1 | <?php |
||
16 | class SourceRepository implements SourceRepositoryInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var ActiveRecord |
||
20 | */ |
||
21 | public $owner; |
||
22 | |||
23 | /** |
||
24 | * The public url for file |
||
25 | * 'url' => 'uploads' |
||
26 | */ |
||
27 | public $uploadUrl; |
||
28 | |||
29 | /** |
||
30 | * The directory path for file |
||
31 | * 'uploadDir' => Yii::getAlias('@webroot/uploads') |
||
32 | */ |
||
33 | public $uploadDir; |
||
34 | |||
35 | /** |
||
36 | * Get relative folder path |
||
37 | * |
||
38 | * @return string |
||
39 | */ |
||
40 | public function getRelativeFolderPath(): string |
||
49 | |||
50 | /** |
||
51 | * Get folder path |
||
52 | * |
||
53 | * @param string $field Field name |
||
54 | * |
||
55 | * @author Orlov Alexey <[email protected]> |
||
56 | * |
||
57 | * @return string Return path to entity img with|out field name |
||
58 | */ |
||
59 | public function getFolderPath(string $field = ''): string |
||
69 | |||
70 | /** |
||
71 | * Get file path by "getFolderPath" |
||
72 | * |
||
73 | * @param string $field Field name |
||
74 | * |
||
75 | * @author Orlov Alexey <[email protected]> |
||
76 | * |
||
77 | * @return string Return path to file |
||
78 | */ |
||
79 | public function getFilePath(string $field): string |
||
83 | |||
84 | /** |
||
85 | * Get file type |
||
86 | * |
||
87 | * @author Orlov Alexey <[email protected]> |
||
88 | * |
||
89 | * @param string $field Field name |
||
90 | * @param bool $full Full or not full file type |
||
91 | * |
||
92 | * @todo If no need then delete in the next version |
||
93 | * |
||
94 | * @return string Return file type |
||
95 | */ |
||
96 | public function getFileType(string $field, $full = true) |
||
117 | |||
118 | /** |
||
119 | * Get file src |
||
120 | * |
||
121 | * @author Orlov Alexey <[email protected]> |
||
122 | * |
||
123 | * @param $field |
||
124 | * @param null $default |
||
125 | * |
||
126 | * @return string File src |
||
127 | * |
||
128 | * @throws Exception |
||
129 | */ |
||
130 | public function getFileSrc(string $field, $default = null): string |
||
142 | |||
143 | /** |
||
144 | * Base upload dir |
||
145 | * |
||
146 | * @return string |
||
147 | */ |
||
148 | public function getUploadDir(): string |
||
152 | |||
153 | /** |
||
154 | * Base upload url |
||
155 | * |
||
156 | * @return string |
||
157 | */ |
||
158 | public function getUploadUrl(): string |
||
167 | } |
||
168 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.