HousesDatabaseQuery::building()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace GeoFixer\models\queries;
4
5
/**
6
 * Class HousesDatabaseQuery
7
 *
8
 * @package GeoFixer\models\queries
9
 */
10
class HousesDatabaseQuery extends AbstractDatabaseQuery
11
{
12
    /**
13
     * RegionsDatabaseQuery constructor.
14
     */
15 6
    public function __construct()
16
    {
17 6
        parent::__construct();
18 6
    }
19
20
    /**
21
     * Получаем дома
22
     *
23
     * @return $this
24
     */
25 6
    public function getHouses()
26
    {
27 6
        $this->db = $this->db->select(['house_id', 'number'])->from('fias_house');
28
29 6
        return $this;
30
    }
31
32
    /**
33
     * Address ID равен
34
     *
35
     * @param $street_id
36
     *
37
     * @return $this
38
     */
39 6
    public function addressId($street_id)
40
    {
41 6
        $this->db = $this->db->andWhere([self::FIAS_CODE  => $street_id]);
42
43 6
        return $this;
44
    }
45
46
    /**
47
     * Номер дома равен
48
     *
49
     * @param $number
50
     *
51
     * @return $this
52
     */
53 5
    public function houseNumber($number)
54
    {
55 5
        $this->db = $this->db->andWhere(['number' => $number]);
56
57 5
        return $this;
58
    }
59
60
    /**
61
     * Номер корпуса равен
62
     *
63
     * @param $building
64
     *
65
     * @return $this
66
     */
67 3
    public function building($building)
68
    {
69 3
        $this->db = $this->db->andWhere(['building' => $building]);
70
71 3
        return $this;
72
    }
73
}
74