Test Setup Failed
Branch master (0141d3)
by Mathieu
07:06 queued 04:12
created

SearchableTrait::set_searchable_data()   B

Complexity

Conditions 5
Paths 4

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 10
rs 8.8571
cc 5
eloc 6
nc 4
nop 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A SearchableTrait::setSearchProperties() 0 5 1
1
<?php
2
3
namespace Charcoal\Cms;
4
5
use \Charcoal\Translation\TranslationString;
6
7
/**
8
 * Default implementation, as Trait, of the SearchableInterface
9
 */
10
trait SearchableTrait
11
{
12
    /**
13
     * @var array $searchProperties
14
     */
15
    private $searchProperties = [];
16
17
    /**
18
     * @var TranslationString $searchKeywords
19
     */
20
    private $searchKeywords;
21
22
    /**
23
     * @param array $properties The properties to search into.
24
     * @return SearchableInterface Chainable
25
     */
26
    public function setSearchProperties(array $properties)
27
    {
28
        $this->searchProperties = $properties;
29
        return $this;
30
    }
31
32
    /**
33
     * @return array
34
     */
35
    public function searchProperties()
36
    {
37
        return $this->searchProperties;
38
    }
39
40
    /**
41
     * @param mixed $keywords The search keywords (localized).
42
     * @return SearchableInterface Chainable
43
     */
44
    public function setSearchKeywords($keywords)
45
    {
46
        $this->searchKeywords = new TranslationString($keywords);
47
        return $this;
48
    }
49
50
    /**
51
     * @return TranslationString
52
     */
53
    public function searchKeywords()
54
    {
55
        return $this->searchKeywords;
56
    }
57
}
58