Code Duplication    Length = 31-31 lines in 2 locations

src/Cdb/Description/LongDescription.php 1 location

@@ 8-38 (lines=31) @@
5
use CultuurNet\UDB3\StringFilter\StringFilterInterface;
6
use ValueObjects\StringLiteral\StringLiteral;
7
8
class LongDescription extends StringLiteral
9
{
10
    /**
11
     * @var StringFilterInterface
12
     */
13
    private static $cdbXmlToJsonLdFilter;
14
15
    /**
16
     * @param string $longDescriptionAsString
17
     * @return LongDescription
18
     */
19
    public static function fromCdbXmlToJsonLdFormat($longDescriptionAsString)
20
    {
21
        $cdbXmlToJsonLdFilter = self::getCdbXmlToJsonLdFilter();
22
23
        return new LongDescription(
24
            $cdbXmlToJsonLdFilter->filter($longDescriptionAsString)
25
        );
26
    }
27
28
    /**
29
     * @return StringFilterInterface
30
     */
31
    private static function getCdbXmlToJsonLdFilter()
32
    {
33
        if (!isset(self::$cdbXmlToJsonLdFilter)) {
34
            self::$cdbXmlToJsonLdFilter = new CdbXmlLongDescriptionToJsonLdFilter();
35
        }
36
        return self::$cdbXmlToJsonLdFilter;
37
    }
38
}
39

src/Cdb/Description/ShortDescription.php 1 location

@@ 8-38 (lines=31) @@
5
use CultuurNet\UDB3\StringFilter\StringFilterInterface;
6
use ValueObjects\StringLiteral\StringLiteral;
7
8
class ShortDescription extends StringLiteral
9
{
10
    /**
11
     * @var StringFilterInterface
12
     */
13
    private static $cdbXmlToJsonLdFilter;
14
15
    /**
16
     * @param string $shortDescriptionAsString
17
     * @return ShortDescription
18
     */
19
    public static function fromCdbXmlToJsonLdFormat($shortDescriptionAsString)
20
    {
21
        $cdbXmlToJsonLdFilter = self::getCdbXmlToJsonLdFilter();
22
23
        return new ShortDescription(
24
            $cdbXmlToJsonLdFilter->filter($shortDescriptionAsString)
25
        );
26
    }
27
28
    /**
29
     * @return StringFilterInterface
30
     */
31
    private static function getCdbXmlToJsonLdFilter()
32
    {
33
        if (!isset(self::$cdbXmlToJsonLdFilter)) {
34
            self::$cdbXmlToJsonLdFilter = new CdbXmlShortDescriptionToJsonLdFilter();
35
        }
36
        return self::$cdbXmlToJsonLdFilter;
37
    }
38
}
39