WordFormatter::wrap()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 2
eloc 4
nc 2
nop 4
1
<?php
2
3
/*
4
 * This file is part of the Word wrap helper
5
 *
6
 * (c) Nexuslink Services
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WordWrapHelper;
13
14
class WordFormatter {    
15
16
    /**
17
     * @param string $content     
18
     * @param int    $width [Optional]
19
     * @param string $break [Optional]
20
     * @param bool   $cut [Optional]
21
     * 
22
     * @return string
23
     */
24
    public function wrap($content, $width = 75, $break = "\n", $cut = false) {
25
26
        if(!empty($content))
27
        {
28
            return wordwrap($content, $width, $break, $cut);
29
        }
30
        
31
        return $content;
32
    }
33
    
34
}