NullableTitleTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A setTitle() 0 10 2
1
<?php
2
3
/**
4
 * This file is part of the Axstrad library.
5
 *
6
 * (c) Dan Kempster <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @copyright 2014-2015 Dan Kempster <[email protected]>
12
 */
13
14
namespace Axstrad\Common\Traits;
15
16
/**
17
 * Axstrad\Common\Traits\NullableTitleTrait
18
 *
19
 * @author Dan Kempster <[email protected]>
20
 * @license MIT
21
 * @package Axstrad/Common
22
 * @subpackage Traits
23
 */
24
trait NullableTitleTrait
25
{
26
    use TitleTrait;
27
28
29
    /**
30
     * Set title
31
     *
32
     * @param null|string $title
33
     * @return self
34
     * @see getTitle
35
     */
36
    public function setTitle($title = null)
37
    {
38
        if ($title === null) {
39
            $this->title = null;
40
        }
41
        else {
42
            $this->title = (string) $title;
43
        }
44
        return $this;
45
    }
46
}
47