Completed
Pull Request — 5.6 (#2830)
by Jeroen
14:14
created

Entity/PageParts/AbstractFormPagePart.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\FormBundle\Entity\PageParts;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Kunstmaan\FormBundle\Entity\FormAdaptorInterface;
7
use Kunstmaan\PagePartBundle\Entity\AbstractPagePart;
8
use Kunstmaan\UtilitiesBundle\Helper\ClassLookup;
9
use Symfony\Component\Validator\Constraints as Assert;
10
11
/**
12
 * Abstract version of a form page part
13
 */
14
abstract class AbstractFormPagePart extends AbstractPagePart implements FormAdaptorInterface
15
{
16
    /**
17
     * The label
18
     *
19
     * @ORM\Column(type="string")
20
     * @Assert\NotBlank()
21
     */
22
    protected $label;
23
24
    /**
25
     * Returns a unique id for the current page part
26
     *
27
     * @return string
28
     */
29 7
    public function getUniqueId()
30
    {
31 7
        return  str_replace('\\', '', ClassLookup::getClass($this)) . $this->id; //TODO
32
    }
33
34
    /**
35
     * Set the label used for this page part
36
     *
37
     * @param int $label
38
     *
39
     * @return AbstractFormPagePart
40
     */
41 6
    public function setLabel($label)
42
    {
43 6
        $this->label = $label;
44
45 6
        return $this;
46
    }
47
48
    /**
49
     * Get the label used for this page part
50
     *
51
     * @return string
0 ignored issues
show
Should the return type not be integer?

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...
52
     */
53 13
    public function getLabel()
54
    {
55 13
        return $this->label;
56
    }
57
58
    /**
59
     * Returns the view used in the backend
60
     *
61
     * @return string
62
     */
63 1
    public function getAdminView()
64
    {
65 1
        return '@KunstmaanForm/AbstractFormPagePart/admin-view.html.twig';
66
    }
67
}
68