-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathParameter.php
71 lines (57 loc) · 1.32 KB
/
Parameter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
namespace rtens\domin;
use watoki\reflect\Type;
class Parameter {
/** @var string */
private $name;
/** @var Type */
private $type;
/** @var boolean */
private $required;
/** @var string */
private $description = null;
public function __construct($name, Type $type, $required = false) {
$this->name = $name;
$this->required = $required;
$this->type = $type;
}
/**
* @return string
*/
public function getName() {
return $this->name;
}
/**
* @return string|null
*/
public function getDescription() {
return $this->description;
}
/**
* @param string $description
* @return static
*/
public function setDescription($description) {
$this->description = $description;
return $this;
}
/**
* @return boolean
*/
public function isRequired() {
return $this->required;
}
/**
* @return Type
*/
public function getType() {
return $this->type;
}
public function __toString() {
return $this->name . ':' . $this->type;
}
public function withType(Type $type) {
return (new Parameter($this->getName(), $type, $this->isRequired()))
->setDescription($this->getDescription());
}
}