Column   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 86
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 86
rs 10
c 0
b 0
f 0
wmc 7
lcom 1
cbo 1

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getWrapped() 0 4 1
A getQualifiedName() 0 4 1
A getTable() 0 4 1
A getName() 0 4 1
A getMapping() 0 4 1
A getWeight() 0 4 1
1
<?php
2
3
namespace Sofa\Eloquence\Searchable;
4
5
use Illuminate\Database\Grammar;
6
7
class Column
8
{
9
    /** @var \Illuminate\Database\Grammar */
10
    protected $grammar;
11
12
    /** @var string */
13
    protected $table;
14
15
    /** @var string */
16
    protected $name;
17
18
    /** @var string */
19
    protected $mapping;
20
21
    /** @var integer */
22
    protected $weight;
23
24
    /**
25
     * Create new searchable column instance.
26
     *
27
     * @param string  $table
28
     * @param string  $name
29
     * @param string  $mapping
30
     * @param integer $weight
31
     */
32
    public function __construct(Grammar $grammar, $table, $name, $mapping, $weight = 1)
33
    {
34
        $this->grammar = $grammar;
35
        $this->table   = $table;
36
        $this->name    = $name;
37
        $this->mapping = $mapping;
38
        $this->weight  = $weight;
39
    }
40
41
    /**
42
     * Get qualified name wrapped by the grammar.
43
     *
44
     * @return string
45
     */
46
    public function getWrapped()
47
    {
48
        return $this->grammar->wrap($this->getQualifiedName());
49
    }
50
51
    /**
52
     * Get column name with table prefix.
53
     *
54
     * @return string
55
     */
56
    public function getQualifiedName()
57
    {
58
        return $this->getTable().'.'.$this->getName();
59
    }
60
61
    /**
62
     * @return string
63
     */
64
    public function getTable()
65
    {
66
        return $this->table;
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    public function getName()
73
    {
74
        return $this->name;
75
    }
76
77
    /**
78
     * @return string
79
     */
80
    public function getMapping()
81
    {
82
        return $this->mapping;
83
    }
84
85
    /**
86
     * @return integer
87
     */
88
    public function getWeight()
89
    {
90
        return $this->weight;
91
    }
92
}
93