FromComponentTrait::from()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
/**
4
 * This file is part of UnderQuery package.
5
 *
6
 * Copyright (c) 2016 Beniamin Jonatan Šimko
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Phuria\UnderQuery\QueryBuilder\Component;
13
14
use Phuria\UnderQuery\Table\AbstractTable;
15
16
/**
17
 * @author Beniamin Jonatan Šimko <[email protected]>
18
 */
19
trait FromComponentTrait
20
{
21
    /**
22
     * @param mixed       $table
23
     * @param string|null $alias
24
     *
25
     * @return AbstractTable
26
     */
27
    abstract public function addRootTable($table, $alias = null);
28
29
    /**
30
     * @param mixed       $table
31
     * @param string|null $alias
32
     *
33
     * @return AbstractTable
34
     */
35 1
    public function from($table, $alias = null)
36
    {
37 1
        return $this->addFrom($table, $alias);
38
    }
39
40
    /**
41
     * @param mixed       $table
42
     * @param string|null $alias
43
     *
44
     * @return AbstractTable
45
     */
46 1
    public function addFrom($table, $alias = null)
47
    {
48 1
        return $this->addRootTable($table, $alias);
49
    }
50
}