| Conditions | 4 |
| Paths | 3 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 49 | public function generate() |
||
| 50 | { |
||
| 51 | if ($this->canBeGenerated()) { |
||
| 52 | $this->resetContent(); |
||
| 53 | $name = $this->getGeneratorProperty('name'); |
||
| 54 | $value = $this->getGeneratorProperty('value'); |
||
| 55 | |||
| 56 | if (is_null($name) |
||
| 57 | || is_null($value)) { |
||
| 58 | throw new RuntimeException('name and value are mandatory'); |
||
| 59 | } |
||
| 60 | |||
| 61 | $block = $this->getBlockGenerator(); |
||
| 62 | |||
| 63 | $block->add('const ' . $name . ' = ' . $value . ';'); |
||
| 64 | $this->addContent($block); |
||
| 65 | } |
||
| 66 | |||
| 67 | return $this->generateStringFromContent(); |
||
| 68 | } |
||
| 69 | } |