Completed
Pull Request — master (#2680)
by
unknown
06:45
created

AbstractMediaHandler::saveMedia()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
ccs 0
cts 0
cp 0
c 0
b 0
f 0
nc 1
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 21
    public function __construct($priority = 0)
15
    {
16 21
        $this->priority = $priority;
17 21
    }
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);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

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.

Loading history...
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);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

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.

Loading history...
68
69
    /**
70
     * @param Media $media
71
     */
72
    abstract public function saveMedia(Media $media);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

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.

Loading history...
73
74
    /**
75
     * @param Media $media
76
     */
77
    abstract public function updateMedia(Media $media);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

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.

Loading history...
78
79
    /**
80
     * @param Media $media
81
     */
82
    abstract public function removeMedia(Media $media);
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

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.

Loading history...
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 '@KunstmaanMedia/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
Documentation introduced by
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