Code Duplication    Length = 19-19 lines in 4 locations

src/Component/Grid/Column/Type/BooleanType.php 1 location

@@ 43-61 (lines=19) @@
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function render($data, array $options)
44
    {
45
        $boolean = $this->getValue($data, $options);
46
47
        if ($boolean === null) {
48
            return;
49
        }
50
51
        if (!is_bool($boolean)) {
52
            throw new InvalidTypeException(sprintf(
53
                'The "%s" %s column type expects a boolean value, got "%s".',
54
                $options['column']->getName(),
55
                $this->getName(),
56
                is_object($boolean) ? get_class($boolean) : gettype($boolean)
57
            ));
58
        }
59
60
        return $this->renderTemplate($boolean, $options);
61
    }
62
63
    /**
64
     * {@inheritdoc}

src/Component/Grid/Column/Type/DateTimeType.php 1 location

@@ 93-111 (lines=19) @@
90
    /**
91
     * {@inheritdoc}
92
     */
93
    public function render($data, array $options)
94
    {
95
        $dateTime = $this->getValue($data, $options);
96
97
        if ($dateTime === null) {
98
            return;
99
        }
100
101
        if (!$dateTime instanceof \DateTimeInterface) {
102
            throw new InvalidTypeException(sprintf(
103
                'The "%s" %s column type expects a "\DateTimeInterface" value, got "%s".',
104
                $options['column']->getName(),
105
                $this->getName(),
106
                is_object($dateTime) ? get_class($dateTime) : gettype($dateTime)
107
            ));
108
        }
109
110
        return $this->formatter->format($dateTime, $options);
111
    }
112
113
    /**
114
     * {@inheritdoc}

src/Component/Grid/Column/Type/NumberType.php 1 location

@@ 69-87 (lines=19) @@
66
    /**
67
     * {@inheritdoc}
68
     */
69
    public function render($data, array $options)
70
    {
71
        $number = $this->getValue($data, $options);
72
73
        if ($number === null) {
74
            return;
75
        }
76
77
        if (!is_numeric($number)) {
78
            throw new InvalidTypeException(sprintf(
79
                'The "%s" %s column type expects a numeric value, got "%s".',
80
                $options['column']->getName(),
81
                $this->getName(),
82
                is_object($number) ? get_class($number) : gettype($number)
83
            ));
84
        }
85
86
        return $this->formatter->format($number, $options);
87
    }
88
89
    /**
90
     * {@inheritdoc}

src/Component/Grid/Column/Type/TextType.php 1 location

@@ 24-42 (lines=19) @@
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function render($data, array $options)
25
    {
26
        $text = $this->getValue($data, $options);
27
28
        if ($text === null) {
29
            return;
30
        }
31
32
        if (!is_scalar($text)) {
33
            throw new InvalidTypeException(sprintf(
34
                'The "%s" %s column type expects a scalar value, got "%s".',
35
                $options['column']->getName(),
36
                $this->getName(),
37
                is_object($text) ? get_class($text) : gettype($text)
38
            ));
39
        }
40
41
        return $text;
42
    }
43
44
    /**
45
     * {@inheritdoc}