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

Transformer::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 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