|
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
|
|
|
public function __construct(array $properties) |
|
41
|
|
|
{ |
|
42
|
|
|
parent::__construct($properties); |
|
43
|
|
|
|
|
44
|
|
View Code Duplication |
if ($this->active === true) { |
|
|
|
|
|
|
45
|
|
|
$this->uri = str_replace('{active}', 'true', $this->uri); |
|
46
|
|
|
} else { |
|
47
|
|
|
$this->uri = str_replace('{active}', 'false', $this->uri); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
if ($this->actualHours === true) { |
|
51
|
|
|
$this->uri = str_replace('{actual_hours}', 'true', $this->uri); |
|
52
|
|
|
} else { |
|
53
|
|
|
$this->uri = str_replace('{actual_hours}', 'false', $this->uri); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
if ($this->onlyTemplates === true) { |
|
57
|
|
|
$this->uri = str_replace('{only_templates}', 'true', $this->uri); |
|
58
|
|
|
} else { |
|
59
|
|
|
$this->uri = str_replace('{only_templates}', 'false', $this->uri); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.