Code Duplication    Length = 8-9 lines in 2 locations

src/TextExtension.php 2 locations

@@ 79-87 (lines=9) @@
76
     * @param string $break
77
     * @return string
78
     */
79
    public function less($value, $replace = '...', $break = '<!-- pagebreak -->')
80
    {
81
        if (!isset($value)) {
82
            return null;
83
        }
84
85
        $pos = stripos($value, $break);
86
        return $pos === false ? $value : substr($value, 0, $pos) . $replace;
87
    }
88
89
    /**
90
     * Cut of text if it's to long.
@@ 97-104 (lines=8) @@
94
     * @param string $replace
95
     * @return string
96
     */
97
    public function truncate($value, $length, $replace = '...')
98
    {
99
        if (!isset($value)) {
100
            return null;
101
        }
102
103
        return strlen($value) <= $length ? $value : substr($value, 0, $length - strlen($replace)) . $replace;
104
    }
105
106
    /**
107
     * Linkify a HTTP(S) link.