Code Duplication    Length = 8-9 lines in 2 locations

src/TextExtension.php 2 locations

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