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\MediaPagePartBundle\Entity; |
||
4 | |||
5 | use Doctrine\ORM\Mapping as ORM; |
||
6 | use Kunstmaan\MediaBundle\Entity\Media; |
||
7 | use Kunstmaan\MediaPagePartBundle\Form\AudioPagePartAdminType; |
||
8 | use Kunstmaan\PagePartBundle\Entity\AbstractPagePart; |
||
9 | |||
10 | /** |
||
11 | * AudioPagePart |
||
12 | * |
||
13 | * @ORM\Entity |
||
14 | * @ORM\Table(name="kuma_audio_page_parts") |
||
15 | */ |
||
16 | View Code Duplication | class AudioPagePart extends AbstractPagePart |
|
0 ignored issues
–
show
|
|||
17 | { |
||
18 | /** |
||
19 | * @ORM\ManyToOne(targetEntity="Kunstmaan\MediaBundle\Entity\Media") |
||
20 | * @ORM\JoinColumn(name="media_id", referencedColumnName="id") |
||
21 | */ |
||
22 | protected $media; |
||
23 | |||
24 | /** |
||
25 | * Get media |
||
26 | * |
||
27 | * @return Media |
||
28 | */ |
||
29 | 1 | public function getMedia() |
|
30 | { |
||
31 | 1 | return $this->media; |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * Set media |
||
36 | * |
||
37 | * @param Media $media |
||
38 | * |
||
39 | * @return AudioPagePart |
||
40 | */ |
||
41 | 1 | public function setMedia($media) |
|
42 | { |
||
43 | 1 | $this->media = $media; |
|
44 | |||
45 | 1 | return $this; |
|
46 | } |
||
47 | |||
48 | /** |
||
49 | * @return string |
||
50 | */ |
||
51 | 1 | public function __toString() |
|
52 | { |
||
53 | 1 | if ($this->getMedia()) { |
|
54 | 1 | return $this->getMedia()->getUrl(); |
|
55 | } |
||
56 | |||
57 | 1 | return ''; |
|
58 | } |
||
59 | |||
60 | /** |
||
61 | * @return string |
||
62 | */ |
||
63 | 1 | public function getDefaultView() |
|
64 | { |
||
65 | 1 | return 'KunstmaanMediaPagePartBundle:AudioPagePart:view.html.twig'; |
|
66 | } |
||
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | 1 | public function getDefaultAdminType() |
|
72 | { |
||
73 | 1 | return AudioPagePartAdminType::class; |
|
74 | } |
||
75 | } |
||
76 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.