| 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 | 7 | public function getPriority() |
|
| 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 | * @return mixed |
||
| 59 | */ |
||
| 60 | abstract public function getFormHelper(Media $media); |
||
| 61 | |||
| 62 | abstract public function prepareMedia(Media $media); |
||
| 63 | |||
| 64 | abstract public function saveMedia(Media $media); |
||
| 65 | |||
| 66 | abstract public function updateMedia(Media $media); |
||
| 67 | |||
| 68 | abstract public function removeMedia(Media $media); |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @param mixed $data |
||
| 72 | * |
||
| 73 | * @return Media |
||
| 74 | */ |
||
| 75 | abstract public function createNew($data); |
||
| 76 | |||
| 77 | public function getShowTemplate(Media $media) |
||
| 78 | { |
||
| 79 | return '@KunstmaanMedia/Media/show.html.twig'; |
||
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * @param Media $media The media entity |
||
| 84 | * @param string $basepath The base path |
||
| 85 | * |
||
| 86 | * @return string |
||
| 87 | */ |
||
| 88 | public function getImageUrl(Media $media, $basepath) |
||
| 89 | { |
||
| 90 | return null; |
||
| 91 | } |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @return array |
||
| 95 | */ |
||
| 96 | abstract public function getAddFolderActions(); |
||
| 97 | } |
||
| 98 |
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
@returndoc comment to communicate to implementors of these methods what they are expected to return.