Code Duplication    Length = 11-17 lines in 6 locations

src/StringFilter/BreakTagToNewlineStringFilter.php 1 location

@@ 5-21 (lines=17) @@
2
3
namespace CultuurNet\UDB3\StringFilter;
4
5
class BreakTagToNewlineStringFilter implements StringFilterInterface
6
{
7
    /**
8
     * @param string $string
9
     * @return string
10
     */
11
    public function filter($string)
12
    {
13
        if (!is_string($string)) {
14
            throw new \InvalidArgumentException(
15
                'Argument should be string, got ' . gettype($string) . ' instead.'
16
            );
17
        }
18
19
        return preg_replace('@<br ?/?>@', "\n", $string);
20
    }
21
}
22

src/StringFilter/NewlineToSpaceStringFilter.php 1 location

@@ 5-19 (lines=15) @@
2
3
namespace CultuurNet\UDB3\StringFilter;
4
5
class NewlineToSpaceStringFilter implements StringFilterInterface
6
{
7
    /**
8
     * @param string $string
9
     * @return string
10
     */
11
    public function filter($string)
12
    {
13
        if (!is_string($string)) {
14
            throw new \InvalidArgumentException('Argument should be string, got ' . gettype($string) . ' instead.');
15
        }
16
17
        return preg_replace("/[\\r\\n]+/", " ", $string);
18
    }
19
}
20

src/StringFilter/StripLeadingSpaceStringFilter.php 1 location

@@ 5-19 (lines=15) @@
2
3
namespace CultuurNet\UDB3\StringFilter;
4
5
class StripLeadingSpaceStringFilter implements StringFilterInterface
6
{
7
    /**
8
     * @param string $string
9
     * @return string
10
     */
11
    public function filter($string)
12
    {
13
        if (!is_string($string)) {
14
            throw new \InvalidArgumentException('Argument should be string, got ' . gettype($string) . ' instead.');
15
        }
16
17
        return preg_replace('/^[ \t]+/m', "", $string);
18
    }
19
}
20

src/StringFilter/StripNewlineStringFilter.php 1 location

@@ 5-19 (lines=15) @@
2
3
namespace CultuurNet\UDB3\StringFilter;
4
5
class StripNewlineStringFilter implements StringFilterInterface
6
{
7
    /**
8
     * @param string $string
9
     * @return string
10
     */
11
    public function filter($string)
12
    {
13
        if (!is_string($string)) {
14
            throw new \InvalidArgumentException('Argument should be string, got ' . gettype($string) . ' instead.');
15
        }
16
17
        return preg_replace("/[\\r\\n]+/", "", $string);
18
    }
19
}
20

src/StringFilter/StripSourceStringFilter.php 1 location

@@ 6-16 (lines=11) @@
3
4
namespace CultuurNet\UDB3\StringFilter;
5
6
class StripSourceStringFilter implements StringFilterInterface
7
{
8
    public function filter($string)
9
    {
10
        if (!is_string($string)) {
11
            throw new \InvalidArgumentException('Argument should be string, got ' . gettype($string) . ' instead.');
12
        }
13
14
        return preg_replace('@<p class="uiv-source">.*?</p>@', '', $string);
15
    }
16
}
17

src/StringFilter/StripTrailingSpaceStringFilter.php 1 location

@@ 5-19 (lines=15) @@
2
3
namespace CultuurNet\UDB3\StringFilter;
4
5
class StripTrailingSpaceStringFilter implements StringFilterInterface
6
{
7
    /**
8
     * @param string $string
9
     * @return string
10
     */
11
    public function filter($string)
12
    {
13
        if (!is_string($string)) {
14
            throw new \InvalidArgumentException('Argument should be string, got ' . gettype($string) . ' instead.');
15
        }
16
17
        return preg_replace('/[ \t]+$/m', "", $string);
18
    }
19
}
20