Passed
Push — master ( 82b0d0...1ac70f )
by Bobby
09:15
created

Transformer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 2
b 0
f 0
dl 0
loc 31
ccs 6
cts 6
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A stripHtml() 0 3 1
A get() 0 3 1
A __toString() 0 3 1
1
<?php
2
3
namespace Ballen\Linguist\Transformers;
4
5
/**
6
 * Linguist
7
 *
8
 * Linguist is a PHP library for parsing strings, it can extract and manipulate
9
 *  prefixed words in content ideal for working with @mentions, #topics and
10
 *  even custom action tags!
11
 *
12
 * @author Bobby Allen <[email protected]>
13
 * @license http://www.gnu.org/licenses/gpl-3.0.html
14
 * @link https://github.com/allebb/linguist
15
 * @link http://www.bobbyallen.me
16
 *
17
 */
18
abstract class Transformer
19
{
20
21
    const URL_REGEX = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
22
23
    /**
24
     * Strips HTML tags from the given string.
25
     * @param string $message The string that does/may contain HTML tags.
26
     * @return string
27
     */
28 18
    protected function stripHtml($message)
29
    {
30 18
        return strip_tags($message);
31
    }
32
33
    /**
34
     * Retrieves the formatted text.
35
     * @return string
36
     */
37 18
    public function get()
38
    {
39 18
        return $this->formatted;
40
    }
41
42
    /**
43
     * Default __toString() method to return the formatted text.
44
     * @return string
45
     */
46 18
    public function __toString()
47
    {
48 18
        return $this->get();
49
    }
50
}
51