| Total Complexity | 9 |
| Total Lines | 70 |
| Duplicated Lines | 0 % |
| Coverage | 58.33% |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class PhpClassProperty extends PhpTemplate |
||
| 11 | { |
||
| 12 | use Visibility; |
||
| 13 | use StaticFlag; |
||
| 14 | |||
| 15 | /** @var PhpNamedVar */ |
||
| 16 | private $namedVar; |
||
| 17 | |||
| 18 | 11 | public function __construct($name, PhpAnyType $type = null, $visibility = PhpFlags::VIS_PUBLIC) |
|
| 19 | { |
||
| 20 | 11 | $this->namedVar = new PhpNamedVar($name, $type); |
|
| 21 | 11 | $this->visibility = $visibility; |
|
| 22 | 11 | } |
|
| 23 | |||
| 24 | /** |
||
| 25 | * @param mixed $value |
||
| 26 | * @return $this |
||
| 27 | */ |
||
| 28 | public function setDefault($value) |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return $this |
||
| 36 | */ |
||
| 37 | public function clearDefault() |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return PhpNamedVar |
||
| 45 | */ |
||
| 46 | 5 | public function getNamedVar() |
|
| 47 | { |
||
| 48 | 5 | return $this->namedVar; |
|
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @param PhpNamedVar $namedVar |
||
| 53 | * @return PhpClassProperty |
||
| 54 | */ |
||
| 55 | public function setNamedVar($namedVar) |
||
| 56 | { |
||
| 57 | $this->namedVar = $namedVar; |
||
| 58 | return $this; |
||
| 59 | } |
||
| 60 | |||
| 61 | 3 | public function setDescription($description) |
|
| 62 | { |
||
| 63 | 3 | $this->namedVar->setDescription($description); |
|
| 64 | 3 | return $this; |
|
| 65 | } |
||
| 66 | |||
| 67 | 11 | private function renderPhpDoc() |
|
| 68 | { |
||
| 69 | 11 | if ($tagValue = $this->namedVar->renderPhpDocValue()) { |
|
| 70 | 11 | return (new PhpDocTag(PhpDoc::TAG_VAR, $tagValue)) . "\n"; |
|
| 71 | } |
||
| 72 | |||
| 73 | return ''; |
||
| 74 | } |
||
| 75 | |||
| 76 | 11 | protected function toString() |
|
| 80 | |||
| 81 | |||
| 82 | PHP; |
||
| 83 | |||
| 84 | } |
||
| 85 | } |