Completed
Push — master ( 638800...17312a )
by Mario
03:27
created

WorkspaceProjects::__construct()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 4.0218

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 16
ccs 8
cts 9
cp 0.8889
rs 9.2
cc 4
eloc 8
nc 8
nop 1
crap 4.0218
1
<?php
2
3
namespace Marek\Toggable\API\Http\Request\Workspace;
4
5
/**
6
 * Class WorkspaceProjects
7
 * @package Marek\Toggable\API\Http\Request\Workspace
8
 *
9
 * @property-read boolean $active
10
 * @property-read boolean $actualHours
11
 * @property-read boolean $onlyTemplates
12
 */
13
class WorkspaceProjects extends Workspace
14
{
15
    /**
16
     * @var string
17
     */
18
    public $uri = 'workspaces/{workspace_id}/projects?active={active}&actual_hours={actual_hours}&only_templates={only_templates}';
19
20
    /**
21
     * @var boolean
22
     */
23
    public $active = true;
24
25
    /**
26
     * @var boolean
27
     */
28
    public $actualHours = false;
29
30
    /**
31
     * @var boolean
32
     */
33
    public $onlyTemplates = false;
34
35
    /**
36
     * WorkspaceProjects constructor.
37
     *
38
     * @param array $properties
39
     */
40 5
    public function __construct(array $properties)
41
    {
42 5
        parent::__construct($properties);
43
44 5
        if ($this->active === false) {
45
            $this->uri = str_replace('{active}', 'false', $this->uri);
46
        }
47
48 5
        if ($this->actualHours === true) {
49 5
            $this->uri = str_replace('{actual_hours}', 'true', $this->uri);
50
        }
51
52 5
        if ($this->onlyTemplates === true) {
53 5
            $this->uri = str_replace('{only_templates}', 'true', $this->uri);
54
        }
55 5
    }
56
}
57