QueryTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 80%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 4
c 3
b 1
f 0
lcom 1
cbo 0
dl 0
loc 46
ccs 8
cts 10
cp 0.8
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getStatusTag() 0 4 1
A getTypeTag() 0 4 1
A getResolutionTag() 0 4 1
A getTagOfGroup() 0 6 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