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

Entity/Rule/AfterXScrollPercentRule.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\LeadGenerationBundle\Entity\Rule;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Kunstmaan\LeadGenerationBundle\Form\Rule\AfterXScrollPercentRuleAdminType;
7
use Symfony\Component\Validator\Constraints as Assert;
8
9
/**
10
 * @ORM\Entity
11
 * @ORM\Table(name="kuma_rule_after_x_scroll_percent")
12
 */
13
class AfterXScrollPercentRule extends AbstractRule
14
{
15
    /**
16
     * @var int
17
     * @ORM\Column(type="integer")
18
     * @Assert\NotBlank()
19
     * @Assert\Range(
20
     *      min = 0,
21
     *      max = 100
22
     * )
23
     */
24
    private $percentage;
25
26
    /**
27
     * @return int
28
     */
29 1
    public function getPercentage()
30
    {
31 1
        return $this->percentage;
32
    }
33
34
    /**
35
     * @param int $percentage
36
     *
37
     * @return AfterXScrollPercent
0 ignored issues
show
Should the return type not be AfterXScrollPercentRule?

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...
38
     */
39 1
    public function setPercentage($percentage)
40
    {
41 1
        $this->percentage = $percentage;
42
43 1
        return $this;
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     */
49 1
    public function getJsObjectClass()
50
    {
51 1
        return 'AfterXScrollPercentRule';
52
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 1
    public function getJsProperties()
58
    {
59
        return [
60 1
            'percentage' => $this->getPercentage(),
61
        ];
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67 1
    public function getJsFilePath()
68
    {
69 1
        return '/bundles/kunstmaanleadgeneration/js/rule/AfterXScrollPercentRule.js';
70
    }
71
72
    /**
73
     * @return string
74
     */
75 1
    public function getAdminType()
76
    {
77 1
        return AfterXScrollPercentRuleAdminType::class;
78
    }
79
}
80