| 1 | <?php |
||
| 13 | abstract class BaseGenerator implements Generator |
||
| 14 | { |
||
| 15 | |||
| 16 | use Namespaces, UsesDisk; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | private $suite; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var string |
||
| 25 | */ |
||
| 26 | private $template; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var TemplateFactoryInterface |
||
| 30 | */ |
||
| 31 | private $factory; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var array |
||
| 35 | */ |
||
| 36 | protected $settings; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * BaseGenerator constructor. |
||
| 40 | * |
||
| 41 | * @param string $suite |
||
| 42 | * @param string $template |
||
| 43 | */ |
||
| 44 | public function __construct(string $suite, string $template) |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return TemplateInterface |
||
| 53 | */ |
||
| 54 | final public function getTemplate() : TemplateInterface |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | final protected function getSuite() : string |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @return string |
||
| 69 | */ |
||
| 70 | public function produce() : string |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @return string |
||
| 77 | */ |
||
| 78 | protected function getNamespaceForTest() : string |
||
| 82 | |||
| 83 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: