Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
AbstractGenerator.php
001 <?php
002 /**
003 * Zend Framework (http://framework.zend.com/)
004 *
005 * @link http://github.com/zendframework/zf2 for the canonical source repository
006 * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
007 * @license http://framework.zend.com/license/new-bsd New BSD License
008 */
009
010 namespace Zend\Code\Generator;
011
012 use Traversable;
013
014 use function get_class;
015 use function gettype;
016 use function is_array;
017 use function is_object;
018 use function method_exists;
019 use function sprintf;
020
021 abstract class AbstractGenerator implements GeneratorInterface
022 {
023 /**
024 * Line feed to use in place of EOL
025 */
026 const LINE_FEED = "\n";
027
028 /**
029 * @var bool
030 */
031 protected $isSourceDirty = true;
032
033 /**
034 * @var int|string 4 spaces by default
035 */
036 protected $indentation = ' ';
037
038 /**
039 * @var string
040 */
041 protected $sourceContent;
042
043 /**
044 * @param array $options
045 */
046 public function __construct($options = [])
047 {
048 if ($options) {
049 $this->setOptions($options);
050 }
051 }
052
053 /**
054 * @param bool $isSourceDirty
055 * @return AbstractGenerator
056 */
057 public function setSourceDirty($isSourceDirty = true)
058 {
059 $this->isSourceDirty = (bool) $isSourceDirty;
060 return $this;
061 }
062
063 /**
064 * @return bool
065 */
066 public function isSourceDirty()
067 {
068 return $this->isSourceDirty;
069 }
070
071 /**
072 * @param string $indentation
073 * @return AbstractGenerator
074 */
075 public function setIndentation($indentation)
076 {
077 $this->indentation = (string) $indentation;
078 return $this;
079 }
080
081 /**
082 * @return string
083 */
084 public function getIndentation()
085 {
086 return $this->indentation;
087 }
088
089 /**
090 * @param string $sourceContent
091 * @return AbstractGenerator
092 */
093 public function setSourceContent($sourceContent)
094 {
095 $this->sourceContent = (string) $sourceContent;
096 return $this;
097 }
098
099 /**
100 * @return string
101 */
102 public function getSourceContent()
103 {
104 return $this->sourceContent;
105 }
106
107 /**
108 * @param array|Traversable $options
109 * @throws Exception\InvalidArgumentException
110 * @return AbstractGenerator
111 */
112 public function setOptions($options)
113 {
114 if (! is_array($options) && ! $options instanceof Traversable) {
115 throw new Exception\InvalidArgumentException(sprintf(
116 '%s expects an array or Traversable object; received "%s"',
117 __METHOD__,
118 is_object($options) ? get_class($options) : gettype($options)
119 ));
120 }
121
122 foreach ($options as $optionName => $optionValue) {
123 $methodName = 'set' . $optionName;
124 if (method_exists($this, $methodName)) {
125 $this->{$methodName}($optionValue);
126 }
127 }
128
129 return $this;
130 }
131 }
132