| Conditions | 1 |
| Paths | 1 |
| Total Lines | 37 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | #!/bin/php |
||
| 19 | function demonstrate() |
||
|
|
|||
| 20 | { |
||
| 21 | //----begin of factories |
||
| 22 | $interfaceFactory = $this->getInterfaceGeneratorFactory(); |
||
| 23 | $documentationFactory = $this->getDocumentationGeneratorFactory(); |
||
| 24 | $methodFactory = $this->getMethodGeneratorFactory(); |
||
| 25 | //----end of factories |
||
| 26 | |||
| 27 | //----begin of generators |
||
| 28 | $interface = $interfaceFactory->create(); |
||
| 29 | $method = $methodFactory->create(); |
||
| 30 | //----end of generators |
||
| 31 | |||
| 32 | //----begin content creation |
||
| 33 | $interface->setDocumentation($documentationFactory->create()); |
||
| 34 | $interface->setName('FooInterface'); |
||
| 35 | $interface->setNamespace('My\\Example'); |
||
| 36 | $interface->addExtends('BarInterface', true); |
||
| 37 | |||
| 38 | $method->setDocumentation($documentationFactory->create()); |
||
| 39 | $method->setName('foo'); |
||
| 40 | $method->markAsHasNoBody(); |
||
| 41 | $method->markAsPublic(); |
||
| 42 | $method->getDocumentation() |
||
| 43 | ->setReturn('string'); |
||
| 44 | //----end content creation |
||
| 45 | |||
| 46 | //----begin of interface generation |
||
| 47 | $interface->addMethod($method); |
||
| 48 | //----end of interface generation |
||
| 49 | |||
| 50 | //----begin of output |
||
| 51 | echo 'generated content' . PHP_EOL; |
||
| 52 | echo '----' . PHP_EOL; |
||
| 53 | echo $interface->generate() . PHP_EOL; |
||
| 54 | //----end of output |
||
| 55 | } |
||
| 56 | } |
||
| 60 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.