Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Code / Generator / AbstractGenerator.php
blob0ad7c081dd1230ca26205d14dc9a663842a9b068
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Code\Generator;
12 use Traversable;
14 abstract class AbstractGenerator implements GeneratorInterface
16 /**
17 * Line feed to use in place of EOL
19 const LINE_FEED = "\n";
21 /**
22 * @var bool
24 protected $isSourceDirty = true;
26 /**
27 * @var int|string 4 spaces by default
29 protected $indentation = ' ';
31 /**
32 * @var string
34 protected $sourceContent = null;
36 /**
37 * @param array $options
39 public function __construct($options = array())
41 if ($options) {
42 $this->setOptions($options);
46 /**
47 * @param bool $isSourceDirty
48 * @return AbstractGenerator
50 public function setSourceDirty($isSourceDirty = true)
52 $this->isSourceDirty = (bool) $isSourceDirty;
53 return $this;
56 /**
57 * @return bool
59 public function isSourceDirty()
61 return $this->isSourceDirty;
64 /**
65 * @param string $indentation
66 * @return AbstractGenerator
68 public function setIndentation($indentation)
70 $this->indentation = (string) $indentation;
71 return $this;
74 /**
75 * @return string
77 public function getIndentation()
79 return $this->indentation;
82 /**
83 * @param string $sourceContent
84 * @return AbstractGenerator
86 public function setSourceContent($sourceContent)
88 $this->sourceContent = (string) $sourceContent;
89 return $this;
92 /**
93 * @return string
95 public function getSourceContent()
97 return $this->sourceContent;
101 * @param array|Traversable $options
102 * @throws Exception\InvalidArgumentException
103 * @return AbstractGenerator
105 public function setOptions($options)
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))
115 foreach ($options as $optionName => $optionValue) {
116 $methodName = 'set' . $optionName;
117 if (method_exists($this, $methodName)) {
118 $this->{$methodName}($optionValue);
122 return $this;