Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
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-2015 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 abstract class AbstractGenerator implements GeneratorInterface
015 {
016 /**
017 * Line feed to use in place of EOL
018 */
019 const LINE_FEED = "\n";
020
021 /**
022 * @var bool
023 */
024 protected $isSourceDirty = true;
025
026 /**
027 * @var int|string 4 spaces by default
028 */
029 protected $indentation = ' ';
030
031 /**
032 * @var string
033 */
034 protected $sourceContent = null;
035
036 /**
037 * @param array $options
038 */
039 public function __construct($options = array())
040 {
041 if ($options) {
042 $this->setOptions($options);
043 }
044 }
045
046 /**
047 * @param bool $isSourceDirty
048 * @return AbstractGenerator
049 */
050 public function setSourceDirty($isSourceDirty = true)
051 {
052 $this->isSourceDirty = (bool) $isSourceDirty;
053 return $this;
054 }
055
056 /**
057 * @return bool
058 */
059 public function isSourceDirty()
060 {
061 return $this->isSourceDirty;
062 }
063
064 /**
065 * @param string $indentation
066 * @return AbstractGenerator
067 */
068 public function setIndentation($indentation)
069 {
070 $this->indentation = (string) $indentation;
071 return $this;
072 }
073
074 /**
075 * @return string
076 */
077 public function getIndentation()
078 {
079 return $this->indentation;
080 }
081
082 /**
083 * @param string $sourceContent
084 * @return AbstractGenerator
085 */
086 public function setSourceContent($sourceContent)
087 {
088 $this->sourceContent = (string) $sourceContent;
089 return $this;
090 }
091
092 /**
093 * @return string
094 */
095 public function getSourceContent()
096 {
097 return $this->sourceContent;
098 }
099
100 /**
101 * @param array|Traversable $options
102 * @throws Exception\InvalidArgumentException
103 * @return AbstractGenerator
104 */
105 public function setOptions($options)
106 {
107 if (!is_array($options) && !$options instanceof Traversable) {
108 throw new Exception\InvalidArgumentException(sprintf(
109 '%s expects an array or Traversable object; received "%s"',
110 __METHOD__,
111 (is_object($options) ? get_class($options) : gettype($options))
112 ));
113 }
114
115 foreach ($options as $optionName => $optionValue) {
116 $methodName = 'set' . $optionName;
117 if (method_exists($this, $methodName)) {
118 $this->{$methodName}($optionValue);
119 }
120 }
121
122 return $this;
123 }
124 }
125