@@ -8,62 +8,55 @@ Zend\Code\Generator Reference
8
8
Abstract Classes and Interfaces
9
9
-------------------------------
10
10
11
- .. _zend.code.generator.reference.abstracts.abstract :
11
+ .. _zend.code.generator.reference.interface.generator :
12
12
13
- Zend\C ode\G enerator\A bstractGenerator
14
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^
13
+ Zend\C ode\G enerator\G eneratorInterface
14
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15
15
16
- The base class from which all CodeGenerator classes inherit provides the minimal functionality necessary. It's
16
+ The base interface from which all CodeGenerator classes implement provides the minimal functionality necessary. It's
17
17
*API * is as follows:
18
18
19
19
.. code-block :: php
20
20
:linenos:
21
21
22
- abstract class Zend\Code\Generator\AbstractGenerator
22
+ interface Zend\Code\Generator\GeneratorInterface
23
23
{
24
- final public function __construct(Array $options = array())
25
- public function setOptions(Array $options)
26
- public function setSourceContent($sourceContent)
27
- public function getSourceContent()
28
- protected function _init()
29
- protected function _prepare()
30
- abstract public function generate();
31
- final public function __toString()
24
+ public function generate();
32
25
}
33
26
34
- The constructor first calls ``_init() `` (which is left empty for the concrete extending class to implement), then
35
- passes the ``$options `` parameter to ``setOptions() ``, and finally calls ``_prepare() `` (again, to be implemented
36
- by an extending class).
37
-
38
- Like most classes in Zend Framework, ``setOptions() `` compares an option key to existing setters in the class, and
39
- passes the value on to that method if found.
40
-
41
- ``__toString() `` is marked as final, and proxies to ``generate() ``.
42
-
43
- ``setSourceContent() `` and ``getSourceContent() `` are intended to either set the default content for the code being
44
- generated, or to replace said content once all generation tasks are complete.
45
-
46
27
.. _zend.code.generator.reference.abstracts.abstract :
47
28
48
29
Zend\C ode\G enerator\A bstractGenerator
49
30
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50
31
51
- ``Zend\Code\Generator\AbstractGenerator `` extends ``Zend\Code\Generator\AbstractGenerator ``, and adds some properties for tracking
32
+ ``Zend\Code\Generator\AbstractGenerator `` implements ``Zend\Code\Generator\GeneratorInterface ``, and adds some properties for tracking
52
33
whether content has changed as well as the amount of indentation that should appear before generated content. Its
53
34
*API * is as follows:
54
35
55
36
.. code-block :: php
56
37
:linenos:
57
38
58
39
abstract class Zend\Code\Generator\AbstractGenerator
59
- extends Zend\Code\Generator\AbstractGenerator
40
+ implements Zend\Code\Generator\GeneratorInterface
60
41
{
42
+ public function __construct(Array|Traversable $options = array())
43
+ public function setOptions(Array $options)
44
+ public function setSourceContent($sourceContent)
45
+ public function getSourceContent()
61
46
public function setSourceDirty($isSourceDirty = true)
62
47
public function isSourceDirty()
63
48
public function setIndentation($indentation)
64
49
public function getIndentation()
65
50
}
66
51
52
+ The constructor passes the ``$options `` parameter to ``setOptions() ``.
53
+
54
+ Like most classes in Zend Framework, ``setOptions() `` compares an option key to existing setters in the class, and
55
+ passes the value on to that method if found.
56
+
57
+ ``setSourceContent() `` and ``getSourceContent() `` are intended to either set the default content for the code being
58
+ generated, or to replace said content once all generation tasks are complete.
59
+
67
60
.. _zend.code.generator.reference.abstracts.member-abstract :
68
61
69
62
Zend\C ode\G enerator\A bstractMemberGenerator
0 commit comments