SanitizeAwareTrait::setSanitize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
/**
3
 * Webino (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino/WebinoI18nSanitizeLib for the canonical source repository
6
 * @copyright   Copyright (c) 2017 Webino, s. r. o. (http://webino.sk)
7
 * @author      Peter Bačinský <[email protected]>
8
 * @license     BSD-3-Clause
9
 */
10
11
namespace WebinoI18nSanitizeLib;
12
13
/**
14
 * Trait SanitizeAwareTrait
15
 */
16
trait SanitizeAwareTrait
17
{
18
    /**
19
     * @var Sanitize
20
     */
21
    protected $sanitize;
22
23
    /**
24
     * @return Sanitize
25
     */
26
    public function getSanitize()
27
    {
28
        if (null === $this->sanitize) {
29
            $this->sanitize = new Sanitize;
30
        }
31
        return $this->sanitize;
32
    }
33
34
    /**
35
     * @param Sanitize $sanitize
36
     * @return $this
37
     */
38
    public function setSanitize(Sanitize $sanitize)
39
    {
40
        $this->sanitize = $sanitize;
41
        return $this;
42
    }
43
}
44