Code Duplication    Length = 31-32 lines in 2 locations

sources/lib/Converter/Geometry/PgBox.php 1 location

@@ 27-57 (lines=31) @@
24
 * @license X11 {@link http://opensource.org/licenses/mit-license.php}
25
 * @see ConverterInterface
26
 */
27
class PgBox extends TypeConverter
28
{
29
    /**
30
     * getTypeClassName
31
     *
32
     * @see TypeConverter
33
     */
34
    public function getTypeClassName()
35
    {
36
        return '\PommProject\Foundation\Converter\Type\Box';
37
    }
38
39
    /**
40
     * toPg
41
     *
42
     * @see ConverterInterface
43
     */
44
    public function toPg($data, $type, Session $session)
45
    {
46
        if ($data === null) {
47
            return sprintf("NULL::%s", $type);
48
        }
49
50
        $data = $this->checkData($data);
51
52
        return sprintf(
53
            "box%s",
54
            (string)$data
55
        );
56
    }
57
}
58

sources/lib/Converter/Geometry/PgPoint.php 1 location

@@ 27-58 (lines=32) @@
24
 * @license X11 {@link http://opensource.org/licenses/mit-license.php}
25
 * @see ConverterInterface
26
 */
27
class PgPoint extends TypeConverter
28
{
29
    /**
30
     * getTypeClassName
31
     *
32
     * @see TypeConverter
33
     */
34
    public function getTypeClassName()
35
    {
36
        return '\PommProject\Foundation\Converter\Type\Point';
37
    }
38
39
    /**
40
     * toPg
41
     *
42
     * @see ConverterInterface
43
     */
44
    public function toPg($data, $type, Session $session)
45
    {
46
        if ($data === null) {
47
            return sprintf("NULL::%s", $type);
48
        }
49
50
        $data = $this->checkData($data);
51
52
        return sprintf(
53
            "point(%s,%s)",
54
            $data->x,
55
            $data->y
56
        );
57
    }
58
}
59