Completed
Push — master ( 1de9b7...830752 )
by Kristof
38:46 queued 24:09
created

MediaBundle/Helper/Media/AbstractMediaHandler.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\MediaBundle\Helper\Media;
4
5
use Kunstmaan\MediaBundle\Entity\Media;
6
7
abstract class AbstractMediaHandler
8
{
9
    private $priority;
10
11
    /**
12
     * @param int $priority
13
     */
14
    public function __construct($priority = 0)
15
    {
16
        $this->priority = $priority;
17
    }
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()
33
    {
34
        return array();
35
    }
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)
92
    {
93
        return 'KunstmaanMediaBundle:Media:show.html.twig';
94
    }
95
96
    /**
97
     * @param Media  $media    The media entity
98
     * @param string $basepath The base path
99
     *
100
     * @return string
0 ignored issues
show
Should the return type not be string|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
101
     */
102
    public function getImageUrl(Media $media, $basepath)
103
    {
104
        return null;
105
    }
106
107
    /**
108
     * @return array
109
     */
110
    abstract public function getAddFolderActions();
111
}
112