1 | <?php |
||
7 | abstract class AbstractMediaHandler |
||
8 | { |
||
9 | private $priority; |
||
10 | |||
11 | /** |
||
12 | * @param int $priority |
||
13 | */ |
||
14 | 21 | public function __construct($priority = 0) |
|
18 | |||
19 | /** |
||
20 | * @return int |
||
21 | */ |
||
22 | public function getPriority() |
||
23 | { |
||
24 | return $this->priority; |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * Return the default form type options |
||
29 | * |
||
30 | * @return array |
||
31 | */ |
||
32 | public function getFormTypeOptions() |
||
36 | |||
37 | /** |
||
38 | * @return string |
||
39 | */ |
||
40 | abstract public function getName(); |
||
41 | |||
42 | /** |
||
43 | * @return string |
||
44 | */ |
||
45 | abstract public function getType(); |
||
46 | |||
47 | /** |
||
48 | * @return string |
||
49 | */ |
||
50 | abstract public function getFormType(); |
||
51 | |||
52 | /** |
||
53 | * @param mixed $media |
||
54 | */ |
||
55 | abstract public function canHandle($media); |
||
56 | |||
57 | /** |
||
58 | * @param Media $media |
||
59 | * |
||
60 | * @return mixed |
||
61 | */ |
||
62 | abstract public function getFormHelper(Media $media); |
||
63 | |||
64 | /** |
||
65 | * @param Media $media |
||
66 | */ |
||
67 | abstract public function prepareMedia(Media $media); |
||
68 | |||
69 | /** |
||
70 | * @param Media $media |
||
71 | */ |
||
72 | abstract public function saveMedia(Media $media); |
||
73 | |||
74 | /** |
||
75 | * @param Media $media |
||
76 | */ |
||
77 | abstract public function updateMedia(Media $media); |
||
78 | |||
79 | /** |
||
80 | * @param Media $media |
||
81 | */ |
||
82 | abstract public function removeMedia(Media $media); |
||
83 | |||
84 | /** |
||
85 | * @param mixed $data |
||
86 | * |
||
87 | * @return Media |
||
88 | */ |
||
89 | abstract public function createNew($data); |
||
90 | |||
91 | public function getShowTemplate(Media $media) |
||
95 | |||
96 | /** |
||
97 | * @param Media $media The media entity |
||
98 | * @param string $basepath The base path |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getImageUrl(Media $media, $basepath) |
||
106 | |||
107 | /** |
||
108 | * @return array |
||
109 | */ |
||
110 | abstract public function getAddFolderActions(); |
||
111 | } |
||
112 |
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@return
doc comment to communicate to implementors of these methods what they are expected to return.