QueryTrait::getTagOfGroup()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of the Tinyissue package.
5
 *
6
 * (c) Mohamed Alsharaf <[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
12
namespace Tinyissue\Model\Traits\Project\Issue;
13
14
use Tinyissue\Model\Tag;
15
16
/**
17
 * QueryTrait is trait class containing the database queries methods for the Project|Issue model.
18
 *
19
 * @author Mohamed Alsharaf <[email protected]>
20
 *
21
 * @property static $this
22
 */
23
trait QueryTrait
24
{
25
    /**
26
     * Returns the status tag.
27
     *
28
     * @return Tag
29
     */
30 1
    public function getStatusTag()
31
    {
32 1
        return $this->getTagOfGroup(Tag::GROUP_STATUS);
33
    }
34
35
    /**
36
     * Returns the type tag.
37
     *
38
     * @return Tag
39
     */
40
    public function getTypeTag()
41
    {
42
        return $this->getTagOfGroup(Tag::GROUP_TYPE);
43
    }
44
45
    /**
46
     * Returns the resolution tag.
47
     *
48
     * @return Tag
49
     */
50 1
    public function getResolutionTag()
51
    {
52 1
        return $this->getTagOfGroup(Tag::GROUP_RESOLUTION);
53
    }
54
55
    /**
56
     * Return tag by it group name.
57
     *
58
     * @param string $group
59
     *
60
     * @return Tag
61
     */
62 1
    protected function getTagOfGroup($group)
63
    {
64 1
        return $this->tags
0 ignored issues
show
Bug introduced by
The property tags does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
65 1
            ->where('parent.name', $group)
66 1
            ->first();
67
    }
68
}
69