Completed
Pull Request — master (#7)
by Markus
06:59
created
src/build/agavi/check/ProjectFilesystemCheck.class.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -43,6 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * Sets the application directory.
44 44
 	 *
45 45
 	 * @param      string The application directory.
46
+	 * @param string $appDirectory
46 47
 	 *
47 48
 	 * @author     Noah Fontes <[email protected]>
48 49
 	 * @since      1.0.0
@@ -69,6 +70,7 @@  discard block
 block discarded – undo
69 70
 	 * Sets the public directory.
70 71
 	 *
71 72
 	 * @param      string The public directory.
73
+	 * @param string $pubDirectory
72 74
 	 *
73 75
 	 * @author     Noah Fontes <[email protected]>
74 76
 	 * @since      1.0.0
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -102,9 +102,9 @@
 block discarded – undo
102 102
 	public function check()
103 103
 	{
104 104
 		$path = $this->getPath();
105
-		if(is_dir($path)) {
106
-			if(is_dir($path . '/' . $this->appDirectory) && is_dir($path . '/' . $this->pubDirectory)) {
107
-				if(file_exists($path . '/' . $this->appDirectory . '/config.php')) {
105
+		if (is_dir($path)) {
106
+			if (is_dir($path . '/' . $this->appDirectory) && is_dir($path . '/' . $this->pubDirectory)) {
107
+				if (file_exists($path . '/' . $this->appDirectory . '/config.php')) {
108 108
 					return true;
109 109
 				}
110 110
 			}
Please login to merge, or discard this patch.
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -29,88 +29,88 @@
 block discarded – undo
29 29
  */
30 30
 class ProjectFilesystemCheck extends FilesystemCheck
31 31
 {
32
-	/**
33
-	 * @var        string The relative path to the project application directory.
34
-	 */
35
-	protected $appDirectory = 'app';
32
+    /**
33
+     * @var        string The relative path to the project application directory.
34
+     */
35
+    protected $appDirectory = 'app';
36 36
 	
37
-	/**
38
-	 * @var        string The relative path to the project public directory.
39
-	 */
40
-	protected $pubDirectory = 'pub';
37
+    /**
38
+     * @var        string The relative path to the project public directory.
39
+     */
40
+    protected $pubDirectory = 'pub';
41 41
 
42
-	/**
43
-	 * Sets the application directory.
44
-	 *
45
-	 * @param      string The application directory.
46
-	 *
47
-	 * @author     Noah Fontes <[email protected]>
48
-	 * @since      1.0.0
49
-	 */
50
-	public function setAppDirectory($appDirectory)
51
-	{
52
-		$this->appDirectory = $appDirectory;
53
-	}
42
+    /**
43
+     * Sets the application directory.
44
+     *
45
+     * @param      string The application directory.
46
+     *
47
+     * @author     Noah Fontes <[email protected]>
48
+     * @since      1.0.0
49
+     */
50
+    public function setAppDirectory($appDirectory)
51
+    {
52
+        $this->appDirectory = $appDirectory;
53
+    }
54 54
 	
55
-	/**
56
-	 * Gets the application directory.
57
-	 *
58
-	 * @return     string The application directory.
59
-	 *
60
-	 * @author     Noah Fontes <[email protected]>
61
-	 * @since      1.0.0
62
-	 */
63
-	public function getAppDirectory()
64
-	{
65
-		return $this->appDirectory;
66
-	}
55
+    /**
56
+     * Gets the application directory.
57
+     *
58
+     * @return     string The application directory.
59
+     *
60
+     * @author     Noah Fontes <[email protected]>
61
+     * @since      1.0.0
62
+     */
63
+    public function getAppDirectory()
64
+    {
65
+        return $this->appDirectory;
66
+    }
67 67
 	
68
-	/**
69
-	 * Sets the public directory.
70
-	 *
71
-	 * @param      string The public directory.
72
-	 *
73
-	 * @author     Noah Fontes <[email protected]>
74
-	 * @since      1.0.0
75
-	 */
76
-	public function setPubDirectory($pubDirectory)
77
-	{
78
-		$this->pubDirectory = $pubDirectory;
79
-	}
68
+    /**
69
+     * Sets the public directory.
70
+     *
71
+     * @param      string The public directory.
72
+     *
73
+     * @author     Noah Fontes <[email protected]>
74
+     * @since      1.0.0
75
+     */
76
+    public function setPubDirectory($pubDirectory)
77
+    {
78
+        $this->pubDirectory = $pubDirectory;
79
+    }
80 80
 	
81
-	/**
82
-	 * Gets the public directory.
83
-	 *
84
-	 * @return     string The public directory.
85
-	 *
86
-	 * @author     Noah Fontes <[email protected]>
87
-	 * @since      1.0.0
88
-	 */
89
-	public function getPubDirectory()
90
-	{
91
-		return $this->pubDirectory;
92
-	}
81
+    /**
82
+     * Gets the public directory.
83
+     *
84
+     * @return     string The public directory.
85
+     *
86
+     * @author     Noah Fontes <[email protected]>
87
+     * @since      1.0.0
88
+     */
89
+    public function getPubDirectory()
90
+    {
91
+        return $this->pubDirectory;
92
+    }
93 93
 	
94
-	/**
95
-	 * Determines whether a given directory is a valid Agavi project.
96
-	 *
97
-	 * @return     bool True if the directory is valid; false otherwise.
98
-	 *
99
-	 * @author     Noah Fontes <[email protected]>
100
-	 * @since      1.0.0
101
-	 */
102
-	public function check()
103
-	{
104
-		$path = $this->getPath();
105
-		if(is_dir($path)) {
106
-			if(is_dir($path . '/' . $this->appDirectory) && is_dir($path . '/' . $this->pubDirectory)) {
107
-				if(file_exists($path . '/' . $this->appDirectory . '/config.php')) {
108
-					return true;
109
-				}
110
-			}
111
-		}
112
-		return false;
113
-	}
94
+    /**
95
+     * Determines whether a given directory is a valid Agavi project.
96
+     *
97
+     * @return     bool True if the directory is valid; false otherwise.
98
+     *
99
+     * @author     Noah Fontes <[email protected]>
100
+     * @since      1.0.0
101
+     */
102
+    public function check()
103
+    {
104
+        $path = $this->getPath();
105
+        if(is_dir($path)) {
106
+            if(is_dir($path . '/' . $this->appDirectory) && is_dir($path . '/' . $this->pubDirectory)) {
107
+                if(file_exists($path . '/' . $this->appDirectory . '/config.php')) {
108
+                    return true;
109
+                }
110
+            }
111
+        }
112
+        return false;
113
+    }
114 114
 }
115 115
 
116 116
 ?>
117 117
\ No newline at end of file
Please login to merge, or discard this patch.
src/build/agavi/phing/ProxyProject.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
 	 * Sets a user property. Proxies the request to the underlying project.
151 151
 	 *
152 152
 	 * @param      string $name  The name of the property.
153
-	 * @param      mixed  $value The value of the property.
153
+	 * @param      string  $value The value of the property.
154 154
 	 *
155 155
 	 * @author     Noah Fontes <[email protected]>
156 156
 	 * @since      1.0.0
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function fireConfigureStarted($configurator)
85 85
 	{
86
-		if(!$this->copied) {
86
+		if (!$this->copied) {
87 87
 			$this->copy();
88 88
 			$this->copied = true;
89 89
 		}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public function setProperty($name, $value)
128 128
 	{
129
-		if(!self::isPropertyProtected($name)) {
129
+		if (!self::isPropertyProtected($name)) {
130 130
 			$this->proxied->setProperty($name, $value);
131 131
 		}
132 132
 		parent::setProperty($name, $value);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public function setNewProperty($name, $value)
142 142
 	{
143
-		if(!self::isPropertyProtected($name)) {
143
+		if (!self::isPropertyProtected($name)) {
144 144
 			$this->proxied->setNewProperty($name, $value);
145 145
 		}
146 146
 		parent::setNewProperty($name, $value);
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function setUserProperty($name, $value)
159 159
 	{
160
-		if(!self::isPropertyProtected($name)) {
160
+		if (!self::isPropertyProtected($name)) {
161 161
 			$this->proxied->setUserProperty($name, $value);
162 162
 		}
163 163
 		parent::setUserProperty($name, $value);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	public function setInheritedProperty($name, $value)
176 176
 	{
177
-		if(!self::isPropertyProtected($name)) {
177
+		if (!self::isPropertyProtected($name)) {
178 178
 			$this->proxied->setInheritedProperty($name, $value);
179 179
 		}
180 180
 		parent::setInheritedProperty($name, $value);
@@ -237,28 +237,28 @@  discard block
 block discarded – undo
237 237
 	 */
238 238
 	protected function copy()
239 239
 	{
240
-		foreach($this->proxied->getBuildListeners() as $listener) {
240
+		foreach ($this->proxied->getBuildListeners() as $listener) {
241 241
 			parent::addBuildListener($listener);
242 242
 		}
243 243
 		$this->setInputHandler($this->proxied->getInputHandler());
244
-		foreach($this->proxied->getTaskDefinitions() as $name => $class) {
244
+		foreach ($this->proxied->getTaskDefinitions() as $name => $class) {
245 245
 			parent::addTaskDefinition($name, $class);
246 246
 		}
247
-		foreach($this->proxied->getDataTypeDefinitions() as $name => $class) {
247
+		foreach ($this->proxied->getDataTypeDefinitions() as $name => $class) {
248 248
 			parent::addDataTypeDefinition($name, $class);
249 249
 		}
250 250
 		
251 251
 		/* Assign properties for consistency. */
252 252
 		$this->proxied->copyUserProperties($this);
253 253
 		$this->proxied->copyInheritedProperties($this);
254
-		foreach($this->proxied->getProperties() as $name => $property) {
255
-			if(!ProxyProject::isPropertyProtected($name) && $this->getProperty($name) === null) {
254
+		foreach ($this->proxied->getProperties() as $name => $property) {
255
+			if (!ProxyProject::isPropertyProtected($name) && $this->getProperty($name) === null) {
256 256
 				parent::setNewProperty($name, $property);
257 257
 			}
258 258
 		}
259 259
 		
260 260
 		/* Add proxy targets to the new project. */
261
-		foreach($this->proxied->getTargets() as $name => $target) {
261
+		foreach ($this->proxied->getTargets() as $name => $target) {
262 262
 			$proxy = new ProxyTarget();
263 263
 			$proxy->setName($name);
264 264
 			$proxy->setDescription($target->getDescription());
Please login to merge, or discard this patch.
Indentation   +221 added lines, -221 removed lines patch added patch discarded remove patch
@@ -29,246 +29,246 @@
 block discarded – undo
29 29
  */
30 30
 class ProxyProject extends \Project
31 31
 {
32
-	/**
33
-	 * @var        \Project The Phing Project instance to be proxied.
34
-	 */
35
-	protected $proxied = null;
32
+    /**
33
+     * @var        \Project The Phing Project instance to be proxied.
34
+     */
35
+    protected $proxied = null;
36 36
 	
37
-	/**
38
-	 * @var        bool Whether the proxied configuration has been copied.
39
-	 */
40
-	protected $copied = false;
37
+    /**
38
+     * @var        bool Whether the proxied configuration has been copied.
39
+     */
40
+    protected $copied = false;
41 41
 	
42
-	/**
43
-	 * @var        array A List of properties to set on the proxy.
44
-	 */
45
-	protected static $protectedProperties = array(
46
-		'phing.file',
47
-		'basedir',
48
-		'project.basedir'
49
-	);
42
+    /**
43
+     * @var        array A List of properties to set on the proxy.
44
+     */
45
+    protected static $protectedProperties = array(
46
+        'phing.file',
47
+        'basedir',
48
+        'project.basedir'
49
+    );
50 50
 	
51
-	/**
52
-	 * Creates a new proxied project.
53
-	 *
54
-	 * @param      \Project $proxied The project to proxy.
55
-	 *
56
-	 * @author     Noah Fontes <[email protected]>
57
-	 * @since      1.0.0
58
-	 */
59
-	public function __construct(\Project $proxied)
60
-	{
61
-		$this->proxied = $proxied;
51
+    /**
52
+     * Creates a new proxied project.
53
+     *
54
+     * @param      \Project $proxied The project to proxy.
55
+     *
56
+     * @author     Noah Fontes <[email protected]>
57
+     * @since      1.0.0
58
+     */
59
+    public function __construct(\Project $proxied)
60
+    {
61
+        $this->proxied = $proxied;
62 62
 		
63
-		parent::__construct();
64
-	}
63
+        parent::__construct();
64
+    }
65 65
 	
66
-	/**
67
-	 * Initializes this project.
68
-	 *
69
-	 * @author     Noah Fontes <[email protected]>
70
-	 * @since      1.0.0
71
-	 */
72
-	public function init()
73
-	{
74
-	}
66
+    /**
67
+     * Initializes this project.
68
+     *
69
+     * @author     Noah Fontes <[email protected]>
70
+     * @since      1.0.0
71
+     */
72
+    public function init()
73
+    {
74
+    }
75 75
 
76
-	/**
77
-	 * Performs initialization associated with a parsing configurator starting.
78
-	 *
79
-	 * @param      \ProjectConfigurator $configurator The new configurator.
80
-	 *
81
-	 * @author     Noah Fontes <[email protected]>
82
-	 * @since      1.0.4
83
-	 */
84
-	public function fireConfigureStarted($configurator)
85
-	{
86
-		if(!$this->copied) {
87
-			$this->copy();
88
-			$this->copied = true;
89
-		}
90
-	}
76
+    /**
77
+     * Performs initialization associated with a parsing configurator starting.
78
+     *
79
+     * @param      \ProjectConfigurator $configurator The new configurator.
80
+     *
81
+     * @author     Noah Fontes <[email protected]>
82
+     * @since      1.0.4
83
+     */
84
+    public function fireConfigureStarted($configurator)
85
+    {
86
+        if(!$this->copied) {
87
+            $this->copy();
88
+            $this->copied = true;
89
+        }
90
+    }
91 91
 
92
-	/**
93
-	 * Performs any cleanup associated with the current configurator finishing.
94
-	 *
95
-	 * @author     Noah Fontes <[email protected]>
96
-	 * @since      1.0.4
97
-	 */
98
-	public function fireConfigureFinished()
99
-	{
100
-	}
92
+    /**
93
+     * Performs any cleanup associated with the current configurator finishing.
94
+     *
95
+     * @author     Noah Fontes <[email protected]>
96
+     * @since      1.0.4
97
+     */
98
+    public function fireConfigureFinished()
99
+    {
100
+    }
101 101
 	
102
-	/**
103
-	 * Determines whether a given property is protected (that is, should not be
104
-	 * copied from one project to the other).
105
-	 *
106
-	 * @param      string $property The name of the property.
107
-	 *
108
-	 * @return     bool True if the property is protected, false otherwise.
109
-	 *
110
-	 * @author     Noah Fontes <[email protected]>
111
-	 * @since      1.0.0
112
-	 */
113
-	public static function isPropertyProtected($property)
114
-	{
115
-		return in_array($property, self::$protectedProperties);
116
-	}
102
+    /**
103
+     * Determines whether a given property is protected (that is, should not be
104
+     * copied from one project to the other).
105
+     *
106
+     * @param      string $property The name of the property.
107
+     *
108
+     * @return     bool True if the property is protected, false otherwise.
109
+     *
110
+     * @author     Noah Fontes <[email protected]>
111
+     * @since      1.0.0
112
+     */
113
+    public static function isPropertyProtected($property)
114
+    {
115
+        return in_array($property, self::$protectedProperties);
116
+    }
117 117
 	
118
-	/**
119
-	 * Sets a property. Proxies the request to the underlying project.
120
-	 *
121
-	 * @param      string $name  The name of the property.
122
-	 * @param      mixed  $value The value of the property.
123
-	 *
124
-	 * @author     Noah Fontes <[email protected]>
125
-	 * @since      1.0.0
126
-	 */
127
-	public function setProperty($name, $value)
128
-	{
129
-		if(!self::isPropertyProtected($name)) {
130
-			$this->proxied->setProperty($name, $value);
131
-		}
132
-		parent::setProperty($name, $value);
133
-	}
118
+    /**
119
+     * Sets a property. Proxies the request to the underlying project.
120
+     *
121
+     * @param      string $name  The name of the property.
122
+     * @param      mixed  $value The value of the property.
123
+     *
124
+     * @author     Noah Fontes <[email protected]>
125
+     * @since      1.0.0
126
+     */
127
+    public function setProperty($name, $value)
128
+    {
129
+        if(!self::isPropertyProtected($name)) {
130
+            $this->proxied->setProperty($name, $value);
131
+        }
132
+        parent::setProperty($name, $value);
133
+    }
134 134
 	
135
-	/**
136
-	 * Sets a new property. Proxies the request to the underlying project.
137
-	 *
138
-	 * @param      string $name  The name of the property.
139
-	 * @param      mixed  $value The value of the property.
140
-	 */
141
-	public function setNewProperty($name, $value)
142
-	{
143
-		if(!self::isPropertyProtected($name)) {
144
-			$this->proxied->setNewProperty($name, $value);
145
-		}
146
-		parent::setNewProperty($name, $value);
147
-	}
135
+    /**
136
+     * Sets a new property. Proxies the request to the underlying project.
137
+     *
138
+     * @param      string $name  The name of the property.
139
+     * @param      mixed  $value The value of the property.
140
+     */
141
+    public function setNewProperty($name, $value)
142
+    {
143
+        if(!self::isPropertyProtected($name)) {
144
+            $this->proxied->setNewProperty($name, $value);
145
+        }
146
+        parent::setNewProperty($name, $value);
147
+    }
148 148
 	
149
-	/**
150
-	 * Sets a user property. Proxies the request to the underlying project.
151
-	 *
152
-	 * @param      string $name  The name of the property.
153
-	 * @param      mixed  $value The value of the property.
154
-	 *
155
-	 * @author     Noah Fontes <[email protected]>
156
-	 * @since      1.0.0
157
-	 */
158
-	public function setUserProperty($name, $value)
159
-	{
160
-		if(!self::isPropertyProtected($name)) {
161
-			$this->proxied->setUserProperty($name, $value);
162
-		}
163
-		parent::setUserProperty($name, $value);
164
-	}
149
+    /**
150
+     * Sets a user property. Proxies the request to the underlying project.
151
+     *
152
+     * @param      string $name  The name of the property.
153
+     * @param      mixed  $value The value of the property.
154
+     *
155
+     * @author     Noah Fontes <[email protected]>
156
+     * @since      1.0.0
157
+     */
158
+    public function setUserProperty($name, $value)
159
+    {
160
+        if(!self::isPropertyProtected($name)) {
161
+            $this->proxied->setUserProperty($name, $value);
162
+        }
163
+        parent::setUserProperty($name, $value);
164
+    }
165 165
 	
166
-	/**
167
-	 * Sets an inherited property. Proxies the request to the underlying project.
168
-	 *
169
-	 * @param      string $name The name of the property.
170
-	 * @param      mixed  $name  The value of the property.
171
-	 *
172
-	 * @author     Noah Fontes <[email protected]>
173
-	 * @since      1.0.0
174
-	 */
175
-	public function setInheritedProperty($name, $value)
176
-	{
177
-		if(!self::isPropertyProtected($name)) {
178
-			$this->proxied->setInheritedProperty($name, $value);
179
-		}
180
-		parent::setInheritedProperty($name, $value);
181
-	}
166
+    /**
167
+     * Sets an inherited property. Proxies the request to the underlying project.
168
+     *
169
+     * @param      string $name The name of the property.
170
+     * @param      mixed  $name  The value of the property.
171
+     *
172
+     * @author     Noah Fontes <[email protected]>
173
+     * @since      1.0.0
174
+     */
175
+    public function setInheritedProperty($name, $value)
176
+    {
177
+        if(!self::isPropertyProtected($name)) {
178
+            $this->proxied->setInheritedProperty($name, $value);
179
+        }
180
+        parent::setInheritedProperty($name, $value);
181
+    }
182 182
 	
183
-	/**
184
-	 * Adds a new task to the project. Proxies the request to the underlying
185
-	 * project.
186
-	 *
187
-	 * @param      string $name      The name of the task.
188
-	 * @param      string $class     The name of the class.
189
-	 * @param      string $classpath The classpath to use when resolving the class.
190
-	 *
191
-	 * @author     Noah Fontes <[email protected]>
192
-	 * @since      1.0.0
193
-	 */
194
-	public function addTaskDefinition($name, $class, $classpath = null)
195
-	{
196
-		$this->proxied->addTaskDefinition($name, $class, $classpath);
197
-		parent::addTaskDefinition($name, $class, $classpath);
198
-	}
183
+    /**
184
+     * Adds a new task to the project. Proxies the request to the underlying
185
+     * project.
186
+     *
187
+     * @param      string $name      The name of the task.
188
+     * @param      string $class     The name of the class.
189
+     * @param      string $classpath The classpath to use when resolving the class.
190
+     *
191
+     * @author     Noah Fontes <[email protected]>
192
+     * @since      1.0.0
193
+     */
194
+    public function addTaskDefinition($name, $class, $classpath = null)
195
+    {
196
+        $this->proxied->addTaskDefinition($name, $class, $classpath);
197
+        parent::addTaskDefinition($name, $class, $classpath);
198
+    }
199 199
 	
200
-	/**
201
-	 * Adds a new datatype to the project. Proxies the request to the underlying
202
-	 * project.
203
-	 *
204
-	 * @param      string $name      The name of the task.
205
-	 * @param      string $class     The name of the class.
206
-	 * @param      string $classpath The classpath to use when resolving the class.
207
-	 *
208
-	 * @author     Noah Fontes <[email protected]>
209
-	 * @since      1.0.0
210
-	 */
211
-	public function addDataTypeDefinition($name, $class, $classpath = null)
212
-	{
213
-		$this->proxied->addDataTypeDefinition($name, $class, $classpath);
214
-		parent::addDataTypeDefinition($name, $class, $classpath);
215
-	}
200
+    /**
201
+     * Adds a new datatype to the project. Proxies the request to the underlying
202
+     * project.
203
+     *
204
+     * @param      string $name      The name of the task.
205
+     * @param      string $class     The name of the class.
206
+     * @param      string $classpath The classpath to use when resolving the class.
207
+     *
208
+     * @author     Noah Fontes <[email protected]>
209
+     * @since      1.0.0
210
+     */
211
+    public function addDataTypeDefinition($name, $class, $classpath = null)
212
+    {
213
+        $this->proxied->addDataTypeDefinition($name, $class, $classpath);
214
+        parent::addDataTypeDefinition($name, $class, $classpath);
215
+    }
216 216
 	
217
-	/**
218
-	 * Adds a new build listener to the project. Proxies the request to the
219
-	 * underlying project.
220
-	 *
221
-	 * @param      \BuildListener $listener The build listener to add.
222
-	 *
223
-	 * @author     Noah Fontes <[email protected]>
224
-	 * @since      1.0.0
225
-	 */
226
-	public function addBuildListener(\BuildListener $listener)
227
-	{
228
-		$this->proxied->addBuildListener($listener);
229
-		parent::addBuildListener($listener);
230
-	}
217
+    /**
218
+     * Adds a new build listener to the project. Proxies the request to the
219
+     * underlying project.
220
+     *
221
+     * @param      \BuildListener $listener The build listener to add.
222
+     *
223
+     * @author     Noah Fontes <[email protected]>
224
+     * @since      1.0.0
225
+     */
226
+    public function addBuildListener(\BuildListener $listener)
227
+    {
228
+        $this->proxied->addBuildListener($listener);
229
+        parent::addBuildListener($listener);
230
+    }
231 231
 
232
-	/**
233
-	 * Copies the configuration from the proxied project into this project.
234
-	 *
235
-	 * @author     Noah Fontes <[email protected]>
236
-	 * @since      1.0.4
237
-	 */
238
-	protected function copy()
239
-	{
240
-		foreach($this->proxied->getBuildListeners() as $listener) {
241
-			parent::addBuildListener($listener);
242
-		}
243
-		$this->setInputHandler($this->proxied->getInputHandler());
244
-		foreach($this->proxied->getTaskDefinitions() as $name => $class) {
245
-			parent::addTaskDefinition($name, $class);
246
-		}
247
-		foreach($this->proxied->getDataTypeDefinitions() as $name => $class) {
248
-			parent::addDataTypeDefinition($name, $class);
249
-		}
232
+    /**
233
+     * Copies the configuration from the proxied project into this project.
234
+     *
235
+     * @author     Noah Fontes <[email protected]>
236
+     * @since      1.0.4
237
+     */
238
+    protected function copy()
239
+    {
240
+        foreach($this->proxied->getBuildListeners() as $listener) {
241
+            parent::addBuildListener($listener);
242
+        }
243
+        $this->setInputHandler($this->proxied->getInputHandler());
244
+        foreach($this->proxied->getTaskDefinitions() as $name => $class) {
245
+            parent::addTaskDefinition($name, $class);
246
+        }
247
+        foreach($this->proxied->getDataTypeDefinitions() as $name => $class) {
248
+            parent::addDataTypeDefinition($name, $class);
249
+        }
250 250
 		
251
-		/* Assign properties for consistency. */
252
-		$this->proxied->copyUserProperties($this);
253
-		$this->proxied->copyInheritedProperties($this);
254
-		foreach($this->proxied->getProperties() as $name => $property) {
255
-			if(!ProxyProject::isPropertyProtected($name) && $this->getProperty($name) === null) {
256
-				parent::setNewProperty($name, $property);
257
-			}
258
-		}
251
+        /* Assign properties for consistency. */
252
+        $this->proxied->copyUserProperties($this);
253
+        $this->proxied->copyInheritedProperties($this);
254
+        foreach($this->proxied->getProperties() as $name => $property) {
255
+            if(!ProxyProject::isPropertyProtected($name) && $this->getProperty($name) === null) {
256
+                parent::setNewProperty($name, $property);
257
+            }
258
+        }
259 259
 		
260
-		/* Add proxy targets to the new project. */
261
-		foreach($this->proxied->getTargets() as $name => $target) {
262
-			$proxy = new ProxyTarget();
263
-			$proxy->setName($name);
264
-			$proxy->setDescription($target->getDescription());
265
-			$proxy->setTarget($target);
266
-			parent::addTarget($name, $proxy);
267
-		}
260
+        /* Add proxy targets to the new project. */
261
+        foreach($this->proxied->getTargets() as $name => $target) {
262
+            $proxy = new ProxyTarget();
263
+            $proxy->setName($name);
264
+            $proxy->setDescription($target->getDescription());
265
+            $proxy->setTarget($target);
266
+            parent::addTarget($name, $proxy);
267
+        }
268 268
 		
269
-		parent::setUserProperty('phing.version', $this->proxied->getProperty('phing.version'));
270
-		$this->setSystemProperties();
271
-	}
269
+        parent::setUserProperty('phing.version', $this->proxied->getProperty('phing.version'));
270
+        $this->setSystemProperties();
271
+    }
272 272
 }
273 273
 
274 274
 ?>
275 275
\ No newline at end of file
Please login to merge, or discard this patch.
src/build/phing/org/agavi/build/tasks/AgaviTask.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -59,6 +59,7 @@
 block discarded – undo
59 59
 	 *
60 60
 	 * @param      string The message to log.
61 61
 	 * @param      int The priority of the message.
62
+	 * @param string $message
62 63
 	 */
63 64
 	public function log($message, $level = Project::MSG_INFO)
64 65
 	{
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public function init()
40 40
 	{
41
-		if(!class_exists('Build')) {
41
+		if (!class_exists('Build')) {
42 42
 			require_once(__DIR__ . '/../../../../../agavi/build.php');
43 43
 			\Agavi\Build\Build::bootstrap();
44 44
 		}
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function log($message, $level = Project::MSG_INFO)
64 64
 	{
65
-		if($this->quiet === false) {
65
+		if ($this->quiet === false) {
66 66
 			parent::log($message, $level);
67 67
 		}
68 68
 	}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	protected function tryLoadAgavi()
74 74
 	{
75
-		if(!class_exists('Agavi')) {
75
+		if (!class_exists('Agavi')) {
76 76
 			$sourceDirectory = (string)$this->project->getProperty('agavi.directory.src');
77 77
 			require_once($sourceDirectory . '/agavi.php');
78 78
 		}
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	protected function tryBootstrapAgavi()
85 85
 	{
86
-		if(!self::$agaviBootstrapped) {
86
+		if (!self::$agaviBootstrapped) {
87 87
 			/* Something might fuck up. We always use the template that you can
88 88
 			 * actually read. */
89 89
 			\Agavi\Config\Config::set('exception.default_template',
Please login to merge, or discard this patch.
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -29,82 +29,82 @@
 block discarded – undo
29 29
  */
30 30
 abstract class AgaviTask extends Task
31 31
 {
32
-	protected $quiet = false;
33
-	protected static $bootstrapped = false;
34
-	protected static $agaviBootstrapped = false;
32
+    protected $quiet = false;
33
+    protected static $bootstrapped = false;
34
+    protected static $agaviBootstrapped = false;
35 35
 	
36
-	/**
37
-	 * Initializes the task by bootstrapping Agavi build components.
38
-	 */
39
-	public function init()
40
-	{
41
-		if(!class_exists('Build')) {
42
-			require_once(__DIR__ . '/../../../../../agavi/build.php');
43
-			\Agavi\Build\Build::bootstrap();
44
-		}
45
-	}
36
+    /**
37
+     * Initializes the task by bootstrapping Agavi build components.
38
+     */
39
+    public function init()
40
+    {
41
+        if(!class_exists('Build')) {
42
+            require_once(__DIR__ . '/../../../../../agavi/build.php');
43
+            \Agavi\Build\Build::bootstrap();
44
+        }
45
+    }
46 46
 	
47
-	/**
48
-	 * Sets whether log messages for this task will be suppressed.
49
-	 *
50
-	 * @param      bool Whether to suppressing log messages for this task.
51
-	 */
52
-	public function setQuiet($quiet)
53
-	{
54
-		$this->quiet = StringHelper::booleanValue($quiet);
55
-	}
47
+    /**
48
+     * Sets whether log messages for this task will be suppressed.
49
+     *
50
+     * @param      bool Whether to suppressing log messages for this task.
51
+     */
52
+    public function setQuiet($quiet)
53
+    {
54
+        $this->quiet = StringHelper::booleanValue($quiet);
55
+    }
56 56
 	
57
-	/**
58
-	 * Logs an event.
59
-	 *
60
-	 * @param      string The message to log.
61
-	 * @param      int The priority of the message.
62
-	 */
63
-	public function log($message, $level = Project::MSG_INFO)
64
-	{
65
-		if($this->quiet === false) {
66
-			parent::log($message, $level);
67
-		}
68
-	}
57
+    /**
58
+     * Logs an event.
59
+     *
60
+     * @param      string The message to log.
61
+     * @param      int The priority of the message.
62
+     */
63
+    public function log($message, $level = Project::MSG_INFO)
64
+    {
65
+        if($this->quiet === false) {
66
+            parent::log($message, $level);
67
+        }
68
+    }
69 69
 	
70
-	/**
71
-	 * Utility method to load Agavi classes.
72
-	 */
73
-	protected function tryLoadAgavi()
74
-	{
75
-		if(!class_exists('Agavi')) {
76
-			$sourceDirectory = (string)$this->project->getProperty('agavi.directory.src');
77
-			require_once($sourceDirectory . '/agavi.php');
78
-		}
79
-	}
70
+    /**
71
+     * Utility method to load Agavi classes.
72
+     */
73
+    protected function tryLoadAgavi()
74
+    {
75
+        if(!class_exists('Agavi')) {
76
+            $sourceDirectory = (string)$this->project->getProperty('agavi.directory.src');
77
+            require_once($sourceDirectory . '/agavi.php');
78
+        }
79
+    }
80 80
 	
81
-	/**
82
-	 * Utility method to bootstrap Agavi.
83
-	 */
84
-	protected function tryBootstrapAgavi()
85
-	{
86
-		if(!self::$agaviBootstrapped) {
87
-			/* Something might fuck up. We always use the template that you can
81
+    /**
82
+     * Utility method to bootstrap Agavi.
83
+     */
84
+    protected function tryBootstrapAgavi()
85
+    {
86
+        if(!self::$agaviBootstrapped) {
87
+            /* Something might fuck up. We always use the template that you can
88 88
 			 * actually read. */
89
-			\Agavi\Config\Config::set('exception.default_template',
90
-				sprintf('%s/templates/plaintext.php', (string)$this->project->getProperty('agavi.directory.src.exception')),
91
-				$overwrite = true,
92
-				$readonly = true
93
-			);
89
+            \Agavi\Config\Config::set('exception.default_template',
90
+                sprintf('%s/templates/plaintext.php', (string)$this->project->getProperty('agavi.directory.src.exception')),
91
+                $overwrite = true,
92
+                $readonly = true
93
+            );
94 94
 			
95
-			/* To further prevent fucking up, we force it into debug mode. */
96
-			\Agavi\Config\Config::set('core.debug', true, $overwrite = true, $readonly = true);
95
+            /* To further prevent fucking up, we force it into debug mode. */
96
+            \Agavi\Config\Config::set('core.debug', true, $overwrite = true, $readonly = true);
97 97
 			
98
-			require_once(
99
-				sprintf('%s/%s/config.php',
100
-					(string)$this->project->getProperty('project.directory'),
101
-					(string)$this->project->getProperty('project.directory.app')
102
-				)
103
-			);
104
-			\Agavi\Core\Agavi::bootstrap($this->project->getProperty('project.build.environment'));
105
-			self::$agaviBootstrapped = true;
106
-		}
107
-	}
98
+            require_once(
99
+                sprintf('%s/%s/config.php',
100
+                    (string)$this->project->getProperty('project.directory'),
101
+                    (string)$this->project->getProperty('project.directory.app')
102
+                )
103
+            );
104
+            \Agavi\Core\Agavi::bootstrap($this->project->getProperty('project.build.environment'));
105
+            self::$agaviBootstrapped = true;
106
+        }
107
+    }
108 108
 }
109 109
 
110 110
 ?>
111 111
\ No newline at end of file
Please login to merge, or discard this patch.
src/config/ConfigValueHolder.class.php 4 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 
16 16
 namespace Agavi\Config;
17 17
 
18
-use Agavi\Config\Util\Dom\XmlConfigDomElement;
19 18
 use Agavi\Util\Inflector;
20 19
 /**
21 20
  * ConfigValueHolder is the storage class for the XmlConfigHandler
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function __get($name)
107 107
 	{
108
-		if(isset($this->_childs[$name])) {
108
+		if (isset($this->_childs[$name])) {
109 109
 			return $this->_childs[$name];
110 110
 		} else {
111 111
 			$tagName = $name;
112 112
 			$tagNameStart = '';
113
-			if(($lastUScore = strrpos($tagName, '_')) !== false) {
113
+			if (($lastUScore = strrpos($tagName, '_')) !== false) {
114 114
 				$lastUScore++;
115 115
 				$tagNameStart = substr($tagName, 0, $lastUScore);
116 116
 				$tagName = substr($tagName, $lastUScore);
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 			// check if the requested node was specified using the plural version
120 120
 			// and create a "virtual" node which reflects the non existent plural node
121 121
 			$singularName = $tagNameStart . Inflector::singularize($tagName);
122
-			if($this->hasChildren($singularName)) {
122
+			if ($this->hasChildren($singularName)) {
123 123
 
124 124
 				$vh = new ConfigValueHolder();
125 125
 				$vh->setName($name);
126 126
 
127 127
 				/** @var ConfigValueHolder $child */
128
-				foreach($this->_childs as $child) {
129
-					if($child->getName() == $singularName) {
128
+				foreach ($this->_childs as $child) {
129
+					if ($child->getName() == $singularName) {
130 130
 						$vh->addChildren($singularName, $child);
131 131
 					}
132 132
 				}
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function addChildren($name, $children)
153 153
 	{
154
-		if(!$this->hasChildren($name)) {
154
+		if (!$this->hasChildren($name)) {
155 155
 			$this->$name = $children;
156 156
 			$this->_childs[$name] = $children;
157 157
 		} else {
@@ -185,16 +185,16 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	public function hasChildren($child = null)
187 187
 	{
188
-		if($child === null) {
188
+		if ($child === null) {
189 189
 			return count($this->_childs) > 0;
190 190
 		}
191 191
 
192
-		if(isset($this->_childs[$child])) {
192
+		if (isset($this->_childs[$child])) {
193 193
 			return true;
194 194
 		} else {
195 195
 			$tagName = $child;
196 196
 			$tagNameStart = '';
197
-			if(($lastUScore = strrpos($tagName, '_')) !== false) {
197
+			if (($lastUScore = strrpos($tagName, '_')) !== false) {
198 198
 				$lastUScore++;
199 199
 				$tagNameStart = substr($tagName, 0, $lastUScore);
200 200
 				$tagName = substr($tagName, $lastUScore);
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
 	 */
218 218
 	public function getChildren($nodename = null)
219 219
 	{
220
-		if($nodename === null) {
220
+		if ($nodename === null) {
221 221
 			return $this->_childs;
222 222
 		} else {
223 223
 			$childs = array();
224 224
 			/** @var ConfigValueHolder $child */
225
-			foreach($this->_childs as $child) {
226
-				if($child->getName() == $nodename) {
225
+			foreach ($this->_childs as $child) {
226
+				if ($child->getName() == $nodename) {
227 227
 					$childs[] = $child;
228 228
 				}
229 229
 			}
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 */
366 366
 	public function offsetGet($offset)
367 367
 	{
368
-		if(!isset($this->_childs[$offset]))
368
+		if (!isset($this->_childs[$offset]))
369 369
 			return null;
370 370
 		return $this->_childs[$offset];
371 371
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -365,8 +365,9 @@
 block discarded – undo
365 365
 	 */
366 366
 	public function offsetGet($offset)
367 367
 	{
368
-		if(!isset($this->_childs[$offset]))
369
-			return null;
368
+		if(!isset($this->_childs[$offset])) {
369
+					return null;
370
+		}
370 371
 		return $this->_childs[$offset];
371 372
 	}
372 373
 
Please login to merge, or discard this patch.
Indentation   +388 added lines, -388 removed lines patch added patch discarded remove patch
@@ -35,394 +35,394 @@
 block discarded – undo
35 35
  */
36 36
 class ConfigValueHolder implements \ArrayAccess, \IteratorAggregate
37 37
 {
38
-	/**
39
-	 * @var        string The name of this value.
40
-	 */
41
-	protected $_name = '';
42
-	/**
43
-	 * @var        array The attributes of this value.
44
-	 */
45
-	protected $_attributes = array();
46
-	/**
47
-	 * @var        array The child nodes of this value.
48
-	 */
49
-	protected $_childs = array();
50
-	/**
51
-	 * @var        string The value.
52
-	 */
53
-	protected $_value = null;
54
-
55
-	/**
56
-	 * Sets the name of this value.
57
-	 *
58
-	 * @param      string $name The name.
59
-	 *
60
-	 * @author     Dominik del Bondio <[email protected]>
61
-	 * @since      0.11.0
62
-	 */
63
-	public function setName($name)
64
-	{
65
-		$this->_name = $name;
66
-	}
67
-
68
-	/**
69
-	 * Returns the name of this value.
70
-	 *
71
-	 * @return     string The name.
72
-	 *
73
-	 * @author     Dominik del Bondio <[email protected]>
74
-	 * @since      0.11.0
75
-	 */
76
-	public function getName()
77
-	{
78
-		return $this->_name;
79
-	}
80
-
81
-	/**
82
-	 * isset() overload.
83
-	 *
84
-	 * @param      string $name Name of the child.
85
-	 *
86
-	 * @return     bool Whether or not that child exists.
87
-	 *
88
-	 * @author     Dominik del Bondio <[email protected]>
89
-	 * @since      0.11.0
90
-	 */
91
-	public function __isset($name)
92
-	{
93
-		return $this->hasChildren($name);
94
-	}
95
-
96
-	/**
97
-	 * Magic getter overload.
98
-	 *
99
-	 * @param      string $name Name of the child .
100
-	 *
101
-	 * @return     ConfigValueHolder The child, if it exists.
102
-	 *
103
-	 * @author     Dominik del Bondio <[email protected]>
104
-	 * @since      0.11.0
105
-	 */
106
-	public function __get($name)
107
-	{
108
-		if(isset($this->_childs[$name])) {
109
-			return $this->_childs[$name];
110
-		} else {
111
-			$tagName = $name;
112
-			$tagNameStart = '';
113
-			if(($lastUScore = strrpos($tagName, '_')) !== false) {
114
-				$lastUScore++;
115
-				$tagNameStart = substr($tagName, 0, $lastUScore);
116
-				$tagName = substr($tagName, $lastUScore);
117
-			}
118
-
119
-			// check if the requested node was specified using the plural version
120
-			// and create a "virtual" node which reflects the non existent plural node
121
-			$singularName = $tagNameStart . Inflector::singularize($tagName);
122
-			if($this->hasChildren($singularName)) {
123
-
124
-				$vh = new ConfigValueHolder();
125
-				$vh->setName($name);
126
-
127
-				/** @var ConfigValueHolder $child */
128
-				foreach($this->_childs as $child) {
129
-					if($child->getName() == $singularName) {
130
-						$vh->addChildren($singularName, $child);
131
-					}
132
-				}
133
-
134
-				return $vh;
135
-			} else {
136
-				//throw new AgaviException('Node with the name ' . $name . ' does not exist ('.$this->getName().', '.implode(', ', array_keys($this->_childs)).')');
137
-				return null;
138
-			}
139
-		}
140
-	}
141
-
142
-	/**
143
-	 * Adds a named children to this value. If a children with the same name
144
-	 * already exists the given value will be appended to the children.
145
-	 *
146
-	 * @param      string            $name     The name of the child.
147
-	 * @param      ConfigValueHolder $children The child value.
148
-	 *
149
-	 * @author     Dominik del Bondio <[email protected]>
150
-	 * @since      0.11.0
151
-	 */
152
-	public function addChildren($name, $children)
153
-	{
154
-		if(!$this->hasChildren($name)) {
155
-			$this->$name = $children;
156
-			$this->_childs[$name] = $children;
157
-		} else {
158
-			$this->appendChildren($children);
159
-		}
160
-	}
161
-
162
-	/**
163
-	 * Adds a unnamed children to this value.
164
-	 *
165
-	 * @param      ConfigValueHolder $children The child value.
166
-	 *
167
-	 * @author     Dominik del Bondio <[email protected]>
168
-	 * @since      0.11.0
169
-	 */
170
-	public function appendChildren($children)
171
-	{
172
-		$this->_childs[] = $children;
173
-	}
174
-
175
-	/**
176
-	 * Checks whether the value has children at all (no params) or whether a
177
-	 * child with the given name exists.
178
-	 *
179
-	 * @param      string $child The name of the child.
180
-	 *
181
-	 * @return     bool True if children exist, false if not.
182
-	 *
183
-	 * @author     Dominik del Bondio <[email protected]>
184
-	 * @since      0.11.0
185
-	 */
186
-	public function hasChildren($child = null)
187
-	{
188
-		if($child === null) {
189
-			return count($this->_childs) > 0;
190
-		}
191
-
192
-		if(isset($this->_childs[$child])) {
193
-			return true;
194
-		} else {
195
-			$tagName = $child;
196
-			$tagNameStart = '';
197
-			if(($lastUScore = strrpos($tagName, '_')) !== false) {
198
-				$lastUScore++;
199
-				$tagNameStart = substr($tagName, 0, $lastUScore);
200
-				$tagName = substr($tagName, $lastUScore);
201
-			}
202
-
203
-			$singularName = $tagNameStart . Inflector::singularize($tagName);
204
-			return isset($this->_childs[$singularName]);
205
-		}
206
-	}
207
-
208
-	/**
209
-	 * Returns the children of this value.
210
-	 *
211
-	 * @param      string $nodename Return only the childs matching this node (tag) name.
212
-	 *
213
-	 * @return     ConfigValueHolder[] An array with the childs of this value.
214
-	 *
215
-	 * @author     Dominik del Bondio <[email protected]>
216
-	 * @since      0.11.0
217
-	 */
218
-	public function getChildren($nodename = null)
219
-	{
220
-		if($nodename === null) {
221
-			return $this->_childs;
222
-		} else {
223
-			$childs = array();
224
-			/** @var ConfigValueHolder $child */
225
-			foreach($this->_childs as $child) {
226
-				if($child->getName() == $nodename) {
227
-					$childs[] = $child;
228
-				}
229
-			}
230
-
231
-			return $childs;
232
-		}
233
-	}
234
-
235
-	/**
236
-	 * Set an attribute.
237
-	 *
238
-	 * If an attribute with the name already exists the value will be
239
-	 * overridden.
240
-	 *
241
-	 * @param      string $name  An attribute name.
242
-	 * @param      mixed  $value An attribute value.
243
-	 *
244
-	 * @author     Dominik del Bondio <[email protected]>
245
-	 * @since      0.11.0
246
-	 */
247
-	public function setAttribute($name, $value)
248
-	{
249
-		$this->_attributes[$name] = $value;
250
-	}
251
-
252
-	/**
253
-	 * Indicates whether or not an attribute exists.
254
-	 *
255
-	 * @param      string $name An attribute name.
256
-	 *
257
-	 * @return     bool true, if the attribute exists, otherwise false.
258
-	 *
259
-	 * @author     Dominik del Bondio <[email protected]>
260
-	 * @since      0.11.0
261
-	 */
262
-	public function hasAttribute($name)
263
-	{
264
-		return isset($this->_attributes[$name]);
265
-	}
266
-
267
-	/**
268
-	 * Retrieve an attribute.
269
-	 *
270
-	 * @param      string $name    An attribute name.
271
-	 * @param      mixed  $default A default attribute value.
272
-	 *
273
-	 * @return     mixed An attribute value, if the attribute exists, otherwise
274
-	 *                   null or the given default.
275
-	 *
276
-	 * @author     Dominik del Bondio <[email protected]>
277
-	 * @since      0.11.0
278
-	 */
279
-	public function getAttribute($name, $default = null)
280
-	{
281
-		return isset($this->_attributes[$name]) ? $this->_attributes[$name] : $default;
282
-	}
283
-
284
-	/**
285
-	 * Retrieve all attributes.
286
-	 *
287
-	 * @return     array An associative array of attributes.
288
-	 *
289
-	 * @author     Dominik del Bondio <[email protected]>
290
-	 * @since      0.11.0
291
-	 */
292
-	public function getAttributes()
293
-	{
294
-		return $this->_attributes;
295
-	}
296
-
297
-	/**
298
-	 * Set the value of this value node.
299
-	 *
300
-	 * @param      string $value A value.
301
-	 *
302
-	 * @author     Dominik del Bondio <[email protected]>
303
-	 * @since      0.11.0
304
-	 */
305
-	public function setValue($value)
306
-	{
307
-		$this->_value = $value;
308
-	}
309
-
310
-	/**
311
-	 * Retrieves the value of this value node.
312
-	 *
313
-	 * @return     string The value of this node.
314
-	 *
315
-	 * @author     Dominik del Bondio <[email protected]>
316
-	 * @since      0.11.0
317
-	 */
318
-	public function getValue()
319
-	{
320
-		return $this->_value;
321
-	}
322
-
323
-	/**
324
-	 * Retrieves the info of this value node.
325
-	 *
326
-	 * @return     array An array containing the info for this node.
327
-	 *
328
-	 * @author     Dominik del Bondio <[email protected]>
329
-	 * @since      0.11.0
330
-	 */
331
-	public function getNode()
332
-	{
333
-		return array(
334
-			'name' => $this->_name,
335
-			'attributes' => $this->_attributes,
336
-			'children' => $this->_childs,
337
-			'value' => $this->_value,
338
-		);
339
-	}
340
-
341
-	/**
342
-	 * Determines if a named child exists. From ArrayAccess.
343
-	 *
344
-	 * @param      string $offset Offset to check
345
-	 *
346
-	 * @return     bool Whether the offset exists.
347
-	 *
348
-	 * @author     Dominik del Bondio <[email protected]>
349
-	 * @since      0.11.0
350
-	 */
351
-	public function offsetExists($offset)
352
-	{
353
-		return isset($this->_childs[$offset]);
354
-	}
355
-
356
-	/**
357
-	 * Retrieves a named child. From ArrayAccess.
358
-	 *
359
-	 * @param      string $offset Offset to retrieve
360
-	 *
361
-	 * @return     ConfigValueHolder The child value.
362
-	 *
363
-	 * @author     Dominik del Bondio <[email protected]>
364
-	 * @since      0.11.0
365
-	 */
366
-	public function offsetGet($offset)
367
-	{
368
-		if(!isset($this->_childs[$offset]))
369
-			return null;
370
-		return $this->_childs[$offset];
371
-	}
372
-
373
-	/**
374
-	 * Inserts a named child. From ArrayAccess.
375
-	 *
376
-	 * @param      string            $offset Offset to modify
377
-	 * @param      ConfigValueHolder $value  The child value.
378
-	 *
379
-	 * @author     Dominik del Bondio <[email protected]>
380
-	 * @since      0.11.0
381
-	 */
382
-	public function offsetSet($offset, $value)
383
-	{
384
-		$this->_childs[$offset] = $value;
385
-	}
386
-
387
-	/**
388
-	 * Deletes a named child. From ArrayAccess.
389
-	 *
390
-	 * @return     string $offset Offset to delete.
391
-	 *
392
-	 * @author     Dominik del Bondio <[email protected]>
393
-	 * @since      0.11.0
394
-	 */
395
-	public function offsetUnset($offset)
396
-	{
397
-		unset($this->_childs[$offset]);
398
-	}
399
-
400
-	/**
401
-	 * Returns an Iterator for the child nodes. From IteratorAggregate.
402
-	 *
403
-	 * @return     \Iterator The iterator.
404
-	 *
405
-	 * @author     Dominik del Bondio <[email protected]>
406
-	 * @since      0.11.0
407
-	 */
408
-	public function getIterator()
409
-	{
410
-		return new \ArrayIterator($this->getChildren());
411
-	}
412
-
413
-	/**
414
-	 * Retrieves the string representation of this value node. This is 
415
-	 * currently only the value of the node.
416
-	 *
417
-	 * @return     string The string representation.
418
-	 *
419
-	 * @author     Dominik del Bondio <[email protected]>
420
-	 * @since      0.11.0
421
-	 */
422
-	public function __toString()
423
-	{
424
-		return $this->_value;
425
-	}
38
+    /**
39
+     * @var        string The name of this value.
40
+     */
41
+    protected $_name = '';
42
+    /**
43
+     * @var        array The attributes of this value.
44
+     */
45
+    protected $_attributes = array();
46
+    /**
47
+     * @var        array The child nodes of this value.
48
+     */
49
+    protected $_childs = array();
50
+    /**
51
+     * @var        string The value.
52
+     */
53
+    protected $_value = null;
54
+
55
+    /**
56
+     * Sets the name of this value.
57
+     *
58
+     * @param      string $name The name.
59
+     *
60
+     * @author     Dominik del Bondio <[email protected]>
61
+     * @since      0.11.0
62
+     */
63
+    public function setName($name)
64
+    {
65
+        $this->_name = $name;
66
+    }
67
+
68
+    /**
69
+     * Returns the name of this value.
70
+     *
71
+     * @return     string The name.
72
+     *
73
+     * @author     Dominik del Bondio <[email protected]>
74
+     * @since      0.11.0
75
+     */
76
+    public function getName()
77
+    {
78
+        return $this->_name;
79
+    }
80
+
81
+    /**
82
+     * isset() overload.
83
+     *
84
+     * @param      string $name Name of the child.
85
+     *
86
+     * @return     bool Whether or not that child exists.
87
+     *
88
+     * @author     Dominik del Bondio <[email protected]>
89
+     * @since      0.11.0
90
+     */
91
+    public function __isset($name)
92
+    {
93
+        return $this->hasChildren($name);
94
+    }
95
+
96
+    /**
97
+     * Magic getter overload.
98
+     *
99
+     * @param      string $name Name of the child .
100
+     *
101
+     * @return     ConfigValueHolder The child, if it exists.
102
+     *
103
+     * @author     Dominik del Bondio <[email protected]>
104
+     * @since      0.11.0
105
+     */
106
+    public function __get($name)
107
+    {
108
+        if(isset($this->_childs[$name])) {
109
+            return $this->_childs[$name];
110
+        } else {
111
+            $tagName = $name;
112
+            $tagNameStart = '';
113
+            if(($lastUScore = strrpos($tagName, '_')) !== false) {
114
+                $lastUScore++;
115
+                $tagNameStart = substr($tagName, 0, $lastUScore);
116
+                $tagName = substr($tagName, $lastUScore);
117
+            }
118
+
119
+            // check if the requested node was specified using the plural version
120
+            // and create a "virtual" node which reflects the non existent plural node
121
+            $singularName = $tagNameStart . Inflector::singularize($tagName);
122
+            if($this->hasChildren($singularName)) {
123
+
124
+                $vh = new ConfigValueHolder();
125
+                $vh->setName($name);
126
+
127
+                /** @var ConfigValueHolder $child */
128
+                foreach($this->_childs as $child) {
129
+                    if($child->getName() == $singularName) {
130
+                        $vh->addChildren($singularName, $child);
131
+                    }
132
+                }
133
+
134
+                return $vh;
135
+            } else {
136
+                //throw new AgaviException('Node with the name ' . $name . ' does not exist ('.$this->getName().', '.implode(', ', array_keys($this->_childs)).')');
137
+                return null;
138
+            }
139
+        }
140
+    }
141
+
142
+    /**
143
+     * Adds a named children to this value. If a children with the same name
144
+     * already exists the given value will be appended to the children.
145
+     *
146
+     * @param      string            $name     The name of the child.
147
+     * @param      ConfigValueHolder $children The child value.
148
+     *
149
+     * @author     Dominik del Bondio <[email protected]>
150
+     * @since      0.11.0
151
+     */
152
+    public function addChildren($name, $children)
153
+    {
154
+        if(!$this->hasChildren($name)) {
155
+            $this->$name = $children;
156
+            $this->_childs[$name] = $children;
157
+        } else {
158
+            $this->appendChildren($children);
159
+        }
160
+    }
161
+
162
+    /**
163
+     * Adds a unnamed children to this value.
164
+     *
165
+     * @param      ConfigValueHolder $children The child value.
166
+     *
167
+     * @author     Dominik del Bondio <[email protected]>
168
+     * @since      0.11.0
169
+     */
170
+    public function appendChildren($children)
171
+    {
172
+        $this->_childs[] = $children;
173
+    }
174
+
175
+    /**
176
+     * Checks whether the value has children at all (no params) or whether a
177
+     * child with the given name exists.
178
+     *
179
+     * @param      string $child The name of the child.
180
+     *
181
+     * @return     bool True if children exist, false if not.
182
+     *
183
+     * @author     Dominik del Bondio <[email protected]>
184
+     * @since      0.11.0
185
+     */
186
+    public function hasChildren($child = null)
187
+    {
188
+        if($child === null) {
189
+            return count($this->_childs) > 0;
190
+        }
191
+
192
+        if(isset($this->_childs[$child])) {
193
+            return true;
194
+        } else {
195
+            $tagName = $child;
196
+            $tagNameStart = '';
197
+            if(($lastUScore = strrpos($tagName, '_')) !== false) {
198
+                $lastUScore++;
199
+                $tagNameStart = substr($tagName, 0, $lastUScore);
200
+                $tagName = substr($tagName, $lastUScore);
201
+            }
202
+
203
+            $singularName = $tagNameStart . Inflector::singularize($tagName);
204
+            return isset($this->_childs[$singularName]);
205
+        }
206
+    }
207
+
208
+    /**
209
+     * Returns the children of this value.
210
+     *
211
+     * @param      string $nodename Return only the childs matching this node (tag) name.
212
+     *
213
+     * @return     ConfigValueHolder[] An array with the childs of this value.
214
+     *
215
+     * @author     Dominik del Bondio <[email protected]>
216
+     * @since      0.11.0
217
+     */
218
+    public function getChildren($nodename = null)
219
+    {
220
+        if($nodename === null) {
221
+            return $this->_childs;
222
+        } else {
223
+            $childs = array();
224
+            /** @var ConfigValueHolder $child */
225
+            foreach($this->_childs as $child) {
226
+                if($child->getName() == $nodename) {
227
+                    $childs[] = $child;
228
+                }
229
+            }
230
+
231
+            return $childs;
232
+        }
233
+    }
234
+
235
+    /**
236
+     * Set an attribute.
237
+     *
238
+     * If an attribute with the name already exists the value will be
239
+     * overridden.
240
+     *
241
+     * @param      string $name  An attribute name.
242
+     * @param      mixed  $value An attribute value.
243
+     *
244
+     * @author     Dominik del Bondio <[email protected]>
245
+     * @since      0.11.0
246
+     */
247
+    public function setAttribute($name, $value)
248
+    {
249
+        $this->_attributes[$name] = $value;
250
+    }
251
+
252
+    /**
253
+     * Indicates whether or not an attribute exists.
254
+     *
255
+     * @param      string $name An attribute name.
256
+     *
257
+     * @return     bool true, if the attribute exists, otherwise false.
258
+     *
259
+     * @author     Dominik del Bondio <[email protected]>
260
+     * @since      0.11.0
261
+     */
262
+    public function hasAttribute($name)
263
+    {
264
+        return isset($this->_attributes[$name]);
265
+    }
266
+
267
+    /**
268
+     * Retrieve an attribute.
269
+     *
270
+     * @param      string $name    An attribute name.
271
+     * @param      mixed  $default A default attribute value.
272
+     *
273
+     * @return     mixed An attribute value, if the attribute exists, otherwise
274
+     *                   null or the given default.
275
+     *
276
+     * @author     Dominik del Bondio <[email protected]>
277
+     * @since      0.11.0
278
+     */
279
+    public function getAttribute($name, $default = null)
280
+    {
281
+        return isset($this->_attributes[$name]) ? $this->_attributes[$name] : $default;
282
+    }
283
+
284
+    /**
285
+     * Retrieve all attributes.
286
+     *
287
+     * @return     array An associative array of attributes.
288
+     *
289
+     * @author     Dominik del Bondio <[email protected]>
290
+     * @since      0.11.0
291
+     */
292
+    public function getAttributes()
293
+    {
294
+        return $this->_attributes;
295
+    }
296
+
297
+    /**
298
+     * Set the value of this value node.
299
+     *
300
+     * @param      string $value A value.
301
+     *
302
+     * @author     Dominik del Bondio <[email protected]>
303
+     * @since      0.11.0
304
+     */
305
+    public function setValue($value)
306
+    {
307
+        $this->_value = $value;
308
+    }
309
+
310
+    /**
311
+     * Retrieves the value of this value node.
312
+     *
313
+     * @return     string The value of this node.
314
+     *
315
+     * @author     Dominik del Bondio <[email protected]>
316
+     * @since      0.11.0
317
+     */
318
+    public function getValue()
319
+    {
320
+        return $this->_value;
321
+    }
322
+
323
+    /**
324
+     * Retrieves the info of this value node.
325
+     *
326
+     * @return     array An array containing the info for this node.
327
+     *
328
+     * @author     Dominik del Bondio <[email protected]>
329
+     * @since      0.11.0
330
+     */
331
+    public function getNode()
332
+    {
333
+        return array(
334
+            'name' => $this->_name,
335
+            'attributes' => $this->_attributes,
336
+            'children' => $this->_childs,
337
+            'value' => $this->_value,
338
+        );
339
+    }
340
+
341
+    /**
342
+     * Determines if a named child exists. From ArrayAccess.
343
+     *
344
+     * @param      string $offset Offset to check
345
+     *
346
+     * @return     bool Whether the offset exists.
347
+     *
348
+     * @author     Dominik del Bondio <[email protected]>
349
+     * @since      0.11.0
350
+     */
351
+    public function offsetExists($offset)
352
+    {
353
+        return isset($this->_childs[$offset]);
354
+    }
355
+
356
+    /**
357
+     * Retrieves a named child. From ArrayAccess.
358
+     *
359
+     * @param      string $offset Offset to retrieve
360
+     *
361
+     * @return     ConfigValueHolder The child value.
362
+     *
363
+     * @author     Dominik del Bondio <[email protected]>
364
+     * @since      0.11.0
365
+     */
366
+    public function offsetGet($offset)
367
+    {
368
+        if(!isset($this->_childs[$offset]))
369
+            return null;
370
+        return $this->_childs[$offset];
371
+    }
372
+
373
+    /**
374
+     * Inserts a named child. From ArrayAccess.
375
+     *
376
+     * @param      string            $offset Offset to modify
377
+     * @param      ConfigValueHolder $value  The child value.
378
+     *
379
+     * @author     Dominik del Bondio <[email protected]>
380
+     * @since      0.11.0
381
+     */
382
+    public function offsetSet($offset, $value)
383
+    {
384
+        $this->_childs[$offset] = $value;
385
+    }
386
+
387
+    /**
388
+     * Deletes a named child. From ArrayAccess.
389
+     *
390
+     * @return     string $offset Offset to delete.
391
+     *
392
+     * @author     Dominik del Bondio <[email protected]>
393
+     * @since      0.11.0
394
+     */
395
+    public function offsetUnset($offset)
396
+    {
397
+        unset($this->_childs[$offset]);
398
+    }
399
+
400
+    /**
401
+     * Returns an Iterator for the child nodes. From IteratorAggregate.
402
+     *
403
+     * @return     \Iterator The iterator.
404
+     *
405
+     * @author     Dominik del Bondio <[email protected]>
406
+     * @since      0.11.0
407
+     */
408
+    public function getIterator()
409
+    {
410
+        return new \ArrayIterator($this->getChildren());
411
+    }
412
+
413
+    /**
414
+     * Retrieves the string representation of this value node. This is 
415
+     * currently only the value of the node.
416
+     *
417
+     * @return     string The string representation.
418
+     *
419
+     * @author     Dominik del Bondio <[email protected]>
420
+     * @since      0.11.0
421
+     */
422
+    public function __toString()
423
+    {
424
+        return $this->_value;
425
+    }
426 426
 }
427 427
 
428 428
 ?>
429 429
\ No newline at end of file
Please login to merge, or discard this patch.
src/config/LdmlConfigHandler.class.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -846,6 +846,7 @@  discard block
 block discarded – undo
846 846
 	 * @param      ConfigValueHolder The item.
847 847
 	 * @param      string The name of item.
848 848
 	 * @param      array The array to store the parsed data to.
849
+	 * @param string $name
849 850
 	 *
850 851
 	 * @return     array The array with the data.
851 852
 	 *
@@ -1004,7 +1005,7 @@  discard block
 block discarded – undo
1004 1005
 	 * Unescapes a single unicode escape sequence. This is designed to be a 
1005 1006
 	 * preg_replace_callback callback function.
1006 1007
 	 * 
1007
-	 * @param      array $matches The match.
1008
+	 * @param      string[] $matches The match.
1008 1009
 	 *
1009 1010
 	 * @return     string The unescaped sequence.
1010 1011
 	 *
Please login to merge, or discard this patch.
Spacing   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 			'layout' => array('orientation' => array('lines' => 'top-to-bottom', 'characters' => 'left-to-right')),
65 65
 		);
66 66
 
67
-		foreach(array_reverse($lookupPaths) as $basename) {
67
+		foreach (array_reverse($lookupPaths) as $basename) {
68 68
 			$filePath = $pathParts['dirname'] . '/' . $basename . '.' . $pathParts['extension'];
69
-			if(is_readable($filePath)) {
69
+			if (is_readable($filePath)) {
70 70
 				$ldmlTree = ConfigCache::parseConfig($filePath, false, $this->getValidationFile(), $this->parser);
71 71
 				$this->prepareParentInformation($ldmlTree);
72 72
 				$this->parseLdmlTree($ldmlTree->ldml, $data);
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 		);
85 85
 
86 86
 		// fix the day indices for all day fields
87
-		foreach($data['calendars'] as $calKey => &$calValue) {
87
+		foreach ($data['calendars'] as $calKey => &$calValue) {
88 88
 			// skip the 'default' => '' key => value pair
89
-			if(is_array($calValue)) {
90
-				if(isset($calValue['days']['format'])) {
91
-					foreach($calValue['days']['format'] as $formatKey => &$formatValue) {
92
-						if(is_array($formatValue)) {
89
+			if (is_array($calValue)) {
90
+				if (isset($calValue['days']['format'])) {
91
+					foreach ($calValue['days']['format'] as $formatKey => &$formatValue) {
92
+						if (is_array($formatValue)) {
93 93
 							$newData = array();
94
-							foreach($formatValue as $day => $value) {
94
+							foreach ($formatValue as $day => $value) {
95 95
 								$newData[$dayMap[$day]] = $value;
96 96
 							}
97 97
 							$formatValue = $newData;
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 					}
100 100
 				}
101 101
 
102
-				if(isset($calValue['days']['stand-alone'])) {
103
-					foreach($calValue['days']['stand-alone'] as $formatKey => &$formatValue) {
104
-						if(is_array($formatValue)) {
102
+				if (isset($calValue['days']['stand-alone'])) {
103
+					foreach ($calValue['days']['stand-alone'] as $formatKey => &$formatValue) {
104
+						if (is_array($formatValue)) {
105 105
 							$newData = array();
106
-							foreach($formatValue as $day => $value) {
106
+							foreach ($formatValue as $day => $value) {
107 107
 								$newData[$dayMap[$day]] = $value;
108 108
 							}
109 109
 							$formatValue = $newData;
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 		$ldmlTree->setAttribute('__agavi_parent_id', null);
136 136
 		$this->nodeRefs[$i] = $ldmlTree;
137 137
 		++$i;
138
-		if($ldmlTree->hasChildren()) {
138
+		if ($ldmlTree->hasChildren()) {
139 139
 			$this->generateParentInformation($ldmlTree->getChildren(), $i, 0);
140 140
 		}
141 141
 	}
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 	protected function generateParentInformation($childList, &$nextId, $parentId)
154 154
 	{
155 155
 		/** @var ConfigValueHolder $child */
156
-		foreach($childList as $child) {
156
+		foreach ($childList as $child) {
157 157
 			$child->setAttribute('__agavi_node_id', $nextId);
158 158
 			$child->setAttribute('__agavi_parent_id', $parentId);
159 159
 			$this->nodeRefs[$nextId] = $child;
160 160
 			++$nextId;
161
-			if($child->hasChildren()) {
161
+			if ($child->hasChildren()) {
162 162
 				$this->generateParentInformation($child->getChildren(), $nextId, $child->getAttribute('__agavi_node_id'));
163 163
 			}
164 164
 		}
@@ -350,43 +350,43 @@  discard block
 block discarded – undo
350 350
 	public function parseLdmlTree($ldmlTree, &$data)
351 351
 	{
352 352
 
353
-		if(isset($ldmlTree->identity)) {
353
+		if (isset($ldmlTree->identity)) {
354 354
 			$data['locale']['language'] = $ldmlTree->identity->language->getAttribute('type');
355
-			if(isset($ldmlTree->identity->territory)) {
355
+			if (isset($ldmlTree->identity->territory)) {
356 356
 				$data['locale']['territory'] = $ldmlTree->identity->territory->getAttribute('type');
357 357
 			}
358
-			if(isset($ldmlTree->identity->script)) {
358
+			if (isset($ldmlTree->identity->script)) {
359 359
 				$data['locale']['script'] = $ldmlTree->identity->script->getAttribute('type');
360 360
 			}
361
-			if(isset($ldmlTree->identity->variant)) {
361
+			if (isset($ldmlTree->identity->variant)) {
362 362
 				$data['locale']['variant'] = $ldmlTree->identity->variant->getAttribute('type');
363 363
 			}
364 364
 		}
365 365
 
366
-		if(isset($ldmlTree->localeDisplayNames)) {
366
+		if (isset($ldmlTree->localeDisplayNames)) {
367 367
 			$ldn = $ldmlTree->localeDisplayNames;
368 368
 
369
-			if(isset($ldn->languages)) {
369
+			if (isset($ldn->languages)) {
370 370
 				$data['displayNames']['languages'] = isset($data['displayNames']['languages']) ? $data['displayNames']['languages'] : array();
371 371
 				$this->getTypeList($ldn->languages, $data['displayNames']['languages']);
372 372
 			}
373 373
 
374
-			if(isset($ldn->scripts)) {
374
+			if (isset($ldn->scripts)) {
375 375
 				$data['displayNames']['scripts'] = isset($data['displayNames']['scripts']) ? $data['displayNames']['scripts'] : array();
376 376
 				$this->getTypeList($ldn->scripts, $data['displayNames']['scripts']);
377 377
 			}
378 378
 
379
-			if(isset($ldn->territories)) {
379
+			if (isset($ldn->territories)) {
380 380
 				$data['displayNames']['territories'] = isset($data['displayNames']['territories']) ? $data['displayNames']['territories'] : array();
381 381
 				$this->getTypeList($ldn->territories, $data['displayNames']['territories']);
382 382
 			}
383 383
 
384
-			if(isset($ldn->variants)) {
384
+			if (isset($ldn->variants)) {
385 385
 				$data['displayNames']['variants'] = isset($data['displayNames']['variants']) ? $data['displayNames']['variants'] : array();
386 386
 				$this->getTypeList($ldn->variants, $data['displayNames']['variants']);
387 387
 			}
388 388
 
389
-			if(isset($ldn->keys)) {
389
+			if (isset($ldn->keys)) {
390 390
 				$data['displayNames']['keys'] = isset($data['displayNames']['keys']) ? $data['displayNames']['keys'] : array();
391 391
 				$this->getTypeList($ldn->keys, $data['displayNames']['keys']);
392 392
 			}
@@ -397,138 +397,138 @@  discard block
 block discarded – undo
397 397
 			}
398 398
 			*/
399 399
 
400
-			if(isset($ldn->measurementSystemNames)) {
400
+			if (isset($ldn->measurementSystemNames)) {
401 401
 				$data['displayNames']['measurementSystemNames'] = isset($data['displayNames']['measurementSystemNames']) ? $data['displayNames']['measurementSystemNames'] : array();
402 402
 				$this->getTypeList($ldn->measurementSystemNames, $data['displayNames']['measurementSystemNames']);
403 403
 			}
404 404
 		}
405 405
 
406
-		if(isset($ldmlTree->layout->orientation)) {
406
+		if (isset($ldmlTree->layout->orientation)) {
407 407
 			$ori = $ldmlTree->layout->orientation;
408 408
 
409 409
 			$data['layout']['orientation']['lines'] = $ori->getAttribute('lines', $data['layout']['orientation']['lines']);
410 410
 			$data['layout']['orientation']['characters'] = $ori->getAttribute('characters', $data['layout']['orientation']['characters']);
411 411
 		}
412 412
 
413
-		if(isset($ldmlTree->delimiters)) {
413
+		if (isset($ldmlTree->delimiters)) {
414 414
 			$delims = $ldmlTree->delimiters;
415 415
 
416
-			if(isset($delims->quotationStart)) {
416
+			if (isset($delims->quotationStart)) {
417 417
 				$data['delimiters']['quotationStart'] = $this->unescape($delims->quotationStart->getValue());
418 418
 			}
419
-			if(isset($delims->quotationEnd)) {
419
+			if (isset($delims->quotationEnd)) {
420 420
 				$data['delimiters']['quotationEnd'] = $this->unescape($delims->quotationEnd->getValue());
421 421
 			}
422
-			if(isset($delims->alternateQuotationStart)) {
422
+			if (isset($delims->alternateQuotationStart)) {
423 423
 				$data['delimiters']['alternateQuotationStart'] = $this->unescape($delims->alternateQuotationStart->getValue());
424 424
 			}
425
-			if(isset($delims->alternateQuotationEnd)) {
425
+			if (isset($delims->alternateQuotationEnd)) {
426 426
 				$data['delimiters']['alternateQuotationEnd'] = $this->unescape($delims->alternateQuotationEnd->getValue());
427 427
 			}
428 428
 		}
429 429
 
430
-		if(isset($ldmlTree->dates)) {
430
+		if (isset($ldmlTree->dates)) {
431 431
 			$dates = $ldmlTree->dates;
432 432
 
433
-			if(isset($dates->calendars)) {
433
+			if (isset($dates->calendars)) {
434 434
 				$cals = $dates->calendars;
435 435
 
436
-				foreach($cals as $calendar) {
436
+				foreach ($cals as $calendar) {
437 437
 
438
-					if($calendar->getName() == 'default') {
438
+					if ($calendar->getName() == 'default') {
439 439
 						$data['calendars']['default'] = $calendar->getAttribute('choice');
440
-					} elseif($calendar->getName() == 'calendar') {
440
+					} elseif ($calendar->getName() == 'calendar') {
441 441
 						$calendarName = $calendar->getAttribute('type');
442 442
 
443
-						if(!isset($data['calendars'][$calendarName])) {
443
+						if (!isset($data['calendars'][$calendarName])) {
444 444
 							$data['calendars'][$calendarName] = array();
445 445
 						}
446 446
 
447
-						if(isset($calendar->months)) {
447
+						if (isset($calendar->months)) {
448 448
 							$this->getCalendarWidth($calendar->months, 'month', $data['calendars'][$calendarName]);
449 449
 						}
450 450
 
451
-						if(isset($calendar->days)) {
451
+						if (isset($calendar->days)) {
452 452
 							$this->getCalendarWidth($calendar->days, 'day', $data['calendars'][$calendarName]);
453 453
 						}
454 454
 
455
-						if(isset($calendar->quarters)) {
455
+						if (isset($calendar->quarters)) {
456 456
 							$this->getCalendarWidth($calendar->quarters, 'quarter', $data['calendars'][$calendarName]);
457 457
 						}
458 458
 
459
-						if(isset($calendar->am)) {
459
+						if (isset($calendar->am)) {
460 460
 							$data['calendars'][$calendarName]['am'] = $this->unescape($calendar->am->getValue());
461 461
 						}
462
-						if(isset($calendar->pm)) {
462
+						if (isset($calendar->pm)) {
463 463
 							$data['calendars'][$calendarName]['pm'] = $this->unescape($calendar->pm->getValue());
464 464
 						}
465 465
 
466
-						if(isset($calendar->eras)) {
467
-							if(isset($calendar->eras->eraNames)) {
468
-								foreach($this->getChildsOrAlias($calendar->eras->eraNames) as $era) {
466
+						if (isset($calendar->eras)) {
467
+							if (isset($calendar->eras->eraNames)) {
468
+								foreach ($this->getChildsOrAlias($calendar->eras->eraNames) as $era) {
469 469
 									$data['calendars'][$calendarName]['eras']['wide'][$era->getAttribute('type')] = $this->unescape($era->getValue());
470 470
 								}
471 471
 							}
472
-							if(isset($calendar->eras->eraAbbr)) {
473
-								foreach($this->getChildsOrAlias($calendar->eras->eraAbbr) as $era) {
472
+							if (isset($calendar->eras->eraAbbr)) {
473
+								foreach ($this->getChildsOrAlias($calendar->eras->eraAbbr) as $era) {
474 474
 									$data['calendars'][$calendarName]['eras']['abbreviated'][$era->getAttribute('type')] = $this->unescape($era->getValue());
475 475
 								}
476 476
 							}
477
-							if(isset($calendar->eras->eraNarrow)) {
478
-								foreach($this->getChildsOrAlias($calendar->eras->eraNarrow) as $era) {
477
+							if (isset($calendar->eras->eraNarrow)) {
478
+								foreach ($this->getChildsOrAlias($calendar->eras->eraNarrow) as $era) {
479 479
 									$data['calendars'][$calendarName]['eras']['narrow'][$era->getAttribute('type')] = $this->unescape($era->getValue());
480 480
 								}
481 481
 							}
482 482
 						}
483 483
 
484
-						if(isset($calendar->dateFormats)) {
484
+						if (isset($calendar->dateFormats)) {
485 485
 							$this->getDateOrTimeFormats($calendar->dateFormats, 'dateFormat', $data['calendars'][$calendarName]);
486 486
 						}
487
-						if(isset($calendar->timeFormats)) {
487
+						if (isset($calendar->timeFormats)) {
488 488
 							$this->getDateOrTimeFormats($calendar->timeFormats, 'timeFormat', $data['calendars'][$calendarName]);
489 489
 						}
490 490
 
491
-						if(isset($calendar->dateTimeFormats)) {
491
+						if (isset($calendar->dateTimeFormats)) {
492 492
 							$dtf = $calendar->dateTimeFormats;
493 493
 							$data['calendars'][$calendarName]['dateTimeFormats']['default'] = isset($dtf->default) ? $dtf->default->getAttribute('choice') : '__default';
494 494
 
495 495
 							$dtfItems = $this->getChildsOrAlias($dtf);
496
-							foreach($dtfItems as $item) {
497
-								if($item->getName() == 'dateTimeFormatLength') {
498
-									if(isset($item->dateTimeFormat->pattern)) {
496
+							foreach ($dtfItems as $item) {
497
+								if ($item->getName() == 'dateTimeFormatLength') {
498
+									if (isset($item->dateTimeFormat->pattern)) {
499 499
 										$data['calendars'][$calendarName]['dateTimeFormats']['formats'][$item->getAttribute('type', '__default')] = $this->unescape($item->dateTimeFormat->pattern->getValue(), true);
500 500
 									} else {
501 501
 										throw new AgaviException('unknown child content in dateTimeFormatLength tag');
502 502
 									}
503
-								} elseif($item->getName() == 'availableFormats') {
504
-									foreach($item as $dateFormatItem) {
505
-										if($dateFormatItem->getName() != 'dateFormatItem') {
503
+								} elseif ($item->getName() == 'availableFormats') {
504
+									foreach ($item as $dateFormatItem) {
505
+										if ($dateFormatItem->getName() != 'dateFormatItem') {
506 506
 											throw new AgaviException('unknown childtag "' . $dateFormatItem->getName() . '" in availableFormats tag');
507 507
 										}
508 508
 										$data['calendars'][$calendarName]['dateTimeFormats']['availableFormats'][$dateFormatItem->getAttribute('id')] = $this->unescape($dateFormatItem->getValue(), true);
509 509
 									}
510
-								} elseif($item->getName() == 'appendItems') {
511
-									foreach($item as $appendItem) {
512
-										if($appendItem->getName() != 'appendItem') {
510
+								} elseif ($item->getName() == 'appendItems') {
511
+									foreach ($item as $appendItem) {
512
+										if ($appendItem->getName() != 'appendItem') {
513 513
 											throw new AgaviException('unknown childtag "' . $appendItem->getName() . '" in appendItems tag');
514 514
 										}
515 515
 										$data['calendars'][$calendarName]['dateTimeFormats']['appendItems'][$appendItem->getAttribute('request')] = $this->unescape($appendItem->getValue(), true);
516 516
 									}
517
-								} elseif($item->getName() != 'default') {
517
+								} elseif ($item->getName() != 'default') {
518 518
 									throw new AgaviException('unknown childtag "' . $item->getName() . '" in dateTimeFormats tag');
519 519
 								}
520 520
 							}
521 521
 						}
522 522
 
523
-						if(isset($calendar->fields)) {
524
-							foreach($this->getChildsOrAlias($calendar->fields) as $field) {
523
+						if (isset($calendar->fields)) {
524
+							foreach ($this->getChildsOrAlias($calendar->fields) as $field) {
525 525
 								$type = $field->getAttribute('type');
526
-								if(isset($field->displayName)) {
526
+								if (isset($field->displayName)) {
527 527
 									$data['calendars'][$calendarName]['fields'][$type]['displayName'] = $this->unescape($field->displayName->getValue());
528 528
 								}
529
-								if(isset($field->relative)) {
530
-									foreach($field as $relative) {
531
-										if($relative->getName() == 'relative') {
529
+								if (isset($field->relative)) {
530
+									foreach ($field as $relative) {
531
+										if ($relative->getName() == 'relative') {
532 532
 											$data['calendars'][$calendarName]['fields'][$type]['relatives'][$relative->getAttribute('type')] = $this->unescape($relative->getValue());
533 533
 										}
534 534
 									}
@@ -541,52 +541,52 @@  discard block
 block discarded – undo
541 541
 				}
542 542
 			}
543 543
 			
544
-			if(isset($dates->timeZoneNames)) {
544
+			if (isset($dates->timeZoneNames)) {
545 545
 				$tzn = $dates->timeZoneNames;
546
-				if(isset($tzn->hourFormat)) {
546
+				if (isset($tzn->hourFormat)) {
547 547
 					$data['timeZoneNames']['hourFormat'] = $this->unescape($tzn->hourFormat->getValue());
548 548
 				}
549
-				if(isset($tzn->hoursFormat)) {
549
+				if (isset($tzn->hoursFormat)) {
550 550
 					$data['timeZoneNames']['hoursFormat'] = $this->unescape($tzn->hoursFormat->getValue());
551 551
 				}
552
-				if(isset($tzn->gmtFormat)) {
552
+				if (isset($tzn->gmtFormat)) {
553 553
 					$data['timeZoneNames']['gmtFormat'] = $this->unescape($tzn->gmtFormat->getValue());
554 554
 				}
555
-				if(isset($tzn->regionFormat)) {
555
+				if (isset($tzn->regionFormat)) {
556 556
 					$data['timeZoneNames']['regionFormat'] = $this->unescape($tzn->regionFormat->getValue());
557 557
 				}
558
-				if(isset($tzn->fallbackFormat)) {
558
+				if (isset($tzn->fallbackFormat)) {
559 559
 					$data['timeZoneNames']['fallbackFormat'] = $this->unescape($tzn->fallbackFormat->getValue());
560 560
 				}
561
-				if(isset($tzn->abbreviationFallback)) {
561
+				if (isset($tzn->abbreviationFallback)) {
562 562
 					$data['timeZoneNames']['abbreviationFallback'] = $tzn->abbreviationFallback->getAttribute('choice');
563 563
 				}
564
-				if(isset($tzn->singleCountries)) {
564
+				if (isset($tzn->singleCountries)) {
565 565
 					$data['timeZoneNames']['singleCountries'] = explode(' ', $tzn->singleCountries->getAttribute('list'));
566 566
 				}
567 567
 
568
-				foreach($tzn as $zone) {
568
+				foreach ($tzn as $zone) {
569 569
 					$zoneName = $zone->getAttribute('type');
570
-					if($zone->getName() == 'zone') {
571
-						if(isset($zone->long->generic)) {
570
+					if ($zone->getName() == 'zone') {
571
+						if (isset($zone->long->generic)) {
572 572
 							$data['timeZoneNames']['zones'][$zoneName]['long']['generic'] = $this->unescape($zone->long->generic->getValue());
573 573
 						}
574
-						if(isset($zone->long->standard)) {
574
+						if (isset($zone->long->standard)) {
575 575
 							$data['timeZoneNames']['zones'][$zoneName]['long']['standard'] = $this->unescape($zone->long->standard->getValue());
576 576
 						}
577
-						if(isset($zone->long->daylight)) {
577
+						if (isset($zone->long->daylight)) {
578 578
 							$data['timeZoneNames']['zones'][$zoneName]['long']['daylight'] = $this->unescape($zone->long->daylight->getValue());
579 579
 						}
580
-						if(isset($zone->short->generic)) {
580
+						if (isset($zone->short->generic)) {
581 581
 							$data['timeZoneNames']['zones'][$zoneName]['short']['generic'] = $this->unescape($zone->short->generic->getValue());
582 582
 						}
583
-						if(isset($zone->short->standard)) {
583
+						if (isset($zone->short->standard)) {
584 584
 							$data['timeZoneNames']['zones'][$zoneName]['short']['standard'] = $this->unescape($zone->short->standard->getValue());
585 585
 						}
586
-						if(isset($zone->short->daylight)) {
586
+						if (isset($zone->short->daylight)) {
587 587
 							$data['timeZoneNames']['zones'][$zoneName]['short']['daylight'] = $this->unescape($zone->short->daylight->getValue());
588 588
 						}
589
-						if(isset($zone->exemplarCity)) {
589
+						if (isset($zone->exemplarCity)) {
590 590
 							$data['timeZoneNames']['zones'][$zoneName]['exemplarCity'] = $this->unescape($zone->exemplarCity->getValue());
591 591
 						}
592 592
 
@@ -595,72 +595,72 @@  discard block
 block discarded – undo
595 595
 			}
596 596
 		}
597 597
 
598
-		if(isset($ldmlTree->numbers)) {
598
+		if (isset($ldmlTree->numbers)) {
599 599
 			$nums = $ldmlTree->numbers;
600
-			if(!isset($data['numbers'])) {
600
+			if (!isset($data['numbers'])) {
601 601
 				$data['numbers'] = array();
602 602
 			}
603 603
 
604
-			if(isset($nums->symbols)) {
604
+			if (isset($nums->symbols)) {
605 605
 				$syms = $nums->symbols;
606
-				if(isset($syms->decimal)) {
606
+				if (isset($syms->decimal)) {
607 607
 					$data['numbers']['symbols']['decimal'] = $this->unescape($syms->decimal->getValue());
608 608
 				}
609
-				if(isset($syms->group)) {
609
+				if (isset($syms->group)) {
610 610
 					$data['numbers']['symbols']['group'] = $this->unescape($syms->group->getValue());
611 611
 				}
612
-				if(isset($syms->list)) {
612
+				if (isset($syms->list)) {
613 613
 					$data['numbers']['symbols']['list'] = $this->unescape($syms->list->getValue());
614 614
 				}
615
-				if(isset($syms->percentSign)) {
615
+				if (isset($syms->percentSign)) {
616 616
 					$data['numbers']['symbols']['percentSign'] = $this->unescape($syms->percentSign->getValue());
617 617
 				}
618
-				if(isset($syms->nativeZeroDigit)) {
618
+				if (isset($syms->nativeZeroDigit)) {
619 619
 					$data['numbers']['symbols']['nativeZeroDigit'] = $this->unescape($syms->nativeZeroDigit->getValue());
620 620
 				}
621
-				if(isset($syms->patternDigit)) {
621
+				if (isset($syms->patternDigit)) {
622 622
 					$data['numbers']['symbols']['patternDigit'] = $this->unescape($syms->patternDigit->getValue());
623 623
 				}
624
-				if(isset($syms->plusSign)) {
624
+				if (isset($syms->plusSign)) {
625 625
 					$data['numbers']['symbols']['plusSign'] = $this->unescape($syms->plusSign->getValue());
626 626
 				}
627
-				if(isset($syms->minusSign)) {
627
+				if (isset($syms->minusSign)) {
628 628
 					$data['numbers']['symbols']['minusSign'] = $this->unescape($syms->minusSign->getValue());
629 629
 				}
630
-				if(isset($syms->exponential)) {
630
+				if (isset($syms->exponential)) {
631 631
 					$data['numbers']['symbols']['exponential'] = $this->unescape($syms->exponential->getValue());
632 632
 				}
633
-				if(isset($syms->perMille)) {
633
+				if (isset($syms->perMille)) {
634 634
 					$data['numbers']['symbols']['perMille'] = $this->unescape($syms->perMille->getValue());
635 635
 				}
636
-				if(isset($syms->infinity)) {
636
+				if (isset($syms->infinity)) {
637 637
 					$data['numbers']['symbols']['infinity'] = $this->unescape($syms->infinity->getValue());
638 638
 				}
639
-				if(isset($syms->nan)) {
639
+				if (isset($syms->nan)) {
640 640
 					$data['numbers']['symbols']['nan'] = $this->unescape($syms->nan->getValue());
641 641
 				}
642 642
 			}
643
-			if(isset($nums->decimalFormats)) {
643
+			if (isset($nums->decimalFormats)) {
644 644
 				$this->getNumberFormats($nums->decimalFormats, 'decimalFormat', $data['numbers']);
645 645
 			}
646
-			if(isset($nums->scientificFormats)) {
646
+			if (isset($nums->scientificFormats)) {
647 647
 				$this->getNumberFormats($nums->scientificFormats, 'scientificFormat', $data['numbers']);
648 648
 			}
649
-			if(isset($nums->percentFormats)) {
649
+			if (isset($nums->percentFormats)) {
650 650
 				$this->getNumberFormats($nums->percentFormats, 'percentFormat', $data['numbers']);
651 651
 			}
652
-			if(isset($nums->currencyFormats)) {
652
+			if (isset($nums->currencyFormats)) {
653 653
 				$cf = $nums->currencyFormats;
654 654
 
655
-				foreach($this->getChildsOrAlias($cf) as $itemLength) {
656
-					if($itemLength->getName() == 'default') {
655
+				foreach ($this->getChildsOrAlias($cf) as $itemLength) {
656
+					if ($itemLength->getName() == 'default') {
657 657
 						$data['numbers']['currencyFormats']['default'] = $itemLength->getAttribute('choice');
658
-					} elseif($itemLength->getName() == 'currencyFormatLength') {
658
+					} elseif ($itemLength->getName() == 'currencyFormatLength') {
659 659
 						$itemLengthName = $itemLength->getAttribute('type', '__default');
660 660
 
661
-						foreach($this->getChildsOrAlias($itemLength) as $itemFormat) {
662
-							if($itemFormat->getName() == 'currencyFormat') {
663
-								if(isset($itemFormat->pattern)) {
661
+						foreach ($this->getChildsOrAlias($itemLength) as $itemFormat) {
662
+							if ($itemFormat->getName() == 'currencyFormat') {
663
+								if (isset($itemFormat->pattern)) {
664 664
 									$data['numbers']['currencyFormats'][$itemLengthName] = $this->unescape($itemFormat->pattern->getValue());
665 665
 								}
666 666
 							} else {
@@ -668,24 +668,24 @@  discard block
 block discarded – undo
668 668
 							}
669 669
 
670 670
 						}
671
-					} elseif($itemLength->getName() == 'currencySpacing') {
671
+					} elseif ($itemLength->getName() == 'currencySpacing') {
672 672
 
673
-						if(isset($itemLength->beforeCurrency->currencyMatch)) {
673
+						if (isset($itemLength->beforeCurrency->currencyMatch)) {
674 674
 							$data['numbers']['currencySpacing']['beforeCurrency']['currencyMatch'] = $this->unescape($itemLength->beforeCurrency->currencyMatch->getValue());
675 675
 						}
676
-						if(isset($itemLength->beforeCurrency->surroundingMatch)) {
676
+						if (isset($itemLength->beforeCurrency->surroundingMatch)) {
677 677
 							$data['numbers']['currencySpacing']['beforeCurrency']['surroundingMatch'] = $this->unescape($itemLength->beforeCurrency->surroundingMatch->getValue());
678 678
 						}
679
-						if(isset($itemLength->beforeCurrency->insertBetween)) {
679
+						if (isset($itemLength->beforeCurrency->insertBetween)) {
680 680
 							$data['numbers']['currencySpacing']['beforeCurrency']['insertBetween'] = $this->unescape($itemLength->beforeCurrency->insertBetween->getValue());
681 681
 						}
682
-						if(isset($itemLength->afterCurrency->currencyMatch)) {
682
+						if (isset($itemLength->afterCurrency->currencyMatch)) {
683 683
 							$data['numbers']['currencySpacing']['afterCurrency']['currencyMatch'] = $this->unescape($itemLength->afterCurrency->currencyMatch->getValue());
684 684
 						}
685
-						if(isset($itemLength->afterCurrency->surroundingMatch)) {
685
+						if (isset($itemLength->afterCurrency->surroundingMatch)) {
686 686
 							$data['numbers']['currencySpacing']['afterCurrency']['surroundingMatch'] = $this->unescape($itemLength->afterCurrency->surroundingMatch->getValue());
687 687
 						}
688
-						if(isset($itemLength->afterCurrency->insertBetween)) {
688
+						if (isset($itemLength->afterCurrency->insertBetween)) {
689 689
 							$data['numbers']['currencySpacing']['afterCurrency']['insertBetween'] = $this->unescape($itemLength->afterCurrency->insertBetween->getValue());
690 690
 						}
691 691
 
@@ -694,15 +694,15 @@  discard block
 block discarded – undo
694 694
 					}
695 695
 				}
696 696
 			}
697
-			if(isset($nums->currencies)) {
698
-				foreach($nums->currencies as $currency) {
697
+			if (isset($nums->currencies)) {
698
+				foreach ($nums->currencies as $currency) {
699 699
 					$name = $currency->getAttribute('type');
700
-					if(isset($currency->displayName)) {
700
+					if (isset($currency->displayName)) {
701 701
 						$data['numbers']['currencies'][$name]['displayName'] = $this->unescape($currency->displayName->getValue());
702 702
 					}
703
-					if(isset($currency->symbol)) {
703
+					if (isset($currency->symbol)) {
704 704
 						$symbolValue = $this->unescape($currency->symbol->getValue());
705
-						if($currency->symbol->getAttribute('choice') == 'true') {
705
+						if ($currency->symbol->getAttribute('choice') == 'true') {
706 706
 							$symbolValue = explode('|', $symbolValue);
707 707
 						}
708 708
 						$data['numbers']['currencies'][$name]['symbol'] = $symbolValue;
@@ -729,17 +729,17 @@  discard block
 block discarded – undo
729 729
 	{
730 730
 		// debug stuff to check if we missed any tags (lc = loop count)
731 731
 		$lc = 0;
732
-		foreach($list as $listItem) {
732
+		foreach ($list as $listItem) {
733 733
 			$type = $listItem->getAttribute('type');
734 734
 
735
-			if(!$listItem->hasAttribute('alt')) {
735
+			if (!$listItem->hasAttribute('alt')) {
736 736
 				$data[$type] = $this->unescape($listItem->getValue());
737 737
 			}
738 738
 
739 739
 			++$lc;
740 740
 		}
741 741
 
742
-		if($lc != count($list->getChildren())) {
742
+		if ($lc != count($list->getChildren())) {
743 743
 			throw new AgaviException('wrong tagcount');
744 744
 		}
745 745
 
@@ -763,25 +763,25 @@  discard block
 block discarded – undo
763 763
 		$dataIdxName = $name . 's';
764 764
 
765 765
 		$items = $this->getChildsOrAlias($item);
766
-		foreach($items as $itemContext) {
767
-			if($itemContext->getName() == 'default') {
766
+		foreach ($items as $itemContext) {
767
+			if ($itemContext->getName() == 'default') {
768 768
 				$data[$dataIdxName]['default'] = $itemContext->getAttribute('choice');
769
-			} elseif($itemContext->getName() == $name . 'Context') {
769
+			} elseif ($itemContext->getName() == $name . 'Context') {
770 770
 				$itemContextName = $itemContext->getAttribute('type');
771 771
 
772
-				foreach($itemContext as $itemWidths) {
773
-					if($itemWidths->getName() == 'default') {
772
+				foreach ($itemContext as $itemWidths) {
773
+					if ($itemWidths->getName() == 'default') {
774 774
 						$data[$dataIdxName][$itemContextName]['default'] = $itemWidths->getAttribute('choice');
775
-					} elseif($itemWidths->getName() == $name . 'Width') {
775
+					} elseif ($itemWidths->getName() == $name . 'Width') {
776 776
 						$itemWidthName = $itemWidths->getAttribute('type');
777 777
 
778 778
 						$widthChildItems = $this->getChildsOrAlias($itemWidths);
779
-						foreach($widthChildItems as $item) {
780
-							if($item->getName() != $name) {
779
+						foreach ($widthChildItems as $item) {
780
+							if ($item->getName() != $name) {
781 781
 								throw new AgaviException('unknown childtag "' . $item->getName() . '" in ' . $name . 'Widths tag');
782 782
 							}
783 783
 
784
-							if(!$item->hasAttribute('alt')) {
784
+							if (!$item->hasAttribute('alt')) {
785 785
 								$itemName = $item->getAttribute('type');
786 786
 								$data[$dataIdxName][$itemContextName][$itemWidthName][$itemName] = $this->unescape($item->getValue());
787 787
 							}
@@ -814,19 +814,19 @@  discard block
 block discarded – undo
814 814
 		$dataIdxName = $name . 's';
815 815
 
816 816
 		$items = $this->getChildsOrAlias($item);
817
-		foreach($items as $itemLength) {
818
-			if($itemLength->getName() == 'default') {
817
+		foreach ($items as $itemLength) {
818
+			if ($itemLength->getName() == 'default') {
819 819
 				$data[$dataIdxName]['default'] = $itemLength->getAttribute('choice');
820
-			} elseif($itemLength->getName() == $name . 'Length') {
820
+			} elseif ($itemLength->getName() == $name . 'Length') {
821 821
 				$itemLengthName = $itemLength->getAttribute('type', '__default');
822 822
 
823 823
 				$aliasedItemLength = $this->getChildsOrAlias($itemLength);
824
-				foreach($aliasedItemLength as $itemFormat) {
825
-					if($itemFormat->getName() == $name) {
826
-						if(isset($itemFormat->pattern)) {
824
+				foreach ($aliasedItemLength as $itemFormat) {
825
+					if ($itemFormat->getName() == $name) {
826
+						if (isset($itemFormat->pattern)) {
827 827
 							$data[$dataIdxName][$itemLengthName]['pattern'] = $this->unescape($itemFormat->pattern->getValue(), true);
828 828
 						}
829
-						if(isset($itemFormat->displayName)) {
829
+						if (isset($itemFormat->displayName)) {
830 830
 							$data[$dataIdxName][$itemLengthName]['displayName'] = $this->unescape($itemFormat->displayName->getValue());
831 831
 						}
832 832
 					} else {
@@ -857,15 +857,15 @@  discard block
 block discarded – undo
857 857
 		$dataIdxName = $name . 's';
858 858
 
859 859
 		$items = $this->getChildsOrAlias($item);
860
-		foreach($items as $itemLength) {
861
-			if($itemLength->getName() == 'default') {
860
+		foreach ($items as $itemLength) {
861
+			if ($itemLength->getName() == 'default') {
862 862
 				$data[$dataIdxName]['default'] = $itemLength->getAttribute('choice');
863
-			} elseif($itemLength->getName() == $name . 'Length') {
863
+			} elseif ($itemLength->getName() == $name . 'Length') {
864 864
 				$itemLengthName = $itemLength->getAttribute('type', '__default');
865 865
 
866
-				foreach($this->getChildsOrAlias($itemLength) as $itemFormat) {
867
-					if($itemFormat->getName() == $name) {
868
-						if(isset($itemFormat->pattern)) {
866
+				foreach ($this->getChildsOrAlias($itemLength) as $itemFormat) {
867
+					if ($itemFormat->getName() == $name) {
868
+						if (isset($itemFormat->pattern)) {
869 869
 							$data[$dataIdxName][$itemLengthName] = $this->unescape($itemFormat->pattern->getValue());
870 870
 						}
871 871
 					} else {
@@ -892,9 +892,9 @@  discard block
 block discarded – undo
892 892
 	 */
893 893
 	protected function getChildsOrAlias(ConfigValueHolder $item)
894 894
 	{
895
-		if(isset($item->alias)) {
895
+		if (isset($item->alias)) {
896 896
 			$alias = $item->alias;
897
-			if($alias->getAttribute('source') != 'locale') {
897
+			if ($alias->getAttribute('source') != 'locale') {
898 898
 				throw new AgaviException('The alias handling doesn\'t support any source except locale (' . $alias->getAttribute('source') . ' was given)');
899 899
 			}
900 900
 
@@ -902,14 +902,14 @@  discard block
 block discarded – undo
902 902
 
903 903
 			$currentNodeId = $item->getAttribute('__agavi_node_id');
904 904
 			
905
-			foreach($pathParts as $part) {
905
+			foreach ($pathParts as $part) {
906 906
 				// select the parent node
907
-				if($part == '..') {
907
+				if ($part == '..') {
908 908
 					$currentNodeId = $this->nodeRefs[$currentNodeId]->getAttribute('__agavi_parent_id');
909 909
 				} else {
910 910
 					$predicates = array();
911
-					if(preg_match('#([^\[]+)\[([^\]]+)\]#', $part, $match)) {
912
-						if(!preg_match('#@([^=]+)=\'([^\']+)\'#', $match[2], $predMatch)) {
911
+					if (preg_match('#([^\[]+)\[([^\]]+)\]#', $part, $match)) {
912
+						if (!preg_match('#@([^=]+)=\'([^\']+)\'#', $match[2], $predMatch)) {
913 913
 							throw new AgaviException('Unknown predicate ' . $match[2] . ' in alias xpath spec');
914 914
 						}
915 915
 						$tagName = $match[1];
@@ -917,21 +917,21 @@  discard block
 block discarded – undo
917 917
 					} else {
918 918
 						$tagName = $part;
919 919
 					}
920
-					foreach($this->nodeRefs[$currentNodeId]->getChildren() as $childNode) {
920
+					foreach ($this->nodeRefs[$currentNodeId]->getChildren() as $childNode) {
921 921
 						$isSearchedNode = false;
922
-						if($childNode->getName() == $tagName) {
922
+						if ($childNode->getName() == $tagName) {
923 923
 							$predMatches = 0;
924
-							foreach($predicates as $attrib => $value) {
925
-								if($childNode->getAttribute($attrib) == $value) {
924
+							foreach ($predicates as $attrib => $value) {
925
+								if ($childNode->getAttribute($attrib) == $value) {
926 926
 									++$predMatches;
927 927
 								}
928 928
 							}
929
-							if($predMatches == count($predicates)) {
929
+							if ($predMatches == count($predicates)) {
930 930
 								$isSearchedNode = true;
931 931
 							}
932 932
 						}
933 933
 
934
-						if($isSearchedNode) {
934
+						if ($isSearchedNode) {
935 935
 							$currentNodeId = $childNode->getAttribute('__agavi_node_id');
936 936
 						}
937 937
 					}
@@ -961,18 +961,18 @@  discard block
 block discarded – undo
961 961
 	{
962 962
 		$output = '';
963 963
 		$hex = '[0-9A-Fa-f]';
964
-		$rx = '\\\\(\\\\|u' . $hex . '{4}|U' . $hex . '{8}|x' . $hex .'{1,2}|[0-7]{1,3}|.)';
965
-		if($handleQuotes) {
964
+		$rx = '\\\\(\\\\|u' . $hex . '{4}|U' . $hex . '{8}|x' . $hex . '{1,2}|[0-7]{1,3}|.)';
965
+		if ($handleQuotes) {
966 966
 			// needs to be < -1 to not confuse the algorithm in the first run
967 967
 			$lastClose = -2;
968
-			if(preg_match_all("#'(?:''|[^'])+'|" . $rx . "#", $input, $matches, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE)) {
968
+			if (preg_match_all("#'(?:''|[^'])+'|" . $rx . "#", $input, $matches, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE)) {
969 969
 				$output = $input;
970 970
 				$offsetMod = 0;
971 971
 				$ml = $matches[0];
972 972
 				$len = count($ml);
973
-				for($i = 0; $i < $len; ++ $i) {
973
+				for ($i = 0; $i < $len; ++ $i) {
974 974
 					$match = $ml[$i];
975
-					if($match[0][0] != '\'') {
975
+					if ($match[0][0] != '\'') {
976 976
 						// we check if there is a quoted string directly before or directly after the escape sequence
977 977
 						// by using the string lengths and the offset of the matches. Since an escape sequence directly before
978 978
 						// this sequence results in an quoted string we only check if its really a quoted string and not an
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
 						$oldLen = strlen($output);
983 983
 						$unescaped = $this->unescapeCallback(array($match[0], substr($match[0], 1)));
984 984
 						$unescaped = ($quoteBefore ? '' : '\'') . $unescaped . ($quoteAfter ? '' : '\'');
985
-						$replacedPartLen = strlen($match[0]) + ((int) $quoteBefore) + ((int) $quoteAfter);
985
+						$replacedPartLen = strlen($match[0]) + ((int)$quoteBefore) + ((int)$quoteAfter);
986 986
 						// replace the matched escape sequence with the unescaped one. we also replace the opening or closing quote
987 987
 						// from the quoted part before or after this escape sequence to include the unescaped string into the closed part
988 988
 						$output = substr_replace($output, $unescaped, $offsetMod + $match[1] + ($quoteBefore ? -1 : 0), $replacedPartLen);
@@ -1029,11 +1029,11 @@  discard block
 block discarded – undo
1029 1029
 		
1030 1030
 		$char = $matches[1][0];
1031 1031
 		$seq = substr($matches[1], 1);
1032
-		if($char == 'u' || $char == 'U' || $char == 'x') {
1032
+		if ($char == 'u' || $char == 'U' || $char == 'x') {
1033 1033
 			$res = html_entity_decode('&#x' . $seq . ';', ENT_QUOTES, 'utf-8');
1034
-		} elseif(is_numeric($char)) {
1034
+		} elseif (is_numeric($char)) {
1035 1035
 			$res = html_entity_decode('&#' . octdec($matches[1]) . ';', ENT_QUOTES, 'utf-8');
1036
-		} elseif(isset($map[$char])) {
1036
+		} elseif (isset($map[$char])) {
1037 1037
 			$res = $map[$char];
1038 1038
 		} else {
1039 1039
 			$res = $char; // something like \s or \0 or so, just return the character ("s" or "0")
Please login to merge, or discard this patch.
Indentation   +821 added lines, -821 removed lines patch added patch discarded remove patch
@@ -34,135 +34,135 @@  discard block
 block discarded – undo
34 34
  */
35 35
 class LdmlConfigHandler extends ConfigHandler
36 36
 {
37
-	protected $nodeRefs = array();
38
-
39
-	/**
40
-	 * Execute this configuration handler.
41
-	 *
42
-	 * @param      string $config  An absolute filesystem path to a configuration file.
43
-	 * @param      string $context An optional context in which we are currently running.
44
-	 *
45
-	 * @return     string Data to be written to a cache file.
46
-	 *
47
-	 * @throws     <b>AgaviUnreadableException</b> If a requested configuration
48
-	 *                                             file does not exist or is not
49
-	 *                                             readable.
50
-	 * @throws     <b>AgaviParseException</b> If a requested configuration file is
51
-	 *                                        improperly formatted.
52
-	 *
53
-	 * @author     Dominik del Bondio <[email protected]>
54
-	 * @since      0.11.0
55
-	 */
56
-	public function execute($config, $context = null)
57
-	{
58
-		$pathParts = pathinfo($config);
59
-		// unlike basename, filename does not contain the extension, which is what we need there
60
-		$lookupPaths = Locale::getLookupPath($pathParts['filename']);
61
-		$lookupPaths[] = 'root';
62
-
63
-		$data = array(
64
-			'layout' => array('orientation' => array('lines' => 'top-to-bottom', 'characters' => 'left-to-right')),
65
-		);
66
-
67
-		foreach(array_reverse($lookupPaths) as $basename) {
68
-			$filePath = $pathParts['dirname'] . '/' . $basename . '.' . $pathParts['extension'];
69
-			if(is_readable($filePath)) {
70
-				$ldmlTree = ConfigCache::parseConfig($filePath, false, $this->getValidationFile(), $this->parser);
71
-				$this->prepareParentInformation($ldmlTree);
72
-				$this->parseLdmlTree($ldmlTree->ldml, $data);
73
-			}
74
-		}
75
-
76
-		$dayMap = array(
77
-										'sun' => DateDefinitions::SUNDAY,
78
-										'mon' => DateDefinitions::MONDAY,
79
-										'tue' => DateDefinitions::TUESDAY,
80
-										'wed' => DateDefinitions::WEDNESDAY,
81
-										'thu' => DateDefinitions::THURSDAY,
82
-										'fri' => DateDefinitions::FRIDAY,
83
-										'sat' => DateDefinitions::SATURDAY,
84
-		);
85
-
86
-		// fix the day indices for all day fields
87
-		foreach($data['calendars'] as $calKey => &$calValue) {
88
-			// skip the 'default' => '' key => value pair
89
-			if(is_array($calValue)) {
90
-				if(isset($calValue['days']['format'])) {
91
-					foreach($calValue['days']['format'] as $formatKey => &$formatValue) {
92
-						if(is_array($formatValue)) {
93
-							$newData = array();
94
-							foreach($formatValue as $day => $value) {
95
-								$newData[$dayMap[$day]] = $value;
96
-							}
97
-							$formatValue = $newData;
98
-						}
99
-					}
100
-				}
101
-
102
-				if(isset($calValue['days']['stand-alone'])) {
103
-					foreach($calValue['days']['stand-alone'] as $formatKey => &$formatValue) {
104
-						if(is_array($formatValue)) {
105
-							$newData = array();
106
-							foreach($formatValue as $day => $value) {
107
-								$newData[$dayMap[$day]] = $value;
108
-							}
109
-							$formatValue = $newData;
110
-						}
111
-					}
112
-				}
113
-			}
114
-		}
115
-
116
-		$code = array();
117
-		$code[] = 'return ' . var_export($data, true) . ';';
118
-
119
-		return $this->generate($code, $config);
120
-	}
121
-
122
-	/**
123
-	 * Prepares the parent information for the given ldml tree.
124
-	 *
125
-	 * @param      ConfigValueHolder $ldmlTree The ldml tree.
126
-	 *
127
-	 * @author     Dominik del Bondio <[email protected]>
128
-	 * @since      0.11.0
129
-	 */
130
-	protected function prepareParentInformation($ldmlTree)
131
-	{
132
-		$this->nodeRefs = array();
133
-		$i = 0;
134
-		$ldmlTree->setAttribute('__agavi_node_id', $i);
135
-		$ldmlTree->setAttribute('__agavi_parent_id', null);
136
-		$this->nodeRefs[$i] = $ldmlTree;
137
-		++$i;
138
-		if($ldmlTree->hasChildren()) {
139
-			$this->generateParentInformation($ldmlTree->getChildren(), $i, 0);
140
-		}
141
-	}
142
-
143
-	/**
144
-	 * Generates the parent information for the given ldml subtree.
145
-	 *
146
-	 * @param      ConfigValueHolder[] $childList The ldml node.
147
-	 * @param	   int                 $nextId
148
-	 * @param      int                 $parentId
149
-	 *
150
-	 * @author     Dominik del Bondio <[email protected]>
151
-	 * @since      0.11.0
152
-	 */
153
-	protected function generateParentInformation($childList, &$nextId, $parentId)
154
-	{
155
-		/** @var ConfigValueHolder $child */
156
-		foreach($childList as $child) {
157
-			$child->setAttribute('__agavi_node_id', $nextId);
158
-			$child->setAttribute('__agavi_parent_id', $parentId);
159
-			$this->nodeRefs[$nextId] = $child;
160
-			++$nextId;
161
-			if($child->hasChildren()) {
162
-				$this->generateParentInformation($child->getChildren(), $nextId, $child->getAttribute('__agavi_node_id'));
163
-			}
164
-		}
165
-	}
37
+    protected $nodeRefs = array();
38
+
39
+    /**
40
+     * Execute this configuration handler.
41
+     *
42
+     * @param      string $config  An absolute filesystem path to a configuration file.
43
+     * @param      string $context An optional context in which we are currently running.
44
+     *
45
+     * @return     string Data to be written to a cache file.
46
+     *
47
+     * @throws     <b>AgaviUnreadableException</b> If a requested configuration
48
+     *                                             file does not exist or is not
49
+     *                                             readable.
50
+     * @throws     <b>AgaviParseException</b> If a requested configuration file is
51
+     *                                        improperly formatted.
52
+     *
53
+     * @author     Dominik del Bondio <[email protected]>
54
+     * @since      0.11.0
55
+     */
56
+    public function execute($config, $context = null)
57
+    {
58
+        $pathParts = pathinfo($config);
59
+        // unlike basename, filename does not contain the extension, which is what we need there
60
+        $lookupPaths = Locale::getLookupPath($pathParts['filename']);
61
+        $lookupPaths[] = 'root';
62
+
63
+        $data = array(
64
+            'layout' => array('orientation' => array('lines' => 'top-to-bottom', 'characters' => 'left-to-right')),
65
+        );
66
+
67
+        foreach(array_reverse($lookupPaths) as $basename) {
68
+            $filePath = $pathParts['dirname'] . '/' . $basename . '.' . $pathParts['extension'];
69
+            if(is_readable($filePath)) {
70
+                $ldmlTree = ConfigCache::parseConfig($filePath, false, $this->getValidationFile(), $this->parser);
71
+                $this->prepareParentInformation($ldmlTree);
72
+                $this->parseLdmlTree($ldmlTree->ldml, $data);
73
+            }
74
+        }
75
+
76
+        $dayMap = array(
77
+                                        'sun' => DateDefinitions::SUNDAY,
78
+                                        'mon' => DateDefinitions::MONDAY,
79
+                                        'tue' => DateDefinitions::TUESDAY,
80
+                                        'wed' => DateDefinitions::WEDNESDAY,
81
+                                        'thu' => DateDefinitions::THURSDAY,
82
+                                        'fri' => DateDefinitions::FRIDAY,
83
+                                        'sat' => DateDefinitions::SATURDAY,
84
+        );
85
+
86
+        // fix the day indices for all day fields
87
+        foreach($data['calendars'] as $calKey => &$calValue) {
88
+            // skip the 'default' => '' key => value pair
89
+            if(is_array($calValue)) {
90
+                if(isset($calValue['days']['format'])) {
91
+                    foreach($calValue['days']['format'] as $formatKey => &$formatValue) {
92
+                        if(is_array($formatValue)) {
93
+                            $newData = array();
94
+                            foreach($formatValue as $day => $value) {
95
+                                $newData[$dayMap[$day]] = $value;
96
+                            }
97
+                            $formatValue = $newData;
98
+                        }
99
+                    }
100
+                }
101
+
102
+                if(isset($calValue['days']['stand-alone'])) {
103
+                    foreach($calValue['days']['stand-alone'] as $formatKey => &$formatValue) {
104
+                        if(is_array($formatValue)) {
105
+                            $newData = array();
106
+                            foreach($formatValue as $day => $value) {
107
+                                $newData[$dayMap[$day]] = $value;
108
+                            }
109
+                            $formatValue = $newData;
110
+                        }
111
+                    }
112
+                }
113
+            }
114
+        }
115
+
116
+        $code = array();
117
+        $code[] = 'return ' . var_export($data, true) . ';';
118
+
119
+        return $this->generate($code, $config);
120
+    }
121
+
122
+    /**
123
+     * Prepares the parent information for the given ldml tree.
124
+     *
125
+     * @param      ConfigValueHolder $ldmlTree The ldml tree.
126
+     *
127
+     * @author     Dominik del Bondio <[email protected]>
128
+     * @since      0.11.0
129
+     */
130
+    protected function prepareParentInformation($ldmlTree)
131
+    {
132
+        $this->nodeRefs = array();
133
+        $i = 0;
134
+        $ldmlTree->setAttribute('__agavi_node_id', $i);
135
+        $ldmlTree->setAttribute('__agavi_parent_id', null);
136
+        $this->nodeRefs[$i] = $ldmlTree;
137
+        ++$i;
138
+        if($ldmlTree->hasChildren()) {
139
+            $this->generateParentInformation($ldmlTree->getChildren(), $i, 0);
140
+        }
141
+    }
142
+
143
+    /**
144
+     * Generates the parent information for the given ldml subtree.
145
+     *
146
+     * @param      ConfigValueHolder[] $childList The ldml node.
147
+     * @param	   int                 $nextId
148
+     * @param      int                 $parentId
149
+     *
150
+     * @author     Dominik del Bondio <[email protected]>
151
+     * @since      0.11.0
152
+     */
153
+    protected function generateParentInformation($childList, &$nextId, $parentId)
154
+    {
155
+        /** @var ConfigValueHolder $child */
156
+        foreach($childList as $child) {
157
+            $child->setAttribute('__agavi_node_id', $nextId);
158
+            $child->setAttribute('__agavi_parent_id', $parentId);
159
+            $this->nodeRefs[$nextId] = $child;
160
+            ++$nextId;
161
+            if($child->hasChildren()) {
162
+                $this->generateParentInformation($child->getChildren(), $nextId, $child->getAttribute('__agavi_node_id'));
163
+            }
164
+        }
165
+    }
166 166
 
167 167
 /*
168 168
 
@@ -336,711 +336,711 @@  discard block
 block discarded – undo
336 336
 			
337 337
 */
338 338
 
339
-	/**
340
-	 * Generates the array used by AgaviLocale from an LDML tree.
341
-	 *
342
-	 * @param      ConfigValueHolder $ldmlTree The ldml tree.
343
-	 * @param      array             $data     The array to store the parsed data to.
344
-	 *
345
-	 * @return     array The array with the data.
346
-	 *
347
-	 * @author     Dominik del Bondio <[email protected]>
348
-	 * @since      0.11.0
349
-	 */
350
-	public function parseLdmlTree($ldmlTree, &$data)
351
-	{
352
-
353
-		if(isset($ldmlTree->identity)) {
354
-			$data['locale']['language'] = $ldmlTree->identity->language->getAttribute('type');
355
-			if(isset($ldmlTree->identity->territory)) {
356
-				$data['locale']['territory'] = $ldmlTree->identity->territory->getAttribute('type');
357
-			}
358
-			if(isset($ldmlTree->identity->script)) {
359
-				$data['locale']['script'] = $ldmlTree->identity->script->getAttribute('type');
360
-			}
361
-			if(isset($ldmlTree->identity->variant)) {
362
-				$data['locale']['variant'] = $ldmlTree->identity->variant->getAttribute('type');
363
-			}
364
-		}
365
-
366
-		if(isset($ldmlTree->localeDisplayNames)) {
367
-			$ldn = $ldmlTree->localeDisplayNames;
368
-
369
-			if(isset($ldn->languages)) {
370
-				$data['displayNames']['languages'] = isset($data['displayNames']['languages']) ? $data['displayNames']['languages'] : array();
371
-				$this->getTypeList($ldn->languages, $data['displayNames']['languages']);
372
-			}
373
-
374
-			if(isset($ldn->scripts)) {
375
-				$data['displayNames']['scripts'] = isset($data['displayNames']['scripts']) ? $data['displayNames']['scripts'] : array();
376
-				$this->getTypeList($ldn->scripts, $data['displayNames']['scripts']);
377
-			}
378
-
379
-			if(isset($ldn->territories)) {
380
-				$data['displayNames']['territories'] = isset($data['displayNames']['territories']) ? $data['displayNames']['territories'] : array();
381
-				$this->getTypeList($ldn->territories, $data['displayNames']['territories']);
382
-			}
383
-
384
-			if(isset($ldn->variants)) {
385
-				$data['displayNames']['variants'] = isset($data['displayNames']['variants']) ? $data['displayNames']['variants'] : array();
386
-				$this->getTypeList($ldn->variants, $data['displayNames']['variants']);
387
-			}
388
-
389
-			if(isset($ldn->keys)) {
390
-				$data['displayNames']['keys'] = isset($data['displayNames']['keys']) ? $data['displayNames']['keys'] : array();
391
-				$this->getTypeList($ldn->keys, $data['displayNames']['keys']);
392
-			}
393
-
394
-			/*
339
+    /**
340
+     * Generates the array used by AgaviLocale from an LDML tree.
341
+     *
342
+     * @param      ConfigValueHolder $ldmlTree The ldml tree.
343
+     * @param      array             $data     The array to store the parsed data to.
344
+     *
345
+     * @return     array The array with the data.
346
+     *
347
+     * @author     Dominik del Bondio <[email protected]>
348
+     * @since      0.11.0
349
+     */
350
+    public function parseLdmlTree($ldmlTree, &$data)
351
+    {
352
+
353
+        if(isset($ldmlTree->identity)) {
354
+            $data['locale']['language'] = $ldmlTree->identity->language->getAttribute('type');
355
+            if(isset($ldmlTree->identity->territory)) {
356
+                $data['locale']['territory'] = $ldmlTree->identity->territory->getAttribute('type');
357
+            }
358
+            if(isset($ldmlTree->identity->script)) {
359
+                $data['locale']['script'] = $ldmlTree->identity->script->getAttribute('type');
360
+            }
361
+            if(isset($ldmlTree->identity->variant)) {
362
+                $data['locale']['variant'] = $ldmlTree->identity->variant->getAttribute('type');
363
+            }
364
+        }
365
+
366
+        if(isset($ldmlTree->localeDisplayNames)) {
367
+            $ldn = $ldmlTree->localeDisplayNames;
368
+
369
+            if(isset($ldn->languages)) {
370
+                $data['displayNames']['languages'] = isset($data['displayNames']['languages']) ? $data['displayNames']['languages'] : array();
371
+                $this->getTypeList($ldn->languages, $data['displayNames']['languages']);
372
+            }
373
+
374
+            if(isset($ldn->scripts)) {
375
+                $data['displayNames']['scripts'] = isset($data['displayNames']['scripts']) ? $data['displayNames']['scripts'] : array();
376
+                $this->getTypeList($ldn->scripts, $data['displayNames']['scripts']);
377
+            }
378
+
379
+            if(isset($ldn->territories)) {
380
+                $data['displayNames']['territories'] = isset($data['displayNames']['territories']) ? $data['displayNames']['territories'] : array();
381
+                $this->getTypeList($ldn->territories, $data['displayNames']['territories']);
382
+            }
383
+
384
+            if(isset($ldn->variants)) {
385
+                $data['displayNames']['variants'] = isset($data['displayNames']['variants']) ? $data['displayNames']['variants'] : array();
386
+                $this->getTypeList($ldn->variants, $data['displayNames']['variants']);
387
+            }
388
+
389
+            if(isset($ldn->keys)) {
390
+                $data['displayNames']['keys'] = isset($data['displayNames']['keys']) ? $data['displayNames']['keys'] : array();
391
+                $this->getTypeList($ldn->keys, $data['displayNames']['keys']);
392
+            }
393
+
394
+            /*
395 395
 			// not needed right now
396 396
 			if(isset($ldn->types)) {
397 397
 			}
398 398
 			*/
399 399
 
400
-			if(isset($ldn->measurementSystemNames)) {
401
-				$data['displayNames']['measurementSystemNames'] = isset($data['displayNames']['measurementSystemNames']) ? $data['displayNames']['measurementSystemNames'] : array();
402
-				$this->getTypeList($ldn->measurementSystemNames, $data['displayNames']['measurementSystemNames']);
403
-			}
404
-		}
405
-
406
-		if(isset($ldmlTree->layout->orientation)) {
407
-			$ori = $ldmlTree->layout->orientation;
408
-
409
-			$data['layout']['orientation']['lines'] = $ori->getAttribute('lines', $data['layout']['orientation']['lines']);
410
-			$data['layout']['orientation']['characters'] = $ori->getAttribute('characters', $data['layout']['orientation']['characters']);
411
-		}
412
-
413
-		if(isset($ldmlTree->delimiters)) {
414
-			$delims = $ldmlTree->delimiters;
415
-
416
-			if(isset($delims->quotationStart)) {
417
-				$data['delimiters']['quotationStart'] = $this->unescape($delims->quotationStart->getValue());
418
-			}
419
-			if(isset($delims->quotationEnd)) {
420
-				$data['delimiters']['quotationEnd'] = $this->unescape($delims->quotationEnd->getValue());
421
-			}
422
-			if(isset($delims->alternateQuotationStart)) {
423
-				$data['delimiters']['alternateQuotationStart'] = $this->unescape($delims->alternateQuotationStart->getValue());
424
-			}
425
-			if(isset($delims->alternateQuotationEnd)) {
426
-				$data['delimiters']['alternateQuotationEnd'] = $this->unescape($delims->alternateQuotationEnd->getValue());
427
-			}
428
-		}
429
-
430
-		if(isset($ldmlTree->dates)) {
431
-			$dates = $ldmlTree->dates;
432
-
433
-			if(isset($dates->calendars)) {
434
-				$cals = $dates->calendars;
435
-
436
-				foreach($cals as $calendar) {
437
-
438
-					if($calendar->getName() == 'default') {
439
-						$data['calendars']['default'] = $calendar->getAttribute('choice');
440
-					} elseif($calendar->getName() == 'calendar') {
441
-						$calendarName = $calendar->getAttribute('type');
442
-
443
-						if(!isset($data['calendars'][$calendarName])) {
444
-							$data['calendars'][$calendarName] = array();
445
-						}
446
-
447
-						if(isset($calendar->months)) {
448
-							$this->getCalendarWidth($calendar->months, 'month', $data['calendars'][$calendarName]);
449
-						}
450
-
451
-						if(isset($calendar->days)) {
452
-							$this->getCalendarWidth($calendar->days, 'day', $data['calendars'][$calendarName]);
453
-						}
454
-
455
-						if(isset($calendar->quarters)) {
456
-							$this->getCalendarWidth($calendar->quarters, 'quarter', $data['calendars'][$calendarName]);
457
-						}
458
-
459
-						if(isset($calendar->am)) {
460
-							$data['calendars'][$calendarName]['am'] = $this->unescape($calendar->am->getValue());
461
-						}
462
-						if(isset($calendar->pm)) {
463
-							$data['calendars'][$calendarName]['pm'] = $this->unescape($calendar->pm->getValue());
464
-						}
465
-
466
-						if(isset($calendar->eras)) {
467
-							if(isset($calendar->eras->eraNames)) {
468
-								foreach($this->getChildsOrAlias($calendar->eras->eraNames) as $era) {
469
-									$data['calendars'][$calendarName]['eras']['wide'][$era->getAttribute('type')] = $this->unescape($era->getValue());
470
-								}
471
-							}
472
-							if(isset($calendar->eras->eraAbbr)) {
473
-								foreach($this->getChildsOrAlias($calendar->eras->eraAbbr) as $era) {
474
-									$data['calendars'][$calendarName]['eras']['abbreviated'][$era->getAttribute('type')] = $this->unescape($era->getValue());
475
-								}
476
-							}
477
-							if(isset($calendar->eras->eraNarrow)) {
478
-								foreach($this->getChildsOrAlias($calendar->eras->eraNarrow) as $era) {
479
-									$data['calendars'][$calendarName]['eras']['narrow'][$era->getAttribute('type')] = $this->unescape($era->getValue());
480
-								}
481
-							}
482
-						}
483
-
484
-						if(isset($calendar->dateFormats)) {
485
-							$this->getDateOrTimeFormats($calendar->dateFormats, 'dateFormat', $data['calendars'][$calendarName]);
486
-						}
487
-						if(isset($calendar->timeFormats)) {
488
-							$this->getDateOrTimeFormats($calendar->timeFormats, 'timeFormat', $data['calendars'][$calendarName]);
489
-						}
490
-
491
-						if(isset($calendar->dateTimeFormats)) {
492
-							$dtf = $calendar->dateTimeFormats;
493
-							$data['calendars'][$calendarName]['dateTimeFormats']['default'] = isset($dtf->default) ? $dtf->default->getAttribute('choice') : '__default';
494
-
495
-							$dtfItems = $this->getChildsOrAlias($dtf);
496
-							foreach($dtfItems as $item) {
497
-								if($item->getName() == 'dateTimeFormatLength') {
498
-									if(isset($item->dateTimeFormat->pattern)) {
499
-										$data['calendars'][$calendarName]['dateTimeFormats']['formats'][$item->getAttribute('type', '__default')] = $this->unescape($item->dateTimeFormat->pattern->getValue(), true);
500
-									} else {
501
-										throw new AgaviException('unknown child content in dateTimeFormatLength tag');
502
-									}
503
-								} elseif($item->getName() == 'availableFormats') {
504
-									foreach($item as $dateFormatItem) {
505
-										if($dateFormatItem->getName() != 'dateFormatItem') {
506
-											throw new AgaviException('unknown childtag "' . $dateFormatItem->getName() . '" in availableFormats tag');
507
-										}
508
-										$data['calendars'][$calendarName]['dateTimeFormats']['availableFormats'][$dateFormatItem->getAttribute('id')] = $this->unescape($dateFormatItem->getValue(), true);
509
-									}
510
-								} elseif($item->getName() == 'appendItems') {
511
-									foreach($item as $appendItem) {
512
-										if($appendItem->getName() != 'appendItem') {
513
-											throw new AgaviException('unknown childtag "' . $appendItem->getName() . '" in appendItems tag');
514
-										}
515
-										$data['calendars'][$calendarName]['dateTimeFormats']['appendItems'][$appendItem->getAttribute('request')] = $this->unescape($appendItem->getValue(), true);
516
-									}
517
-								} elseif($item->getName() != 'default') {
518
-									throw new AgaviException('unknown childtag "' . $item->getName() . '" in dateTimeFormats tag');
519
-								}
520
-							}
521
-						}
522
-
523
-						if(isset($calendar->fields)) {
524
-							foreach($this->getChildsOrAlias($calendar->fields) as $field) {
525
-								$type = $field->getAttribute('type');
526
-								if(isset($field->displayName)) {
527
-									$data['calendars'][$calendarName]['fields'][$type]['displayName'] = $this->unescape($field->displayName->getValue());
528
-								}
529
-								if(isset($field->relative)) {
530
-									foreach($field as $relative) {
531
-										if($relative->getName() == 'relative') {
532
-											$data['calendars'][$calendarName]['fields'][$type]['relatives'][$relative->getAttribute('type')] = $this->unescape($relative->getValue());
533
-										}
534
-									}
535
-								}
536
-							}
537
-						}
538
-					} else {
539
-						throw new AgaviException('unknown childtag "' . $calendar->getName() . '" in calendars tag');
540
-					}
541
-				}
542
-			}
400
+            if(isset($ldn->measurementSystemNames)) {
401
+                $data['displayNames']['measurementSystemNames'] = isset($data['displayNames']['measurementSystemNames']) ? $data['displayNames']['measurementSystemNames'] : array();
402
+                $this->getTypeList($ldn->measurementSystemNames, $data['displayNames']['measurementSystemNames']);
403
+            }
404
+        }
405
+
406
+        if(isset($ldmlTree->layout->orientation)) {
407
+            $ori = $ldmlTree->layout->orientation;
408
+
409
+            $data['layout']['orientation']['lines'] = $ori->getAttribute('lines', $data['layout']['orientation']['lines']);
410
+            $data['layout']['orientation']['characters'] = $ori->getAttribute('characters', $data['layout']['orientation']['characters']);
411
+        }
412
+
413
+        if(isset($ldmlTree->delimiters)) {
414
+            $delims = $ldmlTree->delimiters;
415
+
416
+            if(isset($delims->quotationStart)) {
417
+                $data['delimiters']['quotationStart'] = $this->unescape($delims->quotationStart->getValue());
418
+            }
419
+            if(isset($delims->quotationEnd)) {
420
+                $data['delimiters']['quotationEnd'] = $this->unescape($delims->quotationEnd->getValue());
421
+            }
422
+            if(isset($delims->alternateQuotationStart)) {
423
+                $data['delimiters']['alternateQuotationStart'] = $this->unescape($delims->alternateQuotationStart->getValue());
424
+            }
425
+            if(isset($delims->alternateQuotationEnd)) {
426
+                $data['delimiters']['alternateQuotationEnd'] = $this->unescape($delims->alternateQuotationEnd->getValue());
427
+            }
428
+        }
429
+
430
+        if(isset($ldmlTree->dates)) {
431
+            $dates = $ldmlTree->dates;
432
+
433
+            if(isset($dates->calendars)) {
434
+                $cals = $dates->calendars;
435
+
436
+                foreach($cals as $calendar) {
437
+
438
+                    if($calendar->getName() == 'default') {
439
+                        $data['calendars']['default'] = $calendar->getAttribute('choice');
440
+                    } elseif($calendar->getName() == 'calendar') {
441
+                        $calendarName = $calendar->getAttribute('type');
442
+
443
+                        if(!isset($data['calendars'][$calendarName])) {
444
+                            $data['calendars'][$calendarName] = array();
445
+                        }
446
+
447
+                        if(isset($calendar->months)) {
448
+                            $this->getCalendarWidth($calendar->months, 'month', $data['calendars'][$calendarName]);
449
+                        }
450
+
451
+                        if(isset($calendar->days)) {
452
+                            $this->getCalendarWidth($calendar->days, 'day', $data['calendars'][$calendarName]);
453
+                        }
454
+
455
+                        if(isset($calendar->quarters)) {
456
+                            $this->getCalendarWidth($calendar->quarters, 'quarter', $data['calendars'][$calendarName]);
457
+                        }
458
+
459
+                        if(isset($calendar->am)) {
460
+                            $data['calendars'][$calendarName]['am'] = $this->unescape($calendar->am->getValue());
461
+                        }
462
+                        if(isset($calendar->pm)) {
463
+                            $data['calendars'][$calendarName]['pm'] = $this->unescape($calendar->pm->getValue());
464
+                        }
465
+
466
+                        if(isset($calendar->eras)) {
467
+                            if(isset($calendar->eras->eraNames)) {
468
+                                foreach($this->getChildsOrAlias($calendar->eras->eraNames) as $era) {
469
+                                    $data['calendars'][$calendarName]['eras']['wide'][$era->getAttribute('type')] = $this->unescape($era->getValue());
470
+                                }
471
+                            }
472
+                            if(isset($calendar->eras->eraAbbr)) {
473
+                                foreach($this->getChildsOrAlias($calendar->eras->eraAbbr) as $era) {
474
+                                    $data['calendars'][$calendarName]['eras']['abbreviated'][$era->getAttribute('type')] = $this->unescape($era->getValue());
475
+                                }
476
+                            }
477
+                            if(isset($calendar->eras->eraNarrow)) {
478
+                                foreach($this->getChildsOrAlias($calendar->eras->eraNarrow) as $era) {
479
+                                    $data['calendars'][$calendarName]['eras']['narrow'][$era->getAttribute('type')] = $this->unescape($era->getValue());
480
+                                }
481
+                            }
482
+                        }
483
+
484
+                        if(isset($calendar->dateFormats)) {
485
+                            $this->getDateOrTimeFormats($calendar->dateFormats, 'dateFormat', $data['calendars'][$calendarName]);
486
+                        }
487
+                        if(isset($calendar->timeFormats)) {
488
+                            $this->getDateOrTimeFormats($calendar->timeFormats, 'timeFormat', $data['calendars'][$calendarName]);
489
+                        }
490
+
491
+                        if(isset($calendar->dateTimeFormats)) {
492
+                            $dtf = $calendar->dateTimeFormats;
493
+                            $data['calendars'][$calendarName]['dateTimeFormats']['default'] = isset($dtf->default) ? $dtf->default->getAttribute('choice') : '__default';
494
+
495
+                            $dtfItems = $this->getChildsOrAlias($dtf);
496
+                            foreach($dtfItems as $item) {
497
+                                if($item->getName() == 'dateTimeFormatLength') {
498
+                                    if(isset($item->dateTimeFormat->pattern)) {
499
+                                        $data['calendars'][$calendarName]['dateTimeFormats']['formats'][$item->getAttribute('type', '__default')] = $this->unescape($item->dateTimeFormat->pattern->getValue(), true);
500
+                                    } else {
501
+                                        throw new AgaviException('unknown child content in dateTimeFormatLength tag');
502
+                                    }
503
+                                } elseif($item->getName() == 'availableFormats') {
504
+                                    foreach($item as $dateFormatItem) {
505
+                                        if($dateFormatItem->getName() != 'dateFormatItem') {
506
+                                            throw new AgaviException('unknown childtag "' . $dateFormatItem->getName() . '" in availableFormats tag');
507
+                                        }
508
+                                        $data['calendars'][$calendarName]['dateTimeFormats']['availableFormats'][$dateFormatItem->getAttribute('id')] = $this->unescape($dateFormatItem->getValue(), true);
509
+                                    }
510
+                                } elseif($item->getName() == 'appendItems') {
511
+                                    foreach($item as $appendItem) {
512
+                                        if($appendItem->getName() != 'appendItem') {
513
+                                            throw new AgaviException('unknown childtag "' . $appendItem->getName() . '" in appendItems tag');
514
+                                        }
515
+                                        $data['calendars'][$calendarName]['dateTimeFormats']['appendItems'][$appendItem->getAttribute('request')] = $this->unescape($appendItem->getValue(), true);
516
+                                    }
517
+                                } elseif($item->getName() != 'default') {
518
+                                    throw new AgaviException('unknown childtag "' . $item->getName() . '" in dateTimeFormats tag');
519
+                                }
520
+                            }
521
+                        }
522
+
523
+                        if(isset($calendar->fields)) {
524
+                            foreach($this->getChildsOrAlias($calendar->fields) as $field) {
525
+                                $type = $field->getAttribute('type');
526
+                                if(isset($field->displayName)) {
527
+                                    $data['calendars'][$calendarName]['fields'][$type]['displayName'] = $this->unescape($field->displayName->getValue());
528
+                                }
529
+                                if(isset($field->relative)) {
530
+                                    foreach($field as $relative) {
531
+                                        if($relative->getName() == 'relative') {
532
+                                            $data['calendars'][$calendarName]['fields'][$type]['relatives'][$relative->getAttribute('type')] = $this->unescape($relative->getValue());
533
+                                        }
534
+                                    }
535
+                                }
536
+                            }
537
+                        }
538
+                    } else {
539
+                        throw new AgaviException('unknown childtag "' . $calendar->getName() . '" in calendars tag');
540
+                    }
541
+                }
542
+            }
543 543
 			
544
-			if(isset($dates->timeZoneNames)) {
545
-				$tzn = $dates->timeZoneNames;
546
-				if(isset($tzn->hourFormat)) {
547
-					$data['timeZoneNames']['hourFormat'] = $this->unescape($tzn->hourFormat->getValue());
548
-				}
549
-				if(isset($tzn->hoursFormat)) {
550
-					$data['timeZoneNames']['hoursFormat'] = $this->unescape($tzn->hoursFormat->getValue());
551
-				}
552
-				if(isset($tzn->gmtFormat)) {
553
-					$data['timeZoneNames']['gmtFormat'] = $this->unescape($tzn->gmtFormat->getValue());
554
-				}
555
-				if(isset($tzn->regionFormat)) {
556
-					$data['timeZoneNames']['regionFormat'] = $this->unescape($tzn->regionFormat->getValue());
557
-				}
558
-				if(isset($tzn->fallbackFormat)) {
559
-					$data['timeZoneNames']['fallbackFormat'] = $this->unescape($tzn->fallbackFormat->getValue());
560
-				}
561
-				if(isset($tzn->abbreviationFallback)) {
562
-					$data['timeZoneNames']['abbreviationFallback'] = $tzn->abbreviationFallback->getAttribute('choice');
563
-				}
564
-				if(isset($tzn->singleCountries)) {
565
-					$data['timeZoneNames']['singleCountries'] = explode(' ', $tzn->singleCountries->getAttribute('list'));
566
-				}
567
-
568
-				foreach($tzn as $zone) {
569
-					$zoneName = $zone->getAttribute('type');
570
-					if($zone->getName() == 'zone') {
571
-						if(isset($zone->long->generic)) {
572
-							$data['timeZoneNames']['zones'][$zoneName]['long']['generic'] = $this->unescape($zone->long->generic->getValue());
573
-						}
574
-						if(isset($zone->long->standard)) {
575
-							$data['timeZoneNames']['zones'][$zoneName]['long']['standard'] = $this->unescape($zone->long->standard->getValue());
576
-						}
577
-						if(isset($zone->long->daylight)) {
578
-							$data['timeZoneNames']['zones'][$zoneName]['long']['daylight'] = $this->unescape($zone->long->daylight->getValue());
579
-						}
580
-						if(isset($zone->short->generic)) {
581
-							$data['timeZoneNames']['zones'][$zoneName]['short']['generic'] = $this->unescape($zone->short->generic->getValue());
582
-						}
583
-						if(isset($zone->short->standard)) {
584
-							$data['timeZoneNames']['zones'][$zoneName]['short']['standard'] = $this->unescape($zone->short->standard->getValue());
585
-						}
586
-						if(isset($zone->short->daylight)) {
587
-							$data['timeZoneNames']['zones'][$zoneName]['short']['daylight'] = $this->unescape($zone->short->daylight->getValue());
588
-						}
589
-						if(isset($zone->exemplarCity)) {
590
-							$data['timeZoneNames']['zones'][$zoneName]['exemplarCity'] = $this->unescape($zone->exemplarCity->getValue());
591
-						}
592
-
593
-					}
594
-				}
595
-			}
596
-		}
597
-
598
-		if(isset($ldmlTree->numbers)) {
599
-			$nums = $ldmlTree->numbers;
600
-			if(!isset($data['numbers'])) {
601
-				$data['numbers'] = array();
602
-			}
603
-
604
-			if(isset($nums->symbols)) {
605
-				$syms = $nums->symbols;
606
-				if(isset($syms->decimal)) {
607
-					$data['numbers']['symbols']['decimal'] = $this->unescape($syms->decimal->getValue());
608
-				}
609
-				if(isset($syms->group)) {
610
-					$data['numbers']['symbols']['group'] = $this->unescape($syms->group->getValue());
611
-				}
612
-				if(isset($syms->list)) {
613
-					$data['numbers']['symbols']['list'] = $this->unescape($syms->list->getValue());
614
-				}
615
-				if(isset($syms->percentSign)) {
616
-					$data['numbers']['symbols']['percentSign'] = $this->unescape($syms->percentSign->getValue());
617
-				}
618
-				if(isset($syms->nativeZeroDigit)) {
619
-					$data['numbers']['symbols']['nativeZeroDigit'] = $this->unescape($syms->nativeZeroDigit->getValue());
620
-				}
621
-				if(isset($syms->patternDigit)) {
622
-					$data['numbers']['symbols']['patternDigit'] = $this->unescape($syms->patternDigit->getValue());
623
-				}
624
-				if(isset($syms->plusSign)) {
625
-					$data['numbers']['symbols']['plusSign'] = $this->unescape($syms->plusSign->getValue());
626
-				}
627
-				if(isset($syms->minusSign)) {
628
-					$data['numbers']['symbols']['minusSign'] = $this->unescape($syms->minusSign->getValue());
629
-				}
630
-				if(isset($syms->exponential)) {
631
-					$data['numbers']['symbols']['exponential'] = $this->unescape($syms->exponential->getValue());
632
-				}
633
-				if(isset($syms->perMille)) {
634
-					$data['numbers']['symbols']['perMille'] = $this->unescape($syms->perMille->getValue());
635
-				}
636
-				if(isset($syms->infinity)) {
637
-					$data['numbers']['symbols']['infinity'] = $this->unescape($syms->infinity->getValue());
638
-				}
639
-				if(isset($syms->nan)) {
640
-					$data['numbers']['symbols']['nan'] = $this->unescape($syms->nan->getValue());
641
-				}
642
-			}
643
-			if(isset($nums->decimalFormats)) {
644
-				$this->getNumberFormats($nums->decimalFormats, 'decimalFormat', $data['numbers']);
645
-			}
646
-			if(isset($nums->scientificFormats)) {
647
-				$this->getNumberFormats($nums->scientificFormats, 'scientificFormat', $data['numbers']);
648
-			}
649
-			if(isset($nums->percentFormats)) {
650
-				$this->getNumberFormats($nums->percentFormats, 'percentFormat', $data['numbers']);
651
-			}
652
-			if(isset($nums->currencyFormats)) {
653
-				$cf = $nums->currencyFormats;
654
-
655
-				foreach($this->getChildsOrAlias($cf) as $itemLength) {
656
-					if($itemLength->getName() == 'default') {
657
-						$data['numbers']['currencyFormats']['default'] = $itemLength->getAttribute('choice');
658
-					} elseif($itemLength->getName() == 'currencyFormatLength') {
659
-						$itemLengthName = $itemLength->getAttribute('type', '__default');
660
-
661
-						foreach($this->getChildsOrAlias($itemLength) as $itemFormat) {
662
-							if($itemFormat->getName() == 'currencyFormat') {
663
-								if(isset($itemFormat->pattern)) {
664
-									$data['numbers']['currencyFormats'][$itemLengthName] = $this->unescape($itemFormat->pattern->getValue());
665
-								}
666
-							} else {
667
-								throw new AgaviException('unknown childtag "' . $itemFormat->getName() . '" in currencyFormatLength tag');
668
-							}
669
-
670
-						}
671
-					} elseif($itemLength->getName() == 'currencySpacing') {
672
-
673
-						if(isset($itemLength->beforeCurrency->currencyMatch)) {
674
-							$data['numbers']['currencySpacing']['beforeCurrency']['currencyMatch'] = $this->unescape($itemLength->beforeCurrency->currencyMatch->getValue());
675
-						}
676
-						if(isset($itemLength->beforeCurrency->surroundingMatch)) {
677
-							$data['numbers']['currencySpacing']['beforeCurrency']['surroundingMatch'] = $this->unescape($itemLength->beforeCurrency->surroundingMatch->getValue());
678
-						}
679
-						if(isset($itemLength->beforeCurrency->insertBetween)) {
680
-							$data['numbers']['currencySpacing']['beforeCurrency']['insertBetween'] = $this->unescape($itemLength->beforeCurrency->insertBetween->getValue());
681
-						}
682
-						if(isset($itemLength->afterCurrency->currencyMatch)) {
683
-							$data['numbers']['currencySpacing']['afterCurrency']['currencyMatch'] = $this->unescape($itemLength->afterCurrency->currencyMatch->getValue());
684
-						}
685
-						if(isset($itemLength->afterCurrency->surroundingMatch)) {
686
-							$data['numbers']['currencySpacing']['afterCurrency']['surroundingMatch'] = $this->unescape($itemLength->afterCurrency->surroundingMatch->getValue());
687
-						}
688
-						if(isset($itemLength->afterCurrency->insertBetween)) {
689
-							$data['numbers']['currencySpacing']['afterCurrency']['insertBetween'] = $this->unescape($itemLength->afterCurrency->insertBetween->getValue());
690
-						}
691
-
692
-					} else {
693
-						throw new AgaviException('unknown childtag "' . $itemLength->getName() . '" in currencyFormats tag');
694
-					}
695
-				}
696
-			}
697
-			if(isset($nums->currencies)) {
698
-				foreach($nums->currencies as $currency) {
699
-					$name = $currency->getAttribute('type');
700
-					if(isset($currency->displayName)) {
701
-						$data['numbers']['currencies'][$name]['displayName'] = $this->unescape($currency->displayName->getValue());
702
-					}
703
-					if(isset($currency->symbol)) {
704
-						$symbolValue = $this->unescape($currency->symbol->getValue());
705
-						if($currency->symbol->getAttribute('choice') == 'true') {
706
-							$symbolValue = explode('|', $symbolValue);
707
-						}
708
-						$data['numbers']['currencies'][$name]['symbol'] = $symbolValue;
709
-					}
710
-				}
711
-			}
712
-		}
713
-
714
-		return $data;
715
-	}
716
-
717
-	/**
718
-	 * Gets the value of each node with a type attribute.
719
-	 *
720
-	 * @param      array $list List of ConfigValueHolder items.
721
-	 * @param      array $data The array to store the parsed data to.
722
-	 *
723
-	 * @return     array The array with the data.
724
-	 *
725
-	 * @author     Dominik del Bondio <[email protected]>
726
-	 * @since      0.11.0
727
-	 */
728
-	protected function getTypeList($list, &$data)
729
-	{
730
-		// debug stuff to check if we missed any tags (lc = loop count)
731
-		$lc = 0;
732
-		foreach($list as $listItem) {
733
-			$type = $listItem->getAttribute('type');
734
-
735
-			if(!$listItem->hasAttribute('alt')) {
736
-				$data[$type] = $this->unescape($listItem->getValue());
737
-			}
738
-
739
-			++$lc;
740
-		}
741
-
742
-		if($lc != count($list->getChildren())) {
743
-			throw new AgaviException('wrong tagcount');
744
-		}
745
-
746
-		return $data;
747
-	}
748
-
749
-	/**
750
-	 * Gets the calendar widths for the given item.
751
-	 *
752
-	 * @param      ConfigValueHolder $item The item.
753
-	 * @param      string $name The name of item.
754
-	 * @param      array $data The array to store the parsed data to.
755
-	 *
756
-	 * @return     array The array with the data.
757
-	 *
758
-	 * @author     Dominik del Bondio <[email protected]>
759
-	 * @since      0.11.0
760
-	 */
761
-	protected function getCalendarWidth(ConfigValueHolder $item, $name, &$data)
762
-	{
763
-		$dataIdxName = $name . 's';
764
-
765
-		$items = $this->getChildsOrAlias($item);
766
-		foreach($items as $itemContext) {
767
-			if($itemContext->getName() == 'default') {
768
-				$data[$dataIdxName]['default'] = $itemContext->getAttribute('choice');
769
-			} elseif($itemContext->getName() == $name . 'Context') {
770
-				$itemContextName = $itemContext->getAttribute('type');
771
-
772
-				foreach($itemContext as $itemWidths) {
773
-					if($itemWidths->getName() == 'default') {
774
-						$data[$dataIdxName][$itemContextName]['default'] = $itemWidths->getAttribute('choice');
775
-					} elseif($itemWidths->getName() == $name . 'Width') {
776
-						$itemWidthName = $itemWidths->getAttribute('type');
777
-
778
-						$widthChildItems = $this->getChildsOrAlias($itemWidths);
779
-						foreach($widthChildItems as $item) {
780
-							if($item->getName() != $name) {
781
-								throw new AgaviException('unknown childtag "' . $item->getName() . '" in ' . $name . 'Widths tag');
782
-							}
783
-
784
-							if(!$item->hasAttribute('alt')) {
785
-								$itemName = $item->getAttribute('type');
786
-								$data[$dataIdxName][$itemContextName][$itemWidthName][$itemName] = $this->unescape($item->getValue());
787
-							}
788
-						}
789
-					} else {
790
-						throw new AgaviException('unknown childtag "' . $itemWidths->getName() . '" in ' . $name . 'Context tag');
791
-					}
792
-
793
-				}
794
-			} else {
795
-				throw new AgaviException('unknown childtag "' . $itemContext->getName() . '" in ' . $name . 's tag');
796
-			}
797
-		}
798
-	}
799
-
800
-	/**
801
-	 * Gets the date or time formats the given item.
802
-	 *
803
-	 * @param      ConfigValueHolder $item The item.
804
-	 * @param      string $name The name of item.
805
-	 * @param      array $data The array to store the parsed data to.
806
-	 *
807
-	 * @return     array The array with the data.
808
-	 *
809
-	 * @author     Dominik del Bondio <[email protected]>
810
-	 * @since      0.11.0
811
-	 */
812
-	protected function getDateOrTimeFormats(ConfigValueHolder $item, $name, &$data)
813
-	{
814
-		$dataIdxName = $name . 's';
815
-
816
-		$items = $this->getChildsOrAlias($item);
817
-		foreach($items as $itemLength) {
818
-			if($itemLength->getName() == 'default') {
819
-				$data[$dataIdxName]['default'] = $itemLength->getAttribute('choice');
820
-			} elseif($itemLength->getName() == $name . 'Length') {
821
-				$itemLengthName = $itemLength->getAttribute('type', '__default');
822
-
823
-				$aliasedItemLength = $this->getChildsOrAlias($itemLength);
824
-				foreach($aliasedItemLength as $itemFormat) {
825
-					if($itemFormat->getName() == $name) {
826
-						if(isset($itemFormat->pattern)) {
827
-							$data[$dataIdxName][$itemLengthName]['pattern'] = $this->unescape($itemFormat->pattern->getValue(), true);
828
-						}
829
-						if(isset($itemFormat->displayName)) {
830
-							$data[$dataIdxName][$itemLengthName]['displayName'] = $this->unescape($itemFormat->displayName->getValue());
831
-						}
832
-					} else {
833
-						throw new AgaviException('unknown childtag "' . $itemFormat->getName() . '" in ' . $name . 'Length tag');
834
-					}
835
-
836
-				}
837
-			} else {
838
-				throw new AgaviException('unknown childtag "' . $itemLength->getName() . '" in ' . $name . 's tag');
839
-			}
840
-		}
841
-	}
842
-
843
-	/**
844
-	 * Gets the number formats the given item.
845
-	 *
846
-	 * @param      ConfigValueHolder The item.
847
-	 * @param      string The name of item.
848
-	 * @param      array The array to store the parsed data to.
849
-	 *
850
-	 * @return     array The array with the data.
851
-	 *
852
-	 * @author     Dominik del Bondio <[email protected]>
853
-	 * @since      0.11.0
854
-	 */
855
-	protected function getNumberFormats($item, $name, &$data)
856
-	{
857
-		$dataIdxName = $name . 's';
858
-
859
-		$items = $this->getChildsOrAlias($item);
860
-		foreach($items as $itemLength) {
861
-			if($itemLength->getName() == 'default') {
862
-				$data[$dataIdxName]['default'] = $itemLength->getAttribute('choice');
863
-			} elseif($itemLength->getName() == $name . 'Length') {
864
-				$itemLengthName = $itemLength->getAttribute('type', '__default');
865
-
866
-				foreach($this->getChildsOrAlias($itemLength) as $itemFormat) {
867
-					if($itemFormat->getName() == $name) {
868
-						if(isset($itemFormat->pattern)) {
869
-							$data[$dataIdxName][$itemLengthName] = $this->unescape($itemFormat->pattern->getValue());
870
-						}
871
-					} else {
872
-						throw new AgaviException('unknown childtag "' . $itemFormat->getName() . '" in ' . $name . 'Length tag');
873
-					}
874
-
875
-				}
876
-			} else {
877
-				throw new AgaviException('unknown childtag "' . $itemLength->getName() . '" in ' . $name . 's tag');
878
-			}
879
-		}
880
-	}
881
-
882
-	/**
883
-	 * Resolves the alias LDML tag.
884
-	 *
885
-	 * @param      ConfigValueHolder $item The item.
886
-	 *
887
-	 * @return     mixed Either the item if there is no alias or the resolved 
888
-	 *                   alias.
889
-	 *
890
-	 * @author     Dominik del Bondio <[email protected]>
891
-	 * @since      0.11.0
892
-	 */
893
-	protected function getChildsOrAlias(ConfigValueHolder $item)
894
-	{
895
-		if(isset($item->alias)) {
896
-			$alias = $item->alias;
897
-			if($alias->getAttribute('source') != 'locale') {
898
-				throw new AgaviException('The alias handling doesn\'t support any source except locale (' . $alias->getAttribute('source') . ' was given)');
899
-			}
900
-
901
-			$pathParts = explode('/', $alias->getAttribute('path'));
902
-
903
-			$currentNodeId = $item->getAttribute('__agavi_node_id');
544
+            if(isset($dates->timeZoneNames)) {
545
+                $tzn = $dates->timeZoneNames;
546
+                if(isset($tzn->hourFormat)) {
547
+                    $data['timeZoneNames']['hourFormat'] = $this->unescape($tzn->hourFormat->getValue());
548
+                }
549
+                if(isset($tzn->hoursFormat)) {
550
+                    $data['timeZoneNames']['hoursFormat'] = $this->unescape($tzn->hoursFormat->getValue());
551
+                }
552
+                if(isset($tzn->gmtFormat)) {
553
+                    $data['timeZoneNames']['gmtFormat'] = $this->unescape($tzn->gmtFormat->getValue());
554
+                }
555
+                if(isset($tzn->regionFormat)) {
556
+                    $data['timeZoneNames']['regionFormat'] = $this->unescape($tzn->regionFormat->getValue());
557
+                }
558
+                if(isset($tzn->fallbackFormat)) {
559
+                    $data['timeZoneNames']['fallbackFormat'] = $this->unescape($tzn->fallbackFormat->getValue());
560
+                }
561
+                if(isset($tzn->abbreviationFallback)) {
562
+                    $data['timeZoneNames']['abbreviationFallback'] = $tzn->abbreviationFallback->getAttribute('choice');
563
+                }
564
+                if(isset($tzn->singleCountries)) {
565
+                    $data['timeZoneNames']['singleCountries'] = explode(' ', $tzn->singleCountries->getAttribute('list'));
566
+                }
567
+
568
+                foreach($tzn as $zone) {
569
+                    $zoneName = $zone->getAttribute('type');
570
+                    if($zone->getName() == 'zone') {
571
+                        if(isset($zone->long->generic)) {
572
+                            $data['timeZoneNames']['zones'][$zoneName]['long']['generic'] = $this->unescape($zone->long->generic->getValue());
573
+                        }
574
+                        if(isset($zone->long->standard)) {
575
+                            $data['timeZoneNames']['zones'][$zoneName]['long']['standard'] = $this->unescape($zone->long->standard->getValue());
576
+                        }
577
+                        if(isset($zone->long->daylight)) {
578
+                            $data['timeZoneNames']['zones'][$zoneName]['long']['daylight'] = $this->unescape($zone->long->daylight->getValue());
579
+                        }
580
+                        if(isset($zone->short->generic)) {
581
+                            $data['timeZoneNames']['zones'][$zoneName]['short']['generic'] = $this->unescape($zone->short->generic->getValue());
582
+                        }
583
+                        if(isset($zone->short->standard)) {
584
+                            $data['timeZoneNames']['zones'][$zoneName]['short']['standard'] = $this->unescape($zone->short->standard->getValue());
585
+                        }
586
+                        if(isset($zone->short->daylight)) {
587
+                            $data['timeZoneNames']['zones'][$zoneName]['short']['daylight'] = $this->unescape($zone->short->daylight->getValue());
588
+                        }
589
+                        if(isset($zone->exemplarCity)) {
590
+                            $data['timeZoneNames']['zones'][$zoneName]['exemplarCity'] = $this->unescape($zone->exemplarCity->getValue());
591
+                        }
592
+
593
+                    }
594
+                }
595
+            }
596
+        }
597
+
598
+        if(isset($ldmlTree->numbers)) {
599
+            $nums = $ldmlTree->numbers;
600
+            if(!isset($data['numbers'])) {
601
+                $data['numbers'] = array();
602
+            }
603
+
604
+            if(isset($nums->symbols)) {
605
+                $syms = $nums->symbols;
606
+                if(isset($syms->decimal)) {
607
+                    $data['numbers']['symbols']['decimal'] = $this->unescape($syms->decimal->getValue());
608
+                }
609
+                if(isset($syms->group)) {
610
+                    $data['numbers']['symbols']['group'] = $this->unescape($syms->group->getValue());
611
+                }
612
+                if(isset($syms->list)) {
613
+                    $data['numbers']['symbols']['list'] = $this->unescape($syms->list->getValue());
614
+                }
615
+                if(isset($syms->percentSign)) {
616
+                    $data['numbers']['symbols']['percentSign'] = $this->unescape($syms->percentSign->getValue());
617
+                }
618
+                if(isset($syms->nativeZeroDigit)) {
619
+                    $data['numbers']['symbols']['nativeZeroDigit'] = $this->unescape($syms->nativeZeroDigit->getValue());
620
+                }
621
+                if(isset($syms->patternDigit)) {
622
+                    $data['numbers']['symbols']['patternDigit'] = $this->unescape($syms->patternDigit->getValue());
623
+                }
624
+                if(isset($syms->plusSign)) {
625
+                    $data['numbers']['symbols']['plusSign'] = $this->unescape($syms->plusSign->getValue());
626
+                }
627
+                if(isset($syms->minusSign)) {
628
+                    $data['numbers']['symbols']['minusSign'] = $this->unescape($syms->minusSign->getValue());
629
+                }
630
+                if(isset($syms->exponential)) {
631
+                    $data['numbers']['symbols']['exponential'] = $this->unescape($syms->exponential->getValue());
632
+                }
633
+                if(isset($syms->perMille)) {
634
+                    $data['numbers']['symbols']['perMille'] = $this->unescape($syms->perMille->getValue());
635
+                }
636
+                if(isset($syms->infinity)) {
637
+                    $data['numbers']['symbols']['infinity'] = $this->unescape($syms->infinity->getValue());
638
+                }
639
+                if(isset($syms->nan)) {
640
+                    $data['numbers']['symbols']['nan'] = $this->unescape($syms->nan->getValue());
641
+                }
642
+            }
643
+            if(isset($nums->decimalFormats)) {
644
+                $this->getNumberFormats($nums->decimalFormats, 'decimalFormat', $data['numbers']);
645
+            }
646
+            if(isset($nums->scientificFormats)) {
647
+                $this->getNumberFormats($nums->scientificFormats, 'scientificFormat', $data['numbers']);
648
+            }
649
+            if(isset($nums->percentFormats)) {
650
+                $this->getNumberFormats($nums->percentFormats, 'percentFormat', $data['numbers']);
651
+            }
652
+            if(isset($nums->currencyFormats)) {
653
+                $cf = $nums->currencyFormats;
654
+
655
+                foreach($this->getChildsOrAlias($cf) as $itemLength) {
656
+                    if($itemLength->getName() == 'default') {
657
+                        $data['numbers']['currencyFormats']['default'] = $itemLength->getAttribute('choice');
658
+                    } elseif($itemLength->getName() == 'currencyFormatLength') {
659
+                        $itemLengthName = $itemLength->getAttribute('type', '__default');
660
+
661
+                        foreach($this->getChildsOrAlias($itemLength) as $itemFormat) {
662
+                            if($itemFormat->getName() == 'currencyFormat') {
663
+                                if(isset($itemFormat->pattern)) {
664
+                                    $data['numbers']['currencyFormats'][$itemLengthName] = $this->unescape($itemFormat->pattern->getValue());
665
+                                }
666
+                            } else {
667
+                                throw new AgaviException('unknown childtag "' . $itemFormat->getName() . '" in currencyFormatLength tag');
668
+                            }
669
+
670
+                        }
671
+                    } elseif($itemLength->getName() == 'currencySpacing') {
672
+
673
+                        if(isset($itemLength->beforeCurrency->currencyMatch)) {
674
+                            $data['numbers']['currencySpacing']['beforeCurrency']['currencyMatch'] = $this->unescape($itemLength->beforeCurrency->currencyMatch->getValue());
675
+                        }
676
+                        if(isset($itemLength->beforeCurrency->surroundingMatch)) {
677
+                            $data['numbers']['currencySpacing']['beforeCurrency']['surroundingMatch'] = $this->unescape($itemLength->beforeCurrency->surroundingMatch->getValue());
678
+                        }
679
+                        if(isset($itemLength->beforeCurrency->insertBetween)) {
680
+                            $data['numbers']['currencySpacing']['beforeCurrency']['insertBetween'] = $this->unescape($itemLength->beforeCurrency->insertBetween->getValue());
681
+                        }
682
+                        if(isset($itemLength->afterCurrency->currencyMatch)) {
683
+                            $data['numbers']['currencySpacing']['afterCurrency']['currencyMatch'] = $this->unescape($itemLength->afterCurrency->currencyMatch->getValue());
684
+                        }
685
+                        if(isset($itemLength->afterCurrency->surroundingMatch)) {
686
+                            $data['numbers']['currencySpacing']['afterCurrency']['surroundingMatch'] = $this->unescape($itemLength->afterCurrency->surroundingMatch->getValue());
687
+                        }
688
+                        if(isset($itemLength->afterCurrency->insertBetween)) {
689
+                            $data['numbers']['currencySpacing']['afterCurrency']['insertBetween'] = $this->unescape($itemLength->afterCurrency->insertBetween->getValue());
690
+                        }
691
+
692
+                    } else {
693
+                        throw new AgaviException('unknown childtag "' . $itemLength->getName() . '" in currencyFormats tag');
694
+                    }
695
+                }
696
+            }
697
+            if(isset($nums->currencies)) {
698
+                foreach($nums->currencies as $currency) {
699
+                    $name = $currency->getAttribute('type');
700
+                    if(isset($currency->displayName)) {
701
+                        $data['numbers']['currencies'][$name]['displayName'] = $this->unescape($currency->displayName->getValue());
702
+                    }
703
+                    if(isset($currency->symbol)) {
704
+                        $symbolValue = $this->unescape($currency->symbol->getValue());
705
+                        if($currency->symbol->getAttribute('choice') == 'true') {
706
+                            $symbolValue = explode('|', $symbolValue);
707
+                        }
708
+                        $data['numbers']['currencies'][$name]['symbol'] = $symbolValue;
709
+                    }
710
+                }
711
+            }
712
+        }
713
+
714
+        return $data;
715
+    }
716
+
717
+    /**
718
+     * Gets the value of each node with a type attribute.
719
+     *
720
+     * @param      array $list List of ConfigValueHolder items.
721
+     * @param      array $data The array to store the parsed data to.
722
+     *
723
+     * @return     array The array with the data.
724
+     *
725
+     * @author     Dominik del Bondio <[email protected]>
726
+     * @since      0.11.0
727
+     */
728
+    protected function getTypeList($list, &$data)
729
+    {
730
+        // debug stuff to check if we missed any tags (lc = loop count)
731
+        $lc = 0;
732
+        foreach($list as $listItem) {
733
+            $type = $listItem->getAttribute('type');
734
+
735
+            if(!$listItem->hasAttribute('alt')) {
736
+                $data[$type] = $this->unescape($listItem->getValue());
737
+            }
738
+
739
+            ++$lc;
740
+        }
741
+
742
+        if($lc != count($list->getChildren())) {
743
+            throw new AgaviException('wrong tagcount');
744
+        }
745
+
746
+        return $data;
747
+    }
748
+
749
+    /**
750
+     * Gets the calendar widths for the given item.
751
+     *
752
+     * @param      ConfigValueHolder $item The item.
753
+     * @param      string $name The name of item.
754
+     * @param      array $data The array to store the parsed data to.
755
+     *
756
+     * @return     array The array with the data.
757
+     *
758
+     * @author     Dominik del Bondio <[email protected]>
759
+     * @since      0.11.0
760
+     */
761
+    protected function getCalendarWidth(ConfigValueHolder $item, $name, &$data)
762
+    {
763
+        $dataIdxName = $name . 's';
764
+
765
+        $items = $this->getChildsOrAlias($item);
766
+        foreach($items as $itemContext) {
767
+            if($itemContext->getName() == 'default') {
768
+                $data[$dataIdxName]['default'] = $itemContext->getAttribute('choice');
769
+            } elseif($itemContext->getName() == $name . 'Context') {
770
+                $itemContextName = $itemContext->getAttribute('type');
771
+
772
+                foreach($itemContext as $itemWidths) {
773
+                    if($itemWidths->getName() == 'default') {
774
+                        $data[$dataIdxName][$itemContextName]['default'] = $itemWidths->getAttribute('choice');
775
+                    } elseif($itemWidths->getName() == $name . 'Width') {
776
+                        $itemWidthName = $itemWidths->getAttribute('type');
777
+
778
+                        $widthChildItems = $this->getChildsOrAlias($itemWidths);
779
+                        foreach($widthChildItems as $item) {
780
+                            if($item->getName() != $name) {
781
+                                throw new AgaviException('unknown childtag "' . $item->getName() . '" in ' . $name . 'Widths tag');
782
+                            }
783
+
784
+                            if(!$item->hasAttribute('alt')) {
785
+                                $itemName = $item->getAttribute('type');
786
+                                $data[$dataIdxName][$itemContextName][$itemWidthName][$itemName] = $this->unescape($item->getValue());
787
+                            }
788
+                        }
789
+                    } else {
790
+                        throw new AgaviException('unknown childtag "' . $itemWidths->getName() . '" in ' . $name . 'Context tag');
791
+                    }
792
+
793
+                }
794
+            } else {
795
+                throw new AgaviException('unknown childtag "' . $itemContext->getName() . '" in ' . $name . 's tag');
796
+            }
797
+        }
798
+    }
799
+
800
+    /**
801
+     * Gets the date or time formats the given item.
802
+     *
803
+     * @param      ConfigValueHolder $item The item.
804
+     * @param      string $name The name of item.
805
+     * @param      array $data The array to store the parsed data to.
806
+     *
807
+     * @return     array The array with the data.
808
+     *
809
+     * @author     Dominik del Bondio <[email protected]>
810
+     * @since      0.11.0
811
+     */
812
+    protected function getDateOrTimeFormats(ConfigValueHolder $item, $name, &$data)
813
+    {
814
+        $dataIdxName = $name . 's';
815
+
816
+        $items = $this->getChildsOrAlias($item);
817
+        foreach($items as $itemLength) {
818
+            if($itemLength->getName() == 'default') {
819
+                $data[$dataIdxName]['default'] = $itemLength->getAttribute('choice');
820
+            } elseif($itemLength->getName() == $name . 'Length') {
821
+                $itemLengthName = $itemLength->getAttribute('type', '__default');
822
+
823
+                $aliasedItemLength = $this->getChildsOrAlias($itemLength);
824
+                foreach($aliasedItemLength as $itemFormat) {
825
+                    if($itemFormat->getName() == $name) {
826
+                        if(isset($itemFormat->pattern)) {
827
+                            $data[$dataIdxName][$itemLengthName]['pattern'] = $this->unescape($itemFormat->pattern->getValue(), true);
828
+                        }
829
+                        if(isset($itemFormat->displayName)) {
830
+                            $data[$dataIdxName][$itemLengthName]['displayName'] = $this->unescape($itemFormat->displayName->getValue());
831
+                        }
832
+                    } else {
833
+                        throw new AgaviException('unknown childtag "' . $itemFormat->getName() . '" in ' . $name . 'Length tag');
834
+                    }
835
+
836
+                }
837
+            } else {
838
+                throw new AgaviException('unknown childtag "' . $itemLength->getName() . '" in ' . $name . 's tag');
839
+            }
840
+        }
841
+    }
842
+
843
+    /**
844
+     * Gets the number formats the given item.
845
+     *
846
+     * @param      ConfigValueHolder The item.
847
+     * @param      string The name of item.
848
+     * @param      array The array to store the parsed data to.
849
+     *
850
+     * @return     array The array with the data.
851
+     *
852
+     * @author     Dominik del Bondio <[email protected]>
853
+     * @since      0.11.0
854
+     */
855
+    protected function getNumberFormats($item, $name, &$data)
856
+    {
857
+        $dataIdxName = $name . 's';
858
+
859
+        $items = $this->getChildsOrAlias($item);
860
+        foreach($items as $itemLength) {
861
+            if($itemLength->getName() == 'default') {
862
+                $data[$dataIdxName]['default'] = $itemLength->getAttribute('choice');
863
+            } elseif($itemLength->getName() == $name . 'Length') {
864
+                $itemLengthName = $itemLength->getAttribute('type', '__default');
865
+
866
+                foreach($this->getChildsOrAlias($itemLength) as $itemFormat) {
867
+                    if($itemFormat->getName() == $name) {
868
+                        if(isset($itemFormat->pattern)) {
869
+                            $data[$dataIdxName][$itemLengthName] = $this->unescape($itemFormat->pattern->getValue());
870
+                        }
871
+                    } else {
872
+                        throw new AgaviException('unknown childtag "' . $itemFormat->getName() . '" in ' . $name . 'Length tag');
873
+                    }
874
+
875
+                }
876
+            } else {
877
+                throw new AgaviException('unknown childtag "' . $itemLength->getName() . '" in ' . $name . 's tag');
878
+            }
879
+        }
880
+    }
881
+
882
+    /**
883
+     * Resolves the alias LDML tag.
884
+     *
885
+     * @param      ConfigValueHolder $item The item.
886
+     *
887
+     * @return     mixed Either the item if there is no alias or the resolved 
888
+     *                   alias.
889
+     *
890
+     * @author     Dominik del Bondio <[email protected]>
891
+     * @since      0.11.0
892
+     */
893
+    protected function getChildsOrAlias(ConfigValueHolder $item)
894
+    {
895
+        if(isset($item->alias)) {
896
+            $alias = $item->alias;
897
+            if($alias->getAttribute('source') != 'locale') {
898
+                throw new AgaviException('The alias handling doesn\'t support any source except locale (' . $alias->getAttribute('source') . ' was given)');
899
+            }
900
+
901
+            $pathParts = explode('/', $alias->getAttribute('path'));
902
+
903
+            $currentNodeId = $item->getAttribute('__agavi_node_id');
904 904
 			
905
-			foreach($pathParts as $part) {
906
-				// select the parent node
907
-				if($part == '..') {
908
-					$currentNodeId = $this->nodeRefs[$currentNodeId]->getAttribute('__agavi_parent_id');
909
-				} else {
910
-					$predicates = array();
911
-					if(preg_match('#([^\[]+)\[([^\]]+)\]#', $part, $match)) {
912
-						if(!preg_match('#@([^=]+)=\'([^\']+)\'#', $match[2], $predMatch)) {
913
-							throw new AgaviException('Unknown predicate ' . $match[2] . ' in alias xpath spec');
914
-						}
915
-						$tagName = $match[1];
916
-						$predicates[$predMatch[1]] = $predMatch[2];
917
-					} else {
918
-						$tagName = $part;
919
-					}
920
-					foreach($this->nodeRefs[$currentNodeId]->getChildren() as $childNode) {
921
-						$isSearchedNode = false;
922
-						if($childNode->getName() == $tagName) {
923
-							$predMatches = 0;
924
-							foreach($predicates as $attrib => $value) {
925
-								if($childNode->getAttribute($attrib) == $value) {
926
-									++$predMatches;
927
-								}
928
-							}
929
-							if($predMatches == count($predicates)) {
930
-								$isSearchedNode = true;
931
-							}
932
-						}
933
-
934
-						if($isSearchedNode) {
935
-							$currentNodeId = $childNode->getAttribute('__agavi_node_id');
936
-						}
937
-					}
938
-				}
939
-			}
940
-
941
-			return $this->nodeRefs[$currentNodeId]->getChildren();
942
-		} else {
943
-			return $item;
944
-		}
945
-	}
905
+            foreach($pathParts as $part) {
906
+                // select the parent node
907
+                if($part == '..') {
908
+                    $currentNodeId = $this->nodeRefs[$currentNodeId]->getAttribute('__agavi_parent_id');
909
+                } else {
910
+                    $predicates = array();
911
+                    if(preg_match('#([^\[]+)\[([^\]]+)\]#', $part, $match)) {
912
+                        if(!preg_match('#@([^=]+)=\'([^\']+)\'#', $match[2], $predMatch)) {
913
+                            throw new AgaviException('Unknown predicate ' . $match[2] . ' in alias xpath spec');
914
+                        }
915
+                        $tagName = $match[1];
916
+                        $predicates[$predMatch[1]] = $predMatch[2];
917
+                    } else {
918
+                        $tagName = $part;
919
+                    }
920
+                    foreach($this->nodeRefs[$currentNodeId]->getChildren() as $childNode) {
921
+                        $isSearchedNode = false;
922
+                        if($childNode->getName() == $tagName) {
923
+                            $predMatches = 0;
924
+                            foreach($predicates as $attrib => $value) {
925
+                                if($childNode->getAttribute($attrib) == $value) {
926
+                                    ++$predMatches;
927
+                                }
928
+                            }
929
+                            if($predMatches == count($predicates)) {
930
+                                $isSearchedNode = true;
931
+                            }
932
+                        }
933
+
934
+                        if($isSearchedNode) {
935
+                            $currentNodeId = $childNode->getAttribute('__agavi_node_id');
936
+                        }
937
+                    }
938
+                }
939
+            }
940
+
941
+            return $this->nodeRefs[$currentNodeId]->getChildren();
942
+        } else {
943
+            return $item;
944
+        }
945
+    }
946 946
 	
947
-	/**
948
-	 * Unescapes unicode escapes
949
-	 * 
950
-	 * @link       http://unicode.org/reports/tr35/#Unicode_Sets
951
-	 * 
952
-	 * @param      string $input The string to unescape.
953
-	 * @param      bool   $handleQuotes Whether the string needs to handle quoting behaviour
954
-	 *
955
-	 * @return     string The unescaped string.
956
-	 *
957
-	 * @author     Dominik del Bondio <[email protected]>
958
-	 * @since      0.11.0	
959
-	 */
960
-	protected function unescape($input, $handleQuotes = false)
961
-	{
962
-		$output = '';
963
-		$hex = '[0-9A-Fa-f]';
964
-		$rx = '\\\\(\\\\|u' . $hex . '{4}|U' . $hex . '{8}|x' . $hex .'{1,2}|[0-7]{1,3}|.)';
965
-		if($handleQuotes) {
966
-			// needs to be < -1 to not confuse the algorithm in the first run
967
-			$lastClose = -2;
968
-			if(preg_match_all("#'(?:''|[^'])+'|" . $rx . "#", $input, $matches, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE)) {
969
-				$output = $input;
970
-				$offsetMod = 0;
971
-				$ml = $matches[0];
972
-				$len = count($ml);
973
-				for($i = 0; $i < $len; ++ $i) {
974
-					$match = $ml[$i];
975
-					if($match[0][0] != '\'') {
976
-						// we check if there is a quoted string directly before or directly after the escape sequence
977
-						// by using the string lengths and the offset of the matches. Since an escape sequence directly before
978
-						// this sequence results in an quoted string we only check if its really a quoted string and not an
979
-						// escape sequence for parts coming after this sequence
980
-						$quoteBefore = ($i > 0 && (strlen($ml[$i - 1][0]) + $ml[$i - 1][1]) == $match[1]);
981
-						$quoteAfter = ($i + 1 < $len && $ml[$i + 1][0][0] == '\'' && (strlen($match[0]) + $match[1]) == $ml[$i + 1][1]);
982
-						$oldLen = strlen($output);
983
-						$unescaped = $this->unescapeCallback(array($match[0], substr($match[0], 1)));
984
-						$unescaped = ($quoteBefore ? '' : '\'') . $unescaped . ($quoteAfter ? '' : '\'');
985
-						$replacedPartLen = strlen($match[0]) + ((int) $quoteBefore) + ((int) $quoteAfter);
986
-						// replace the matched escape sequence with the unescaped one. we also replace the opening or closing quote
987
-						// from the quoted part before or after this escape sequence to include the unescaped string into the closed part
988
-						$output = substr_replace($output, $unescaped, $offsetMod + $match[1] + ($quoteBefore ? -1 : 0), $replacedPartLen);
989
-						// since the string length gets changed, we have to track the size change so we can adjust the offset from the match
990
-						$offsetMod += strlen($output) - $oldLen;
991
-					}
992
-				}
993
-			} else {
994
-				$output = $input;
995
-			}
996
-		} else {
997
-			$output = preg_replace_callback('#' . $rx . '#', array($this, 'unescapeCallback'), $input);
998
-		}
999
-
1000
-		return $output;
1001
-	}
947
+    /**
948
+     * Unescapes unicode escapes
949
+     * 
950
+     * @link       http://unicode.org/reports/tr35/#Unicode_Sets
951
+     * 
952
+     * @param      string $input The string to unescape.
953
+     * @param      bool   $handleQuotes Whether the string needs to handle quoting behaviour
954
+     *
955
+     * @return     string The unescaped string.
956
+     *
957
+     * @author     Dominik del Bondio <[email protected]>
958
+     * @since      0.11.0	
959
+     */
960
+    protected function unescape($input, $handleQuotes = false)
961
+    {
962
+        $output = '';
963
+        $hex = '[0-9A-Fa-f]';
964
+        $rx = '\\\\(\\\\|u' . $hex . '{4}|U' . $hex . '{8}|x' . $hex .'{1,2}|[0-7]{1,3}|.)';
965
+        if($handleQuotes) {
966
+            // needs to be < -1 to not confuse the algorithm in the first run
967
+            $lastClose = -2;
968
+            if(preg_match_all("#'(?:''|[^'])+'|" . $rx . "#", $input, $matches, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE)) {
969
+                $output = $input;
970
+                $offsetMod = 0;
971
+                $ml = $matches[0];
972
+                $len = count($ml);
973
+                for($i = 0; $i < $len; ++ $i) {
974
+                    $match = $ml[$i];
975
+                    if($match[0][0] != '\'') {
976
+                        // we check if there is a quoted string directly before or directly after the escape sequence
977
+                        // by using the string lengths and the offset of the matches. Since an escape sequence directly before
978
+                        // this sequence results in an quoted string we only check if its really a quoted string and not an
979
+                        // escape sequence for parts coming after this sequence
980
+                        $quoteBefore = ($i > 0 && (strlen($ml[$i - 1][0]) + $ml[$i - 1][1]) == $match[1]);
981
+                        $quoteAfter = ($i + 1 < $len && $ml[$i + 1][0][0] == '\'' && (strlen($match[0]) + $match[1]) == $ml[$i + 1][1]);
982
+                        $oldLen = strlen($output);
983
+                        $unescaped = $this->unescapeCallback(array($match[0], substr($match[0], 1)));
984
+                        $unescaped = ($quoteBefore ? '' : '\'') . $unescaped . ($quoteAfter ? '' : '\'');
985
+                        $replacedPartLen = strlen($match[0]) + ((int) $quoteBefore) + ((int) $quoteAfter);
986
+                        // replace the matched escape sequence with the unescaped one. we also replace the opening or closing quote
987
+                        // from the quoted part before or after this escape sequence to include the unescaped string into the closed part
988
+                        $output = substr_replace($output, $unescaped, $offsetMod + $match[1] + ($quoteBefore ? -1 : 0), $replacedPartLen);
989
+                        // since the string length gets changed, we have to track the size change so we can adjust the offset from the match
990
+                        $offsetMod += strlen($output) - $oldLen;
991
+                    }
992
+                }
993
+            } else {
994
+                $output = $input;
995
+            }
996
+        } else {
997
+            $output = preg_replace_callback('#' . $rx . '#', array($this, 'unescapeCallback'), $input);
998
+        }
999
+
1000
+        return $output;
1001
+    }
1002 1002
 	
1003
-	/**
1004
-	 * Unescapes a single unicode escape sequence. This is designed to be a 
1005
-	 * preg_replace_callback callback function.
1006
-	 * 
1007
-	 * @param      array $matches The match.
1008
-	 *
1009
-	 * @return     string The unescaped sequence.
1010
-	 *
1011
-	 * @author     Dominik del Bondio <[email protected]>
1012
-	 * @since      0.11.0	
1013
-	 */
1014
-	protected function unescapeCallback($matches)
1015
-	{
1016
-		static $map = array(
1017
-			'a' => "\x07",
1018
-			'b' => "\x08",
1019
-			't' => "\x09",
1020
-			'n' => "\x0A",
1021
-			'v' => "\x0B",
1022
-			'f' => "\x0C",
1023
-			'r' => "\x0D",
1024
-			'\\' => '\\',
1025
-		);
1003
+    /**
1004
+     * Unescapes a single unicode escape sequence. This is designed to be a 
1005
+     * preg_replace_callback callback function.
1006
+     * 
1007
+     * @param      array $matches The match.
1008
+     *
1009
+     * @return     string The unescaped sequence.
1010
+     *
1011
+     * @author     Dominik del Bondio <[email protected]>
1012
+     * @since      0.11.0	
1013
+     */
1014
+    protected function unescapeCallback($matches)
1015
+    {
1016
+        static $map = array(
1017
+            'a' => "\x07",
1018
+            'b' => "\x08",
1019
+            't' => "\x09",
1020
+            'n' => "\x0A",
1021
+            'v' => "\x0B",
1022
+            'f' => "\x0C",
1023
+            'r' => "\x0D",
1024
+            '\\' => '\\',
1025
+        );
1026 1026
 		
1027 1027
 		
1028
-		$res = '';
1028
+        $res = '';
1029 1029
 		
1030
-		$char = $matches[1][0];
1031
-		$seq = substr($matches[1], 1);
1032
-		if($char == 'u' || $char == 'U' || $char == 'x') {
1033
-			$res = html_entity_decode('&#x' . $seq . ';', ENT_QUOTES, 'utf-8');
1034
-		} elseif(is_numeric($char)) {
1035
-			$res = html_entity_decode('&#' . octdec($matches[1]) . ';', ENT_QUOTES, 'utf-8');
1036
-		} elseif(isset($map[$char])) {
1037
-			$res = $map[$char];
1038
-		} else {
1039
-			$res = $char; // something like \s or \0 or so, just return the character ("s" or "0")
1040
-		}
1030
+        $char = $matches[1][0];
1031
+        $seq = substr($matches[1], 1);
1032
+        if($char == 'u' || $char == 'U' || $char == 'x') {
1033
+            $res = html_entity_decode('&#x' . $seq . ';', ENT_QUOTES, 'utf-8');
1034
+        } elseif(is_numeric($char)) {
1035
+            $res = html_entity_decode('&#' . octdec($matches[1]) . ';', ENT_QUOTES, 'utf-8');
1036
+        } elseif(isset($map[$char])) {
1037
+            $res = $map[$char];
1038
+        } else {
1039
+            $res = $char; // something like \s or \0 or so, just return the character ("s" or "0")
1040
+        }
1041 1041
 		
1042
-		return $res;
1043
-	}
1042
+        return $res;
1043
+    }
1044 1044
 }
1045 1045
 
1046 1046
 ?>
1047 1047
\ No newline at end of file
Please login to merge, or discard this patch.
src/config/RbacDefinitionConfigHandler.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 	/**
78 78
 	 * Parse a 'roles' node.
79 79
 	 *
80
-	 * @param      mixed  $roles  The "roles" node (element or node list)
80
+	 * @param      \DOMNodeList  $roles  The "roles" node (element or node list)
81 81
 	 * @param      string $parent The name of the parent role, or null.
82 82
 	 * @param      array  $data   A reference to the output data array.
83 83
 	 *
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 		
62 62
 		$data = array();
63 63
 
64
-		foreach($document->getConfigurationElements() as $cfg) {
65
-			if(!$cfg->has('roles')) {
64
+		foreach ($document->getConfigurationElements() as $cfg) {
65
+			if (!$cfg->has('roles')) {
66 66
 				continue;
67 67
 			}
68 68
 			
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
 	protected function parseRoles($roles, $parent, &$data)
88 88
 	{
89 89
 		/** @var XmlConfigDomElement $role */
90
-		foreach($roles as $role) {
90
+		foreach ($roles as $role) {
91 91
 			$name = $role->getAttribute('name');
92 92
 			$entry = array();
93 93
 			$entry['parent'] = $parent;
94 94
 			$entry['permissions'] = array();
95
-			if($role->has('permissions')) {
95
+			if ($role->has('permissions')) {
96 96
 				/** @var XmlConfigDomElement $permission */
97
-				foreach($role->get('permissions') as $permission) {
97
+				foreach ($role->get('permissions') as $permission) {
98 98
 					$entry['permissions'][] = $permission->getValue();
99 99
 				}
100 100
 			}
101
-			if($role->has('roles')) {
101
+			if ($role->has('roles')) {
102 102
 				$this->parseRoles($role->get('roles'), $name, $data);
103 103
 			}
104 104
 			$data[$name] = $entry;
Please login to merge, or discard this patch.
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -36,74 +36,74 @@
 block discarded – undo
36 36
  */
37 37
 class RbacDefinitionConfigHandler extends XmlConfigHandler
38 38
 {
39
-	const XML_NAMESPACE = 'http://agavi.org/agavi/config/parts/rbac_definitions/1.1';
39
+    const XML_NAMESPACE = 'http://agavi.org/agavi/config/parts/rbac_definitions/1.1';
40 40
 	
41
-	/**
42
-	 * Execute this configuration handler.
43
-	 *
44
-	 * @param      XmlConfigDomDocument $document The document to parse.
45
-	 *
46
-	 * @return     string Data to be written to a cache file.
47
-	 *
48
-	 * @throws     <b>UnreadableException</b> If a requested configuration
49
-	 *                                        file does not exist or is not
50
-	 *                                        readable.
51
-	 * @throws     <b>ParseException</b> If a requested configuration file is
52
-	 *                                   improperly formatted.
53
-	 *
54
-	 * @author     David Zülke <[email protected]>
55
-	 * @since      0.11.0
56
-	 */
57
-	public function execute(XmlConfigDomDocument $document)
58
-	{
59
-		// set up our default namespace
60
-		$document->setDefaultNamespace(self::XML_NAMESPACE, 'rbac_definitions');
41
+    /**
42
+     * Execute this configuration handler.
43
+     *
44
+     * @param      XmlConfigDomDocument $document The document to parse.
45
+     *
46
+     * @return     string Data to be written to a cache file.
47
+     *
48
+     * @throws     <b>UnreadableException</b> If a requested configuration
49
+     *                                        file does not exist or is not
50
+     *                                        readable.
51
+     * @throws     <b>ParseException</b> If a requested configuration file is
52
+     *                                   improperly formatted.
53
+     *
54
+     * @author     David Zülke <[email protected]>
55
+     * @since      0.11.0
56
+     */
57
+    public function execute(XmlConfigDomDocument $document)
58
+    {
59
+        // set up our default namespace
60
+        $document->setDefaultNamespace(self::XML_NAMESPACE, 'rbac_definitions');
61 61
 		
62
-		$data = array();
62
+        $data = array();
63 63
 
64
-		foreach($document->getConfigurationElements() as $cfg) {
65
-			if(!$cfg->has('roles')) {
66
-				continue;
67
-			}
64
+        foreach($document->getConfigurationElements() as $cfg) {
65
+            if(!$cfg->has('roles')) {
66
+                continue;
67
+            }
68 68
 			
69
-			$this->parseRoles($cfg->get('roles'), null, $data);
70
-		}
69
+            $this->parseRoles($cfg->get('roles'), null, $data);
70
+        }
71 71
 
72
-		$code = "return " . var_export($data, true) . ";";
72
+        $code = "return " . var_export($data, true) . ";";
73 73
 		
74
-		return $this->generate($code, $document->documentURI);
75
-	}
74
+        return $this->generate($code, $document->documentURI);
75
+    }
76 76
 	
77
-	/**
78
-	 * Parse a 'roles' node.
79
-	 *
80
-	 * @param      mixed  $roles  The "roles" node (element or node list)
81
-	 * @param      string $parent The name of the parent role, or null.
82
-	 * @param      array  $data   A reference to the output data array.
83
-	 *
84
-	 * @author     David Zülke <[email protected]>
85
-	 * @since      0.11.0
86
-	 */
87
-	protected function parseRoles($roles, $parent, &$data)
88
-	{
89
-		/** @var XmlConfigDomElement $role */
90
-		foreach($roles as $role) {
91
-			$name = $role->getAttribute('name');
92
-			$entry = array();
93
-			$entry['parent'] = $parent;
94
-			$entry['permissions'] = array();
95
-			if($role->has('permissions')) {
96
-				/** @var XmlConfigDomElement $permission */
97
-				foreach($role->get('permissions') as $permission) {
98
-					$entry['permissions'][] = $permission->getValue();
99
-				}
100
-			}
101
-			if($role->has('roles')) {
102
-				$this->parseRoles($role->get('roles'), $name, $data);
103
-			}
104
-			$data[$name] = $entry;
105
-		}
106
-	}
77
+    /**
78
+     * Parse a 'roles' node.
79
+     *
80
+     * @param      mixed  $roles  The "roles" node (element or node list)
81
+     * @param      string $parent The name of the parent role, or null.
82
+     * @param      array  $data   A reference to the output data array.
83
+     *
84
+     * @author     David Zülke <[email protected]>
85
+     * @since      0.11.0
86
+     */
87
+    protected function parseRoles($roles, $parent, &$data)
88
+    {
89
+        /** @var XmlConfigDomElement $role */
90
+        foreach($roles as $role) {
91
+            $name = $role->getAttribute('name');
92
+            $entry = array();
93
+            $entry['parent'] = $parent;
94
+            $entry['permissions'] = array();
95
+            if($role->has('permissions')) {
96
+                /** @var XmlConfigDomElement $permission */
97
+                foreach($role->get('permissions') as $permission) {
98
+                    $entry['permissions'][] = $permission->getValue();
99
+                }
100
+            }
101
+            if($role->has('roles')) {
102
+                $this->parseRoles($role->get('roles'), $name, $data);
103
+            }
104
+            $data[$name] = $entry;
105
+        }
106
+    }
107 107
 }
108 108
 
109 109
 ?>
110 110
\ No newline at end of file
Please login to merge, or discard this patch.
src/config/RoutingConfigHandler.class.php 4 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
 namespace Agavi\Config;
17 17
 
18 18
 use Agavi\Config\Util\Dom\XmlConfigDomElement;
19
-use Agavi\Config\Util\Dom\XmlConfigDomNode;
20 19
 use Agavi\Core\Context;
21 20
 use Agavi\Config\XmlConfigHandler;
22 21
 use Agavi\Config\Util\Dom\XmlConfigDomDocument;
Please login to merge, or discard this patch.
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -42,149 +42,149 @@
 block discarded – undo
42 42
  */
43 43
 class RoutingConfigHandler extends XmlConfigHandler
44 44
 {
45
-	const XML_NAMESPACE = 'http://agavi.org/agavi/config/parts/routing/1.1';
45
+    const XML_NAMESPACE = 'http://agavi.org/agavi/config/parts/routing/1.1';
46 46
 	
47
-	/**
48
-	 * @var        array Stores the generated names of unnamed routes.
49
-	 */
50
-	protected $unnamedRoutes = array();
47
+    /**
48
+     * @var        array Stores the generated names of unnamed routes.
49
+     */
50
+    protected $unnamedRoutes = array();
51 51
 	
52
-	/**
53
-	 * Execute this configuration handler.
54
-	 *
55
-	 * @param      XmlConfigDomDocument $document The document to parse.
56
-	 *
57
-	 * @return     string Data to be written to a cache file.
58
-	 *
59
-	 * @throws     <b>UnreadableException</b> If a requested configuration
60
-	 *                                             file does not exist or is not
61
-	 *                                             readable.
62
-	 * @throws     <b>ParseException</b> If a requested configuration file is
63
-	 *                                        improperly formatted.
64
-	 *
65
-	 * @author     Dominik del Bondio <[email protected]>
66
-	 * @author     David Zülke <[email protected]>
67
-	 * @since      0.11.0
68
-	 */
69
-	public function execute(XmlConfigDomDocument $document)
70
-	{
71
-		// set up our default namespace
72
-		$document->setDefaultNamespace(self::XML_NAMESPACE, 'routing');
52
+    /**
53
+     * Execute this configuration handler.
54
+     *
55
+     * @param      XmlConfigDomDocument $document The document to parse.
56
+     *
57
+     * @return     string Data to be written to a cache file.
58
+     *
59
+     * @throws     <b>UnreadableException</b> If a requested configuration
60
+     *                                             file does not exist or is not
61
+     *                                             readable.
62
+     * @throws     <b>ParseException</b> If a requested configuration file is
63
+     *                                        improperly formatted.
64
+     *
65
+     * @author     Dominik del Bondio <[email protected]>
66
+     * @author     David Zülke <[email protected]>
67
+     * @since      0.11.0
68
+     */
69
+    public function execute(XmlConfigDomDocument $document)
70
+    {
71
+        // set up our default namespace
72
+        $document->setDefaultNamespace(self::XML_NAMESPACE, 'routing');
73 73
 		
74
-		$routing = Context::getInstance($this->context)->getRouting();
74
+        $routing = Context::getInstance($this->context)->getRouting();
75 75
 
76
-		// reset the stored route names
77
-		$this->unnamedRoutes = array();
76
+        // reset the stored route names
77
+        $this->unnamedRoutes = array();
78 78
 
79
-		// clear the routing
80
-		$routing->importRoutes(array());
79
+        // clear the routing
80
+        $routing->importRoutes(array());
81 81
 		
82
-		foreach($document->getConfigurationElements() as $cfg) {
83
-			if($cfg->has('routes')) {
84
-				$this->parseRoutes($routing, $cfg->get('routes'));
85
-			}
86
-		}
87
-
88
-		// we cannot do this:
89
-		// $code = '$this->importRoutes(unserialize(' . var_export(serialize($routing->exportRoutes()), true) . '));';
90
-		// return $this->generate($code, $document->documentURI);
91
-		// because var_export() incorrectly escapes null-byte sequences as \000, which results in a corrupted string, and unserialize() doesn't like corrupted strings
92
-		// this was fixed in PHP 5.2.6, but we're compatible with 5.2.0+
93
-		// see http://bugs.php.net/bug.php?id=37262 and http://bugs.php.net/bug.php?id=42272
82
+        foreach($document->getConfigurationElements() as $cfg) {
83
+            if($cfg->has('routes')) {
84
+                $this->parseRoutes($routing, $cfg->get('routes'));
85
+            }
86
+        }
87
+
88
+        // we cannot do this:
89
+        // $code = '$this->importRoutes(unserialize(' . var_export(serialize($routing->exportRoutes()), true) . '));';
90
+        // return $this->generate($code, $document->documentURI);
91
+        // because var_export() incorrectly escapes null-byte sequences as \000, which results in a corrupted string, and unserialize() doesn't like corrupted strings
92
+        // this was fixed in PHP 5.2.6, but we're compatible with 5.2.0+
93
+        // see http://bugs.php.net/bug.php?id=37262 and http://bugs.php.net/bug.php?id=42272
94 94
 		
95
-		return serialize($routing->exportRoutes());
96
-	}
97
-
98
-	/**
99
-	 * Takes a nested array of AgaviConfigValueHolder containing the routing
100
-	 * information and creates the routes in the given routing.
101
-	 *
102
-	 * @param      Routing               $routing The routing instance to create the routes in.
103
-	 * @param      XmlConfigDomElement[] $routes  The "routes" node (element or node list)
104
-	 * @param      string                $parent  The name of the parent route (if any).
105
-	 *
106
-	 * @author     Dominik del Bondio <[email protected]>
107
-	 * @since      0.11.0
108
-	 */
109
-	protected function parseRoutes(Routing $routing, $routes, $parent = null)
110
-	{
111
-		foreach($routes as $route) {
112
-			$pattern = Toolkit::expandDirectives($route->getAttribute('pattern'));
113
-			$opts = array();
114
-			if($route->hasAttribute('imply'))					$opts['imply']				= Toolkit::literalize($route->getAttribute('imply'));
115
-			if($route->hasAttribute('cut'))						$opts['cut']					= Toolkit::literalize($route->getAttribute('cut'));
116
-			if($route->hasAttribute('stop'))					$opts['stop']					= Toolkit::literalize($route->getAttribute('stop'));
117
-			if($route->hasAttribute('name'))					$opts['name']					= Toolkit::expandDirectives($route->getAttribute('name'));
118
-			if($route->hasAttribute('source'))				$opts['source']				= Toolkit::expandDirectives($route->getAttribute('source'));
119
-			if($route->hasAttribute('constraint'))		$opts['constraint']		= array_map('trim', explode(' ', trim(Toolkit::expandDirectives($route->getAttribute('constraint')))));
120
-			// values which will be set when the route matched
121
-			if($route->hasAttribute('controller'))				$opts['controller']				= Toolkit::expandDirectives($route->getAttribute('controller'));
122
-			if($route->hasAttribute('locale'))				$opts['locale']				= Toolkit::expandDirectives($route->getAttribute('locale'));
123
-			if($route->hasAttribute('method'))				$opts['method']				= Toolkit::expandDirectives($route->getAttribute('method'));
124
-			if($route->hasAttribute('module'))				$opts['module']				= Toolkit::expandDirectives($route->getAttribute('module'));
125
-			if($route->hasAttribute('output_type'))		$opts['output_type']	= Toolkit::expandDirectives($route->getAttribute('output_type'));
126
-
127
-			if($route->has('ignores')) {
128
-				/** @var XmlConfigDomElement $ignore */
129
-				foreach($route->get('ignores') as $ignore) {
130
-					$opts['ignores'][] = $ignore->getValue();
131
-				}
132
-			}
133
-
134
-			if($route->has('defaults')) {
135
-				/** @var XmlConfigDomElement $default */
136
-				foreach($route->get('defaults') as $default) {
137
-					$opts['defaults'][$default->getAttribute('for')] = $default->getValue();
138
-				}
139
-			}
140
-
141
-			if($route->has('callbacks')) {
142
-				$opts['callbacks'] = array();
143
-				/** @var XmlConfigDomElement $callback */
144
-				foreach($route->get('callbacks') as $callback) {
145
-					$opts['callbacks'][] = array(
146
-						'class' => $callback->getAttribute('class'),
147
-						'parameters' => $callback->getAgaviParameters(),
148
-					);
149
-				}
150
-			}
151
-
152
-			$opts['parameters'] = $route->getAgaviParameters();
153
-
154
-			if(isset($opts['name']) && $parent) {
155
-				// don't overwrite $parent since it's used later
156
-				$parentName = $parent;
157
-				if($opts['name'][0] == '.') {
158
-					while($parentName && isset($this->unnamedRoutes[$parentName])) {
159
-						$parentRoute = $routing->getRoute($parentName);
160
-						$parentName = $parentRoute['opt']['parent'];
161
-					}
162
-					$opts['name'] = $parentName . $opts['name'];
163
-				}
164
-			}
165
-
166
-			if(isset($opts['controller']) && $parent) {
167
-				if($opts['controller'][0] == '.') {
168
-					$parentRoute = $routing->getRoute($parent);
169
-					// unwind all empty 'controller' attributes of the parent(s)
170
-					while($parentRoute && empty($parentRoute['opt']['controller'])) {
171
-						$parentRoute = $routing->getRoute($parentRoute['opt']['parent']);
172
-					}
173
-					if(!empty($parentRoute['opt']['controller'])) {
174
-						$opts['controller'] = $parentRoute['opt']['controller'] . $opts['controller'];
175
-					}
176
-				}
177
-			}
178
-
179
-			$name = $routing->addRoute($pattern, $opts, $parent);
180
-			if(!isset($opts['name']) || $opts['name'] !== $name) {
181
-				$this->unnamedRoutes[$name] = true;
182
-			}
183
-			if($route->has('routes')) {
184
-				$this->parseRoutes($routing, $route->get('routes'), $name);
185
-			}
186
-		}
187
-	}
95
+        return serialize($routing->exportRoutes());
96
+    }
97
+
98
+    /**
99
+     * Takes a nested array of AgaviConfigValueHolder containing the routing
100
+     * information and creates the routes in the given routing.
101
+     *
102
+     * @param      Routing               $routing The routing instance to create the routes in.
103
+     * @param      XmlConfigDomElement[] $routes  The "routes" node (element or node list)
104
+     * @param      string                $parent  The name of the parent route (if any).
105
+     *
106
+     * @author     Dominik del Bondio <[email protected]>
107
+     * @since      0.11.0
108
+     */
109
+    protected function parseRoutes(Routing $routing, $routes, $parent = null)
110
+    {
111
+        foreach($routes as $route) {
112
+            $pattern = Toolkit::expandDirectives($route->getAttribute('pattern'));
113
+            $opts = array();
114
+            if($route->hasAttribute('imply'))					$opts['imply']				= Toolkit::literalize($route->getAttribute('imply'));
115
+            if($route->hasAttribute('cut'))						$opts['cut']					= Toolkit::literalize($route->getAttribute('cut'));
116
+            if($route->hasAttribute('stop'))					$opts['stop']					= Toolkit::literalize($route->getAttribute('stop'));
117
+            if($route->hasAttribute('name'))					$opts['name']					= Toolkit::expandDirectives($route->getAttribute('name'));
118
+            if($route->hasAttribute('source'))				$opts['source']				= Toolkit::expandDirectives($route->getAttribute('source'));
119
+            if($route->hasAttribute('constraint'))		$opts['constraint']		= array_map('trim', explode(' ', trim(Toolkit::expandDirectives($route->getAttribute('constraint')))));
120
+            // values which will be set when the route matched
121
+            if($route->hasAttribute('controller'))				$opts['controller']				= Toolkit::expandDirectives($route->getAttribute('controller'));
122
+            if($route->hasAttribute('locale'))				$opts['locale']				= Toolkit::expandDirectives($route->getAttribute('locale'));
123
+            if($route->hasAttribute('method'))				$opts['method']				= Toolkit::expandDirectives($route->getAttribute('method'));
124
+            if($route->hasAttribute('module'))				$opts['module']				= Toolkit::expandDirectives($route->getAttribute('module'));
125
+            if($route->hasAttribute('output_type'))		$opts['output_type']	= Toolkit::expandDirectives($route->getAttribute('output_type'));
126
+
127
+            if($route->has('ignores')) {
128
+                /** @var XmlConfigDomElement $ignore */
129
+                foreach($route->get('ignores') as $ignore) {
130
+                    $opts['ignores'][] = $ignore->getValue();
131
+                }
132
+            }
133
+
134
+            if($route->has('defaults')) {
135
+                /** @var XmlConfigDomElement $default */
136
+                foreach($route->get('defaults') as $default) {
137
+                    $opts['defaults'][$default->getAttribute('for')] = $default->getValue();
138
+                }
139
+            }
140
+
141
+            if($route->has('callbacks')) {
142
+                $opts['callbacks'] = array();
143
+                /** @var XmlConfigDomElement $callback */
144
+                foreach($route->get('callbacks') as $callback) {
145
+                    $opts['callbacks'][] = array(
146
+                        'class' => $callback->getAttribute('class'),
147
+                        'parameters' => $callback->getAgaviParameters(),
148
+                    );
149
+                }
150
+            }
151
+
152
+            $opts['parameters'] = $route->getAgaviParameters();
153
+
154
+            if(isset($opts['name']) && $parent) {
155
+                // don't overwrite $parent since it's used later
156
+                $parentName = $parent;
157
+                if($opts['name'][0] == '.') {
158
+                    while($parentName && isset($this->unnamedRoutes[$parentName])) {
159
+                        $parentRoute = $routing->getRoute($parentName);
160
+                        $parentName = $parentRoute['opt']['parent'];
161
+                    }
162
+                    $opts['name'] = $parentName . $opts['name'];
163
+                }
164
+            }
165
+
166
+            if(isset($opts['controller']) && $parent) {
167
+                if($opts['controller'][0] == '.') {
168
+                    $parentRoute = $routing->getRoute($parent);
169
+                    // unwind all empty 'controller' attributes of the parent(s)
170
+                    while($parentRoute && empty($parentRoute['opt']['controller'])) {
171
+                        $parentRoute = $routing->getRoute($parentRoute['opt']['parent']);
172
+                    }
173
+                    if(!empty($parentRoute['opt']['controller'])) {
174
+                        $opts['controller'] = $parentRoute['opt']['controller'] . $opts['controller'];
175
+                    }
176
+                }
177
+            }
178
+
179
+            $name = $routing->addRoute($pattern, $opts, $parent);
180
+            if(!isset($opts['name']) || $opts['name'] !== $name) {
181
+                $this->unnamedRoutes[$name] = true;
182
+            }
183
+            if($route->has('routes')) {
184
+                $this->parseRoutes($routing, $route->get('routes'), $name);
185
+            }
186
+        }
187
+    }
188 188
 }
189 189
 
190 190
 ?>
191 191
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 		// clear the routing
80 80
 		$routing->importRoutes(array());
81 81
 		
82
-		foreach($document->getConfigurationElements() as $cfg) {
83
-			if($cfg->has('routes')) {
82
+		foreach ($document->getConfigurationElements() as $cfg) {
83
+			if ($cfg->has('routes')) {
84 84
 				$this->parseRoutes($routing, $cfg->get('routes'));
85 85
 			}
86 86
 		}
@@ -108,40 +108,40 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	protected function parseRoutes(Routing $routing, $routes, $parent = null)
110 110
 	{
111
-		foreach($routes as $route) {
111
+		foreach ($routes as $route) {
112 112
 			$pattern = Toolkit::expandDirectives($route->getAttribute('pattern'));
113 113
 			$opts = array();
114
-			if($route->hasAttribute('imply'))					$opts['imply']				= Toolkit::literalize($route->getAttribute('imply'));
115
-			if($route->hasAttribute('cut'))						$opts['cut']					= Toolkit::literalize($route->getAttribute('cut'));
116
-			if($route->hasAttribute('stop'))					$opts['stop']					= Toolkit::literalize($route->getAttribute('stop'));
117
-			if($route->hasAttribute('name'))					$opts['name']					= Toolkit::expandDirectives($route->getAttribute('name'));
118
-			if($route->hasAttribute('source'))				$opts['source']				= Toolkit::expandDirectives($route->getAttribute('source'));
119
-			if($route->hasAttribute('constraint'))		$opts['constraint']		= array_map('trim', explode(' ', trim(Toolkit::expandDirectives($route->getAttribute('constraint')))));
114
+			if ($route->hasAttribute('imply'))					$opts['imply'] = Toolkit::literalize($route->getAttribute('imply'));
115
+			if ($route->hasAttribute('cut'))						$opts['cut'] = Toolkit::literalize($route->getAttribute('cut'));
116
+			if ($route->hasAttribute('stop'))					$opts['stop']					= Toolkit::literalize($route->getAttribute('stop'));
117
+			if ($route->hasAttribute('name'))					$opts['name']					= Toolkit::expandDirectives($route->getAttribute('name'));
118
+			if ($route->hasAttribute('source'))				$opts['source'] = Toolkit::expandDirectives($route->getAttribute('source'));
119
+			if ($route->hasAttribute('constraint'))		$opts['constraint'] = array_map('trim', explode(' ', trim(Toolkit::expandDirectives($route->getAttribute('constraint')))));
120 120
 			// values which will be set when the route matched
121
-			if($route->hasAttribute('controller'))				$opts['controller']				= Toolkit::expandDirectives($route->getAttribute('controller'));
122
-			if($route->hasAttribute('locale'))				$opts['locale']				= Toolkit::expandDirectives($route->getAttribute('locale'));
123
-			if($route->hasAttribute('method'))				$opts['method']				= Toolkit::expandDirectives($route->getAttribute('method'));
124
-			if($route->hasAttribute('module'))				$opts['module']				= Toolkit::expandDirectives($route->getAttribute('module'));
125
-			if($route->hasAttribute('output_type'))		$opts['output_type']	= Toolkit::expandDirectives($route->getAttribute('output_type'));
121
+			if ($route->hasAttribute('controller'))				$opts['controller'] = Toolkit::expandDirectives($route->getAttribute('controller'));
122
+			if ($route->hasAttribute('locale'))				$opts['locale']				= Toolkit::expandDirectives($route->getAttribute('locale'));
123
+			if ($route->hasAttribute('method'))				$opts['method']				= Toolkit::expandDirectives($route->getAttribute('method'));
124
+			if ($route->hasAttribute('module'))				$opts['module']				= Toolkit::expandDirectives($route->getAttribute('module'));
125
+			if ($route->hasAttribute('output_type'))		$opts['output_type'] = Toolkit::expandDirectives($route->getAttribute('output_type'));
126 126
 
127
-			if($route->has('ignores')) {
127
+			if ($route->has('ignores')) {
128 128
 				/** @var XmlConfigDomElement $ignore */
129
-				foreach($route->get('ignores') as $ignore) {
129
+				foreach ($route->get('ignores') as $ignore) {
130 130
 					$opts['ignores'][] = $ignore->getValue();
131 131
 				}
132 132
 			}
133 133
 
134
-			if($route->has('defaults')) {
134
+			if ($route->has('defaults')) {
135 135
 				/** @var XmlConfigDomElement $default */
136
-				foreach($route->get('defaults') as $default) {
136
+				foreach ($route->get('defaults') as $default) {
137 137
 					$opts['defaults'][$default->getAttribute('for')] = $default->getValue();
138 138
 				}
139 139
 			}
140 140
 
141
-			if($route->has('callbacks')) {
141
+			if ($route->has('callbacks')) {
142 142
 				$opts['callbacks'] = array();
143 143
 				/** @var XmlConfigDomElement $callback */
144
-				foreach($route->get('callbacks') as $callback) {
144
+				foreach ($route->get('callbacks') as $callback) {
145 145
 					$opts['callbacks'][] = array(
146 146
 						'class' => $callback->getAttribute('class'),
147 147
 						'parameters' => $callback->getAgaviParameters(),
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 
152 152
 			$opts['parameters'] = $route->getAgaviParameters();
153 153
 
154
-			if(isset($opts['name']) && $parent) {
154
+			if (isset($opts['name']) && $parent) {
155 155
 				// don't overwrite $parent since it's used later
156 156
 				$parentName = $parent;
157
-				if($opts['name'][0] == '.') {
158
-					while($parentName && isset($this->unnamedRoutes[$parentName])) {
157
+				if ($opts['name'][0] == '.') {
158
+					while ($parentName && isset($this->unnamedRoutes[$parentName])) {
159 159
 						$parentRoute = $routing->getRoute($parentName);
160 160
 						$parentName = $parentRoute['opt']['parent'];
161 161
 					}
@@ -163,24 +163,24 @@  discard block
 block discarded – undo
163 163
 				}
164 164
 			}
165 165
 
166
-			if(isset($opts['controller']) && $parent) {
167
-				if($opts['controller'][0] == '.') {
166
+			if (isset($opts['controller']) && $parent) {
167
+				if ($opts['controller'][0] == '.') {
168 168
 					$parentRoute = $routing->getRoute($parent);
169 169
 					// unwind all empty 'controller' attributes of the parent(s)
170
-					while($parentRoute && empty($parentRoute['opt']['controller'])) {
170
+					while ($parentRoute && empty($parentRoute['opt']['controller'])) {
171 171
 						$parentRoute = $routing->getRoute($parentRoute['opt']['parent']);
172 172
 					}
173
-					if(!empty($parentRoute['opt']['controller'])) {
173
+					if (!empty($parentRoute['opt']['controller'])) {
174 174
 						$opts['controller'] = $parentRoute['opt']['controller'] . $opts['controller'];
175 175
 					}
176 176
 				}
177 177
 			}
178 178
 
179 179
 			$name = $routing->addRoute($pattern, $opts, $parent);
180
-			if(!isset($opts['name']) || $opts['name'] !== $name) {
180
+			if (!isset($opts['name']) || $opts['name'] !== $name) {
181 181
 				$this->unnamedRoutes[$name] = true;
182 182
 			}
183
-			if($route->has('routes')) {
183
+			if ($route->has('routes')) {
184 184
 				$this->parseRoutes($routing, $route->get('routes'), $name);
185 185
 			}
186 186
 		}
Please login to merge, or discard this patch.
Braces   +33 added lines, -11 removed lines patch added patch discarded remove patch
@@ -111,18 +111,40 @@
 block discarded – undo
111 111
 		foreach($routes as $route) {
112 112
 			$pattern = Toolkit::expandDirectives($route->getAttribute('pattern'));
113 113
 			$opts = array();
114
-			if($route->hasAttribute('imply'))					$opts['imply']				= Toolkit::literalize($route->getAttribute('imply'));
115
-			if($route->hasAttribute('cut'))						$opts['cut']					= Toolkit::literalize($route->getAttribute('cut'));
116
-			if($route->hasAttribute('stop'))					$opts['stop']					= Toolkit::literalize($route->getAttribute('stop'));
117
-			if($route->hasAttribute('name'))					$opts['name']					= Toolkit::expandDirectives($route->getAttribute('name'));
118
-			if($route->hasAttribute('source'))				$opts['source']				= Toolkit::expandDirectives($route->getAttribute('source'));
119
-			if($route->hasAttribute('constraint'))		$opts['constraint']		= array_map('trim', explode(' ', trim(Toolkit::expandDirectives($route->getAttribute('constraint')))));
114
+			if($route->hasAttribute('imply')) {
115
+			    $opts['imply']				= Toolkit::literalize($route->getAttribute('imply'));
116
+			}
117
+			if($route->hasAttribute('cut')) {
118
+			    $opts['cut']					= Toolkit::literalize($route->getAttribute('cut'));
119
+			}
120
+			if($route->hasAttribute('stop')) {
121
+			    $opts['stop']					= Toolkit::literalize($route->getAttribute('stop'));
122
+			}
123
+			if($route->hasAttribute('name')) {
124
+			    $opts['name']					= Toolkit::expandDirectives($route->getAttribute('name'));
125
+			}
126
+			if($route->hasAttribute('source')) {
127
+			    $opts['source']				= Toolkit::expandDirectives($route->getAttribute('source'));
128
+			}
129
+			if($route->hasAttribute('constraint')) {
130
+			    $opts['constraint']		= array_map('trim', explode(' ', trim(Toolkit::expandDirectives($route->getAttribute('constraint')))));
131
+			}
120 132
 			// values which will be set when the route matched
121
-			if($route->hasAttribute('controller'))				$opts['controller']				= Toolkit::expandDirectives($route->getAttribute('controller'));
122
-			if($route->hasAttribute('locale'))				$opts['locale']				= Toolkit::expandDirectives($route->getAttribute('locale'));
123
-			if($route->hasAttribute('method'))				$opts['method']				= Toolkit::expandDirectives($route->getAttribute('method'));
124
-			if($route->hasAttribute('module'))				$opts['module']				= Toolkit::expandDirectives($route->getAttribute('module'));
125
-			if($route->hasAttribute('output_type'))		$opts['output_type']	= Toolkit::expandDirectives($route->getAttribute('output_type'));
133
+			if($route->hasAttribute('controller')) {
134
+			    $opts['controller']				= Toolkit::expandDirectives($route->getAttribute('controller'));
135
+			}
136
+			if($route->hasAttribute('locale')) {
137
+			    $opts['locale']				= Toolkit::expandDirectives($route->getAttribute('locale'));
138
+			}
139
+			if($route->hasAttribute('method')) {
140
+			    $opts['method']				= Toolkit::expandDirectives($route->getAttribute('method'));
141
+			}
142
+			if($route->hasAttribute('module')) {
143
+			    $opts['module']				= Toolkit::expandDirectives($route->getAttribute('module'));
144
+			}
145
+			if($route->hasAttribute('output_type')) {
146
+			    $opts['output_type']	= Toolkit::expandDirectives($route->getAttribute('output_type'));
147
+			}
126 148
 
127 149
 			if($route->has('ignores')) {
128 150
 				/** @var XmlConfigDomElement $ignore */
Please login to merge, or discard this patch.
src/config/util/dom/XmlConfigDomDocument.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -235,7 +235,7 @@
 block discarded – undo
235 235
 	 * @param      bool     $deep Whether or not to recursively import the node's
236 236
 	 *                            subtree.
237 237
 	 *
238
-	 * @return     \DOMNode|XmlConfigDomNode|bool  The copied node, or false if it cannot be copied.
238
+	 * @return     \DOMNode  The copied node, or false if it cannot be copied.
239 239
 	 *
240 240
 	 * @author     Noah Fontes <[email protected]>
241 241
 	 * @since      1.0.0
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	{
88 88
 		parent::__construct($version, $encoding);
89 89
 		
90
-		foreach($this->nodeClassMap as $domClass => $agaviClass) {
90
+		foreach ($this->nodeClassMap as $domClass => $agaviClass) {
91 91
 			$this->registerNodeClass($domClass, $agaviClass);
92 92
 		}
93 93
 		
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 		
113 113
 		$result = parent::load($filename, $options);
114 114
 		
115
-		if(libxml_get_last_error() !== false) {
115
+		if (libxml_get_last_error() !== false) {
116 116
 			$errors = array();
117
-			foreach(libxml_get_errors() as $error) {
117
+			foreach (libxml_get_errors() as $error) {
118 118
 				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
119 119
 			}
120 120
 			libxml_clear_errors();
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		
133 133
 		$this->xpath = new \DOMXPath($this);
134 134
 		
135
-		if($this->isAgaviConfiguration()) {
135
+		if ($this->isAgaviConfiguration()) {
136 136
 			XmlConfigParser::registerAgaviNamespaces($this);
137 137
 		}
138 138
 		
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 		
158 158
 		$result = parent::loadXML($source, $options);
159 159
 		
160
-		if(libxml_get_last_error() !== false) {
160
+		if (libxml_get_last_error() !== false) {
161 161
 			$errors = array();
162
-			foreach(libxml_get_errors() as $error) {
162
+			foreach (libxml_get_errors() as $error) {
163 163
 				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
164 164
 			}
165 165
 			libxml_clear_errors();
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		
178 178
 		$this->xpath = new \DOMXPath($this);
179 179
 		
180
-		if($this->isAgaviConfiguration()) {
180
+		if ($this->isAgaviConfiguration()) {
181 181
 			XmlConfigParser::registerAgaviNamespaces($this);
182 182
 		}
183 183
 		
@@ -201,17 +201,17 @@  discard block
 block discarded – undo
201 201
 		
202 202
 		$result = parent::xinclude($options);
203 203
 		
204
-		if(libxml_get_last_error() !== false) {
204
+		if (libxml_get_last_error() !== false) {
205 205
 			$throw = false;
206 206
 			$errors = array();
207
-			foreach(libxml_get_errors() as $error) {
208
-				if($error->level != LIBXML_ERR_WARNING) {
207
+			foreach (libxml_get_errors() as $error) {
208
+				if ($error->level != LIBXML_ERR_WARNING) {
209 209
 					$throw = true;
210 210
 				}
211 211
 				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
212 212
 			}
213 213
 			libxml_clear_errors();
214
-			if($throw) {
214
+			if ($throw) {
215 215
 				libxml_use_internal_errors($luie);
216 216
 				throw new \DOMException(
217 217
 					sprintf(
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 		
248 248
 		$result = parent::importNode($node, $deep);
249 249
 		
250
-		if(libxml_get_last_error() !== false) {
250
+		if (libxml_get_last_error() !== false) {
251 251
 			$errors = array();
252
-			foreach(libxml_get_errors() as $error) {
252
+			foreach (libxml_get_errors() as $error) {
253 253
 				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
254 254
 			}
255 255
 			libxml_clear_errors();
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 		libxml_clear_errors();
286 286
 		
287 287
 		// gotta do the @ to suppress PHP warnings when the schema cannot be loaded or is invalid
288
-		if(!$result = @parent::schemaValidate($filename)) {
288
+		if (!$result = @parent::schemaValidate($filename)) {
289 289
 			$errors = array();
290
-			foreach(libxml_get_errors() as $error) {
290
+			foreach (libxml_get_errors() as $error) {
291 291
 				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
292 292
 			}
293 293
 			libxml_clear_errors();
@@ -323,9 +323,9 @@  discard block
 block discarded – undo
323 323
 		libxml_clear_errors();
324 324
 		
325 325
 		// gotta do the @ to suppress PHP warnings when the schema cannot be loaded or is invalid
326
-		if(!$result = @parent::schemaValidateSource($source)) {
326
+		if (!$result = @parent::schemaValidateSource($source)) {
327 327
 			$errors = array();
328
-			foreach(libxml_get_errors() as $error) {
328
+			foreach (libxml_get_errors() as $error) {
329 329
 				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
330 330
 			}
331 331
 			libxml_clear_errors();
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 		libxml_clear_errors();
361 361
 		
362 362
 		// gotta do the @ to suppress PHP warnings when the schema cannot be loaded or is invalid
363
-		if(!$result = @parent::relaxNGValidate($filename)) {
363
+		if (!$result = @parent::relaxNGValidate($filename)) {
364 364
 			$errors = array();
365
-			foreach(libxml_get_errors() as $error) {
365
+			foreach (libxml_get_errors() as $error) {
366 366
 				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
367 367
 			}
368 368
 			libxml_clear_errors();
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 	 */
467 467
 	public function getAgaviEnvelopeNamespace()
468 468
 	{
469
-		if($this->isAgaviConfiguration()) {
469
+		if ($this->isAgaviConfiguration()) {
470 470
 			return $this->documentElement->namespaceURI;
471 471
 		}
472 472
 	}
@@ -484,11 +484,11 @@  discard block
 block discarded – undo
484 484
 	{
485 485
 		$retval = array();
486 486
 		
487
-		if($this->isAgaviConfiguration()) {
487
+		if ($this->isAgaviConfiguration()) {
488 488
 			$agaviNs = $this->getAgaviEnvelopeNamespace();
489 489
 			
490
-			foreach($this->documentElement->childNodes as $node) {
491
-				if($node->nodeType == XML_ELEMENT_NODE && $node->localName == 'configuration' && $node->namespaceURI == $agaviNs) {
490
+			foreach ($this->documentElement->childNodes as $node) {
491
+				if ($node->nodeType == XML_ELEMENT_NODE && $node->localName == 'configuration' && $node->namespaceURI == $agaviNs) {
492 492
 					$retval[] = $node;
493 493
 				}
494 494
 			}
@@ -507,11 +507,11 @@  discard block
 block discarded – undo
507 507
 	 */
508 508
 	public function getSandbox()
509 509
 	{
510
-		if($this->isAgaviConfiguration()) {
510
+		if ($this->isAgaviConfiguration()) {
511 511
 			$agaviNs = $this->getAgaviEnvelopeNamespace();
512 512
 			
513
-			foreach($this->documentElement->childNodes as $node) {
514
-				if($node->nodeType == XML_ELEMENT_NODE && $node->localName == 'sandbox' && $node->namespaceURI == $agaviNs) {
513
+			foreach ($this->documentElement->childNodes as $node) {
514
+				if ($node->nodeType == XML_ELEMENT_NODE && $node->localName == 'sandbox' && $node->namespaceURI == $agaviNs) {
515 515
 					return $node;
516 516
 				}
517 517
 			}
Please login to merge, or discard this patch.
Indentation   +461 added lines, -461 removed lines patch added patch discarded remove patch
@@ -35,488 +35,488 @@
 block discarded – undo
35 35
  */
36 36
 class XmlConfigDomDocument extends \DOMDocument
37 37
 {
38
-	/**
39
-	 * @var        string Default namespace used by several convenience methods in
40
-	 *                    other node classes to access/retrieve elements.
41
-	 */
42
-	protected $defaultNamespaceUri = '';
38
+    /**
39
+     * @var        string Default namespace used by several convenience methods in
40
+     *                    other node classes to access/retrieve elements.
41
+     */
42
+    protected $defaultNamespaceUri = '';
43 43
 	
44
-	/**
45
-	 * @var        string XPath prefix of the default namespace defined above.
46
-	 */
47
-	protected $defaultNamespacePrefix = '';
44
+    /**
45
+     * @var        string XPath prefix of the default namespace defined above.
46
+     */
47
+    protected $defaultNamespacePrefix = '';
48 48
 	
49
-	/**
50
-	 * @var        \DOMXPath A DOMXPath instance for this document.
51
-	 */
52
-	protected $xpath = null;
49
+    /**
50
+     * @var        \DOMXPath A DOMXPath instance for this document.
51
+     */
52
+    protected $xpath = null;
53 53
 	
54
-	/**
55
-	 * @var        array A map of DOM classes and extended Agavi implementations.
56
-	 */
57
-	protected $nodeClassMap = array(
58
-		'\\DOMAttr'                  => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomAttr',
59
-		'\\DOMCharacterData'         => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomCharacterData',
60
-		'\\DOMComment'               => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomComment',
61
-		// yes, even DOMDocument, so we don't get back a vanilla DOMDocument when doing $doc->documentElement etc
62
-		'\\DOMDocument'              => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomDocument',
63
-		'\\DOMDocumentFragment'      => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomDocumentFragment',
64
-		'\\DOMDocumentType'          => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomDocumentType',
65
-		'\\DOMElement'               => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomElement',
66
-		'\\DOMEntity'                => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomEntity',
67
-		'\\DOMEntityReference'       => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomEntityReference',
68
-		'\\DOMNode'                  => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomNode',
69
-		// 'DOMNotation'              => 'XmlConfigDomNotation',
70
-		'\\DOMProcessingInstruction' => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomProcessingInstruction',
71
-		'\\DOMText'                  => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomText',
72
-	);
54
+    /**
55
+     * @var        array A map of DOM classes and extended Agavi implementations.
56
+     */
57
+    protected $nodeClassMap = array(
58
+        '\\DOMAttr'                  => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomAttr',
59
+        '\\DOMCharacterData'         => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomCharacterData',
60
+        '\\DOMComment'               => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomComment',
61
+        // yes, even DOMDocument, so we don't get back a vanilla DOMDocument when doing $doc->documentElement etc
62
+        '\\DOMDocument'              => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomDocument',
63
+        '\\DOMDocumentFragment'      => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomDocumentFragment',
64
+        '\\DOMDocumentType'          => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomDocumentType',
65
+        '\\DOMElement'               => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomElement',
66
+        '\\DOMEntity'                => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomEntity',
67
+        '\\DOMEntityReference'       => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomEntityReference',
68
+        '\\DOMNode'                  => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomNode',
69
+        // 'DOMNotation'              => 'XmlConfigDomNotation',
70
+        '\\DOMProcessingInstruction' => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomProcessingInstruction',
71
+        '\\DOMText'                  => 'Agavi\\Config\\Util\\Dom\\XmlConfigDomText',
72
+    );
73 73
 	
74
-	/**
75
-	 * The constructor.
76
-	 * Will auto-register Agavi DOM node classes and create an XPath instance.
77
-	 *
78
-	 * @param      string $version  The XML version.
79
-	 * @param      string $encoding The XML encoding.
80
-	 *
81
-	 * @see        DOMDocument::__construct()
82
-	 *
83
-	 * @author     David Zülke <[email protected]>
84
-	 * @since      1.0.0
85
-	 */
86
-	public function __construct($version = "1.0", $encoding = "UTF-8")
87
-	{
88
-		parent::__construct($version, $encoding);
89
-		
90
-		foreach($this->nodeClassMap as $domClass => $agaviClass) {
91
-			$this->registerNodeClass($domClass, $agaviClass);
92
-		}
93
-		
94
-		$this->xpath = new \DOMXPath($this);
95
-	}
74
+    /**
75
+     * The constructor.
76
+     * Will auto-register Agavi DOM node classes and create an XPath instance.
77
+     *
78
+     * @param      string $version  The XML version.
79
+     * @param      string $encoding The XML encoding.
80
+     *
81
+     * @see        DOMDocument::__construct()
82
+     *
83
+     * @author     David Zülke <[email protected]>
84
+     * @since      1.0.0
85
+     */
86
+    public function __construct($version = "1.0", $encoding = "UTF-8")
87
+    {
88
+        parent::__construct($version, $encoding);
89
+		
90
+        foreach($this->nodeClassMap as $domClass => $agaviClass) {
91
+            $this->registerNodeClass($domClass, $agaviClass);
92
+        }
93
+		
94
+        $this->xpath = new \DOMXPath($this);
95
+    }
96 96
 	
97
-	/**
98
-	 * Load XML from a file.
99
-	 *
100
-	 * @param      string $filename The path to the XML document.
101
-	 * @param      int    $options  Bitwise OR of the libxml option constants.
102
-	 *
103
-	 * @return     bool True of the operation is successful; false otherwise.
104
-	 *
105
-	 * @author     Noah Fontes <[email protected]>
106
-	 * @since      1.0.0
107
-	 */
108
-	public function load($filename, $options = 0)
109
-	{
110
-		$luie = libxml_use_internal_errors(true);
111
-		libxml_clear_errors();
112
-		
113
-		$result = parent::load($filename, $options);
114
-		
115
-		if(libxml_get_last_error() !== false) {
116
-			$errors = array();
117
-			foreach(libxml_get_errors() as $error) {
118
-				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
119
-			}
120
-			libxml_clear_errors();
121
-			libxml_use_internal_errors($luie);
122
-			throw new \DOMException(
123
-				sprintf(
124
-					'Error%s occurred while parsing the document: ' . "\n\n%s",
125
-					count($errors) > 1 ? 's' : '',
126
-					implode("\n", $errors)
127
-				)
128
-			);
129
-		}
130
-		
131
-		libxml_use_internal_errors($luie);
132
-		
133
-		$this->xpath = new \DOMXPath($this);
134
-		
135
-		if($this->isAgaviConfiguration()) {
136
-			XmlConfigParser::registerAgaviNamespaces($this);
137
-		}
138
-		
139
-		return $result;
140
-	}
97
+    /**
98
+     * Load XML from a file.
99
+     *
100
+     * @param      string $filename The path to the XML document.
101
+     * @param      int    $options  Bitwise OR of the libxml option constants.
102
+     *
103
+     * @return     bool True of the operation is successful; false otherwise.
104
+     *
105
+     * @author     Noah Fontes <[email protected]>
106
+     * @since      1.0.0
107
+     */
108
+    public function load($filename, $options = 0)
109
+    {
110
+        $luie = libxml_use_internal_errors(true);
111
+        libxml_clear_errors();
112
+		
113
+        $result = parent::load($filename, $options);
114
+		
115
+        if(libxml_get_last_error() !== false) {
116
+            $errors = array();
117
+            foreach(libxml_get_errors() as $error) {
118
+                $errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
119
+            }
120
+            libxml_clear_errors();
121
+            libxml_use_internal_errors($luie);
122
+            throw new \DOMException(
123
+                sprintf(
124
+                    'Error%s occurred while parsing the document: ' . "\n\n%s",
125
+                    count($errors) > 1 ? 's' : '',
126
+                    implode("\n", $errors)
127
+                )
128
+            );
129
+        }
130
+		
131
+        libxml_use_internal_errors($luie);
132
+		
133
+        $this->xpath = new \DOMXPath($this);
134
+		
135
+        if($this->isAgaviConfiguration()) {
136
+            XmlConfigParser::registerAgaviNamespaces($this);
137
+        }
138
+		
139
+        return $result;
140
+    }
141 141
 	
142
-	/**
143
-	 * Load XML from a string.
144
-	 *
145
-	 * @param      string $source  The string containing the XML.
146
-	 * @param      int    $options Bitwise OR of the libxml option constants.
147
-	 *
148
-	 * @return     bool True of the operation is successful; false otherwise.
149
-	 *
150
-	 * @author     Noah Fontes <[email protected]>
151
-	 * @since      1.0.0
152
-	 */
153
-	public function loadXml($source, $options = 0)
154
-	{
155
-		$luie = libxml_use_internal_errors(true);
156
-		libxml_clear_errors();
157
-		
158
-		$result = parent::loadXML($source, $options);
159
-		
160
-		if(libxml_get_last_error() !== false) {
161
-			$errors = array();
162
-			foreach(libxml_get_errors() as $error) {
163
-				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
164
-			}
165
-			libxml_clear_errors();
166
-			libxml_use_internal_errors($luie);
167
-			throw new \DOMException(
168
-				sprintf(
169
-					'Error%s occurred while parsing the document: ' . "\n\n%s",
170
-					count($errors) > 1 ? 's' : '',
171
-					implode("\n", $errors)
172
-				)
173
-			);
174
-		}
175
-		
176
-		libxml_use_internal_errors($luie);
177
-		
178
-		$this->xpath = new \DOMXPath($this);
179
-		
180
-		if($this->isAgaviConfiguration()) {
181
-			XmlConfigParser::registerAgaviNamespaces($this);
182
-		}
183
-		
184
-		return $result;
185
-	}
142
+    /**
143
+     * Load XML from a string.
144
+     *
145
+     * @param      string $source  The string containing the XML.
146
+     * @param      int    $options Bitwise OR of the libxml option constants.
147
+     *
148
+     * @return     bool True of the operation is successful; false otherwise.
149
+     *
150
+     * @author     Noah Fontes <[email protected]>
151
+     * @since      1.0.0
152
+     */
153
+    public function loadXml($source, $options = 0)
154
+    {
155
+        $luie = libxml_use_internal_errors(true);
156
+        libxml_clear_errors();
157
+		
158
+        $result = parent::loadXML($source, $options);
159
+		
160
+        if(libxml_get_last_error() !== false) {
161
+            $errors = array();
162
+            foreach(libxml_get_errors() as $error) {
163
+                $errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
164
+            }
165
+            libxml_clear_errors();
166
+            libxml_use_internal_errors($luie);
167
+            throw new \DOMException(
168
+                sprintf(
169
+                    'Error%s occurred while parsing the document: ' . "\n\n%s",
170
+                    count($errors) > 1 ? 's' : '',
171
+                    implode("\n", $errors)
172
+                )
173
+            );
174
+        }
175
+		
176
+        libxml_use_internal_errors($luie);
177
+		
178
+        $this->xpath = new \DOMXPath($this);
179
+		
180
+        if($this->isAgaviConfiguration()) {
181
+            XmlConfigParser::registerAgaviNamespaces($this);
182
+        }
183
+		
184
+        return $result;
185
+    }
186 186
 	
187
-	/**
188
-	 * Substitutes XIncludes in a DOMDocument object.
189
-	 *
190
-	 * @param      int $options Bitwise OR of the libxml option constants.
191
-	 *
192
-	 * @return     int The number of XIncludes in the document.
193
-	 *
194
-	 * @author     Noah Fontes <[email protected]>
195
-	 * @since      1.0.0
196
-	 */
197
-	public function xinclude($options = 0)
198
-	{
199
-		$luie = libxml_use_internal_errors(true);
200
-		libxml_clear_errors();
201
-		
202
-		$result = parent::xinclude($options);
203
-		
204
-		if(libxml_get_last_error() !== false) {
205
-			$throw = false;
206
-			$errors = array();
207
-			foreach(libxml_get_errors() as $error) {
208
-				if($error->level != LIBXML_ERR_WARNING) {
209
-					$throw = true;
210
-				}
211
-				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
212
-			}
213
-			libxml_clear_errors();
214
-			if($throw) {
215
-				libxml_use_internal_errors($luie);
216
-				throw new \DOMException(
217
-					sprintf(
218
-						'Error%s occurred while resolving XInclude directives: ' . "\n\n%s", 
219
-						count($errors) > 1 ? 's' : '', 
220
-						implode("\n", $errors)
221
-					)
222
-				);
223
-			}
224
-		}
225
-		
226
-		libxml_use_internal_errors($luie);
227
-		
228
-		return $result;
229
-	}
187
+    /**
188
+     * Substitutes XIncludes in a DOMDocument object.
189
+     *
190
+     * @param      int $options Bitwise OR of the libxml option constants.
191
+     *
192
+     * @return     int The number of XIncludes in the document.
193
+     *
194
+     * @author     Noah Fontes <[email protected]>
195
+     * @since      1.0.0
196
+     */
197
+    public function xinclude($options = 0)
198
+    {
199
+        $luie = libxml_use_internal_errors(true);
200
+        libxml_clear_errors();
201
+		
202
+        $result = parent::xinclude($options);
203
+		
204
+        if(libxml_get_last_error() !== false) {
205
+            $throw = false;
206
+            $errors = array();
207
+            foreach(libxml_get_errors() as $error) {
208
+                if($error->level != LIBXML_ERR_WARNING) {
209
+                    $throw = true;
210
+                }
211
+                $errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
212
+            }
213
+            libxml_clear_errors();
214
+            if($throw) {
215
+                libxml_use_internal_errors($luie);
216
+                throw new \DOMException(
217
+                    sprintf(
218
+                        'Error%s occurred while resolving XInclude directives: ' . "\n\n%s", 
219
+                        count($errors) > 1 ? 's' : '', 
220
+                        implode("\n", $errors)
221
+                    )
222
+                );
223
+            }
224
+        }
225
+		
226
+        libxml_use_internal_errors($luie);
227
+		
228
+        return $result;
229
+    }
230 230
 	
231
-	/**
232
-	 * Import a node into the current document.
233
-	 *
234
-	 * @param      \DOMNode $node The node to import.
235
-	 * @param      bool     $deep Whether or not to recursively import the node's
236
-	 *                            subtree.
237
-	 *
238
-	 * @return     \DOMNode|XmlConfigDomNode|bool  The copied node, or false if it cannot be copied.
239
-	 *
240
-	 * @author     Noah Fontes <[email protected]>
241
-	 * @since      1.0.0
242
-	 */
243
-	public function importNode(\DOMNode $node, $deep)
244
-	{
245
-		$luie = libxml_use_internal_errors(true);
246
-		libxml_clear_errors();
247
-		
248
-		$result = parent::importNode($node, $deep);
249
-		
250
-		if(libxml_get_last_error() !== false) {
251
-			$errors = array();
252
-			foreach(libxml_get_errors() as $error) {
253
-				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
254
-			}
255
-			libxml_clear_errors();
256
-			libxml_use_internal_errors($luie);
257
-			throw new \DOMException(
258
-				sprintf(
259
-					'Error%s occurred while importing a new node "%s": ' . "\n\n%s",
260
-					count($errors) > 1 ? 's' : '', 
261
-					$node->nodeName,
262
-					implode("\n", $errors)
263
-				)
264
-			);
265
-		}
266
-		
267
-		libxml_use_internal_errors($luie);
268
-		
269
-		return $result;
270
-	}
231
+    /**
232
+     * Import a node into the current document.
233
+     *
234
+     * @param      \DOMNode $node The node to import.
235
+     * @param      bool     $deep Whether or not to recursively import the node's
236
+     *                            subtree.
237
+     *
238
+     * @return     \DOMNode|XmlConfigDomNode|bool  The copied node, or false if it cannot be copied.
239
+     *
240
+     * @author     Noah Fontes <[email protected]>
241
+     * @since      1.0.0
242
+     */
243
+    public function importNode(\DOMNode $node, $deep)
244
+    {
245
+        $luie = libxml_use_internal_errors(true);
246
+        libxml_clear_errors();
247
+		
248
+        $result = parent::importNode($node, $deep);
249
+		
250
+        if(libxml_get_last_error() !== false) {
251
+            $errors = array();
252
+            foreach(libxml_get_errors() as $error) {
253
+                $errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
254
+            }
255
+            libxml_clear_errors();
256
+            libxml_use_internal_errors($luie);
257
+            throw new \DOMException(
258
+                sprintf(
259
+                    'Error%s occurred while importing a new node "%s": ' . "\n\n%s",
260
+                    count($errors) > 1 ? 's' : '', 
261
+                    $node->nodeName,
262
+                    implode("\n", $errors)
263
+                )
264
+            );
265
+        }
266
+		
267
+        libxml_use_internal_errors($luie);
268
+		
269
+        return $result;
270
+    }
271 271
 	
272
-	/**
273
-	 * Validate a document based on a schema.
274
-	 *
275
-	 * @param      string $filename The path to the schema.
276
-	 *
277
-	 * @return     bool True if the validation is successful; false otherwise.
278
-	 *
279
-	 * @author     Noah Fontes <[email protected]>
280
-	 * @since      1.0.0
281
-	 */
282
-	public function schemaValidate($filename)
283
-	{
284
-		$luie = libxml_use_internal_errors(true);
285
-		libxml_clear_errors();
286
-		
287
-		// gotta do the @ to suppress PHP warnings when the schema cannot be loaded or is invalid
288
-		if(!$result = @parent::schemaValidate($filename)) {
289
-			$errors = array();
290
-			foreach(libxml_get_errors() as $error) {
291
-				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
292
-			}
293
-			libxml_clear_errors();
294
-			libxml_use_internal_errors($luie);
295
-			throw new \DOMException(
296
-				sprintf(
297
-					'XML Schema validation with "%s" failed due to the following error%s: ' . "\n\n%s", 
298
-					$filename, 
299
-					count($errors) > 1 ? 's' : '', 
300
-					implode("\n", $errors)
301
-				)
302
-			);
303
-		}
304
-		
305
-		libxml_use_internal_errors($luie);
306
-		
307
-		return $result;
308
-	}
272
+    /**
273
+     * Validate a document based on a schema.
274
+     *
275
+     * @param      string $filename The path to the schema.
276
+     *
277
+     * @return     bool True if the validation is successful; false otherwise.
278
+     *
279
+     * @author     Noah Fontes <[email protected]>
280
+     * @since      1.0.0
281
+     */
282
+    public function schemaValidate($filename)
283
+    {
284
+        $luie = libxml_use_internal_errors(true);
285
+        libxml_clear_errors();
286
+		
287
+        // gotta do the @ to suppress PHP warnings when the schema cannot be loaded or is invalid
288
+        if(!$result = @parent::schemaValidate($filename)) {
289
+            $errors = array();
290
+            foreach(libxml_get_errors() as $error) {
291
+                $errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
292
+            }
293
+            libxml_clear_errors();
294
+            libxml_use_internal_errors($luie);
295
+            throw new \DOMException(
296
+                sprintf(
297
+                    'XML Schema validation with "%s" failed due to the following error%s: ' . "\n\n%s", 
298
+                    $filename, 
299
+                    count($errors) > 1 ? 's' : '', 
300
+                    implode("\n", $errors)
301
+                )
302
+            );
303
+        }
304
+		
305
+        libxml_use_internal_errors($luie);
306
+		
307
+        return $result;
308
+    }
309 309
 	
310
-	/**
311
-	 * Validate a document based on a schema.
312
-	 *
313
-	 * @param      string $source A string containing the schema.
314
-	 *
315
-	 * @return     bool True if the validation is successful; false otherwise.
316
-	 *
317
-	 * @author     Noah Fontes <[email protected]>
318
-	 * @since      1.0.0
319
-	 */
320
-	public function schemaValidateSource($source)
321
-	{
322
-		$luie = libxml_use_internal_errors(true);
323
-		libxml_clear_errors();
324
-		
325
-		// gotta do the @ to suppress PHP warnings when the schema cannot be loaded or is invalid
326
-		if(!$result = @parent::schemaValidateSource($source)) {
327
-			$errors = array();
328
-			foreach(libxml_get_errors() as $error) {
329
-				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
330
-			}
331
-			libxml_clear_errors();
332
-			libxml_use_internal_errors($luie);
333
-			throw new \DOMException(
334
-				sprintf(
335
-					'XML Schema validation failed due to the following error%s: ' . "\n\n%s", 
336
-					count($errors) > 1 ? 's' : '', 
337
-					implode("\n", $errors)
338
-				)
339
-			);
340
-		}
341
-		
342
-		libxml_use_internal_errors($luie);
343
-		
344
-		return $result;
345
-	}
310
+    /**
311
+     * Validate a document based on a schema.
312
+     *
313
+     * @param      string $source A string containing the schema.
314
+     *
315
+     * @return     bool True if the validation is successful; false otherwise.
316
+     *
317
+     * @author     Noah Fontes <[email protected]>
318
+     * @since      1.0.0
319
+     */
320
+    public function schemaValidateSource($source)
321
+    {
322
+        $luie = libxml_use_internal_errors(true);
323
+        libxml_clear_errors();
324
+		
325
+        // gotta do the @ to suppress PHP warnings when the schema cannot be loaded or is invalid
326
+        if(!$result = @parent::schemaValidateSource($source)) {
327
+            $errors = array();
328
+            foreach(libxml_get_errors() as $error) {
329
+                $errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
330
+            }
331
+            libxml_clear_errors();
332
+            libxml_use_internal_errors($luie);
333
+            throw new \DOMException(
334
+                sprintf(
335
+                    'XML Schema validation failed due to the following error%s: ' . "\n\n%s", 
336
+                    count($errors) > 1 ? 's' : '', 
337
+                    implode("\n", $errors)
338
+                )
339
+            );
340
+        }
341
+		
342
+        libxml_use_internal_errors($luie);
343
+		
344
+        return $result;
345
+    }
346 346
 	
347
-	/**
348
-	 * Perform RELAX NG validation on the document.
349
-	 *
350
-	 * @param      string $filename The path to the schema.
351
-	 *
352
-	 * @return     bool True if the validation is successful; false otherwise.
353
-	 *
354
-	 * @author     Noah Fontes <[email protected]>
355
-	 * @since      1.0.0
356
-	 */
357
-	public function relaxNGValidate($filename)
358
-	{
359
-		$luie = libxml_use_internal_errors(true);
360
-		libxml_clear_errors();
361
-		
362
-		// gotta do the @ to suppress PHP warnings when the schema cannot be loaded or is invalid
363
-		if(!$result = @parent::relaxNGValidate($filename)) {
364
-			$errors = array();
365
-			foreach(libxml_get_errors() as $error) {
366
-				$errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
367
-			}
368
-			libxml_clear_errors();
369
-			libxml_use_internal_errors($luie);
370
-			throw new \DOMException(
371
-				sprintf(
372
-					'RELAX NG validation with "%s" failed due to the following error%s: ' . "\n\n%s",
373
-					$filename,
374
-					count($errors) > 1 ? 's' : '', 
375
-					implode("\n", $errors)
376
-				)
377
-			);
378
-		}
379
-		
380
-		libxml_use_internal_errors($luie);
381
-		
382
-		return $result;
383
-	}
347
+    /**
348
+     * Perform RELAX NG validation on the document.
349
+     *
350
+     * @param      string $filename The path to the schema.
351
+     *
352
+     * @return     bool True if the validation is successful; false otherwise.
353
+     *
354
+     * @author     Noah Fontes <[email protected]>
355
+     * @since      1.0.0
356
+     */
357
+    public function relaxNGValidate($filename)
358
+    {
359
+        $luie = libxml_use_internal_errors(true);
360
+        libxml_clear_errors();
361
+		
362
+        // gotta do the @ to suppress PHP warnings when the schema cannot be loaded or is invalid
363
+        if(!$result = @parent::relaxNGValidate($filename)) {
364
+            $errors = array();
365
+            foreach(libxml_get_errors() as $error) {
366
+                $errors[] = sprintf('[%s #%d] Line %d: %s', $error->level == LIBXML_ERR_WARNING ? 'Warning' : ($error->level == LIBXML_ERR_ERROR ? 'Error' : 'Fatal'), $error->code, $error->line, $error->message);
367
+            }
368
+            libxml_clear_errors();
369
+            libxml_use_internal_errors($luie);
370
+            throw new \DOMException(
371
+                sprintf(
372
+                    'RELAX NG validation with "%s" failed due to the following error%s: ' . "\n\n%s",
373
+                    $filename,
374
+                    count($errors) > 1 ? 's' : '', 
375
+                    implode("\n", $errors)
376
+                )
377
+            );
378
+        }
379
+		
380
+        libxml_use_internal_errors($luie);
381
+		
382
+        return $result;
383
+    }
384 384
 	
385
-	/**
386
-	 * Retrieve the DOMXPath instance that is associated with this document.
387
-	 *
388
-	 * @return     \DOMXPath The DOMXPath instance.
389
-	 *
390
-	 * @author     David Zülke <[email protected]>
391
-	 * @since      1.0.0
392
-	 */
393
-	public function getXpath()
394
-	{
395
-		return $this->xpath;
396
-	}
385
+    /**
386
+     * Retrieve the DOMXPath instance that is associated with this document.
387
+     *
388
+     * @return     \DOMXPath The DOMXPath instance.
389
+     *
390
+     * @author     David Zülke <[email protected]>
391
+     * @since      1.0.0
392
+     */
393
+    public function getXpath()
394
+    {
395
+        return $this->xpath;
396
+    }
397 397
 	
398
-	/**
399
-	 * Set a default namespace that should be used when accessing elements via
400
-	 * convenience methods (such as magic get overload for children), and bind it
401
-	 * to the given prefix for use in XPath expressions.
402
-	 *
403
-	 * @param      string $namespaceUri A namespace URI
404
-	 * @param      string $prefix       An optional prefix, defaulting to "_default"
405
-	 *
406
-	 * @author     David Zülke <[email protected]>
407
-	 * @since      1.0.0
408
-	 */
409
-	public function setDefaultNamespace($namespaceUri, $prefix = '_default')
410
-	{
411
-		$this->defaultNamespaceUri = $namespaceUri;
412
-		$this->defaultNamespacePrefix = $prefix;
413
-		
414
-		$this->xpath->registerNamespace($prefix, $namespaceUri);
415
-	}
398
+    /**
399
+     * Set a default namespace that should be used when accessing elements via
400
+     * convenience methods (such as magic get overload for children), and bind it
401
+     * to the given prefix for use in XPath expressions.
402
+     *
403
+     * @param      string $namespaceUri A namespace URI
404
+     * @param      string $prefix       An optional prefix, defaulting to "_default"
405
+     *
406
+     * @author     David Zülke <[email protected]>
407
+     * @since      1.0.0
408
+     */
409
+    public function setDefaultNamespace($namespaceUri, $prefix = '_default')
410
+    {
411
+        $this->defaultNamespaceUri = $namespaceUri;
412
+        $this->defaultNamespacePrefix = $prefix;
413
+		
414
+        $this->xpath->registerNamespace($prefix, $namespaceUri);
415
+    }
416 416
 	
417
-	/**
418
-	 * Retrieve the default namespace URI that will be used by node classes, if
419
-	 * set, to conveniently retrieve child elements etc in some methods.
420
-	 *
421
-	 * @return     string A namespace URI.
422
-	 *
423
-	 * @author     David Zülke <[email protected]>
424
-	 * @since      1.0.0
425
-	 */
426
-	public function getDefaultNamespaceUri()
427
-	{
428
-		return $this->defaultNamespaceUri;
429
-	}
417
+    /**
418
+     * Retrieve the default namespace URI that will be used by node classes, if
419
+     * set, to conveniently retrieve child elements etc in some methods.
420
+     *
421
+     * @return     string A namespace URI.
422
+     *
423
+     * @author     David Zülke <[email protected]>
424
+     * @since      1.0.0
425
+     */
426
+    public function getDefaultNamespaceUri()
427
+    {
428
+        return $this->defaultNamespaceUri;
429
+    }
430 430
 	
431
-	/**
432
-	 * Retrieve the default namespace prefix that will be used by node classes, if
433
-	 * set, to conveniently retrieve child elements etc via XPath. 
434
-	 *
435
-	 * @return     string A namespace prefix.
436
-	 *
437
-	 * @author     David Zülke <[email protected]>
438
-	 * @since      1.0.0
439
-	 */
440
-	public function getDefaultNamespacePrefix()
441
-	{
442
-		return $this->defaultNamespacePrefix;
443
-	}
431
+    /**
432
+     * Retrieve the default namespace prefix that will be used by node classes, if
433
+     * set, to conveniently retrieve child elements etc via XPath. 
434
+     *
435
+     * @return     string A namespace prefix.
436
+     *
437
+     * @author     David Zülke <[email protected]>
438
+     * @since      1.0.0
439
+     */
440
+    public function getDefaultNamespacePrefix()
441
+    {
442
+        return $this->defaultNamespacePrefix;
443
+    }
444 444
 	
445
-	/**
446
-	 * Check whether or not this is a standard Agavi configuration file, i.e. with
447
-	 * a <configurations> and <configuration> envelope.
448
-	 *
449
-	 * @return     bool true, if it is an Agavi config structure, false otherwise.
450
-	 *
451
-	 * @author     David Zülke <[email protected]>
452
-	 * @since      1.0.0
453
-	 */
454
-	public function isAgaviConfiguration()
455
-	{
456
-		return XmlConfigParser::isAgaviConfigurationDocument($this);
457
-	}
445
+    /**
446
+     * Check whether or not this is a standard Agavi configuration file, i.e. with
447
+     * a <configurations> and <configuration> envelope.
448
+     *
449
+     * @return     bool true, if it is an Agavi config structure, false otherwise.
450
+     *
451
+     * @author     David Zülke <[email protected]>
452
+     * @since      1.0.0
453
+     */
454
+    public function isAgaviConfiguration()
455
+    {
456
+        return XmlConfigParser::isAgaviConfigurationDocument($this);
457
+    }
458 458
 	
459
-	/**
460
-	 * Retrieve the namespace of the Agavi envelope.
461
-	 *
462
-	 * @return     string A namespace URI, or null if it's not an Agavi config.
463
-	 *
464
-	 * @author     David Zülke <[email protected]>
465
-	 * @since      1.0.0
466
-	 */
467
-	public function getAgaviEnvelopeNamespace()
468
-	{
469
-		if($this->isAgaviConfiguration()) {
470
-			return $this->documentElement->namespaceURI;
471
-		}
472
-	}
459
+    /**
460
+     * Retrieve the namespace of the Agavi envelope.
461
+     *
462
+     * @return     string A namespace URI, or null if it's not an Agavi config.
463
+     *
464
+     * @author     David Zülke <[email protected]>
465
+     * @since      1.0.0
466
+     */
467
+    public function getAgaviEnvelopeNamespace()
468
+    {
469
+        if($this->isAgaviConfiguration()) {
470
+            return $this->documentElement->namespaceURI;
471
+        }
472
+    }
473 473
 	
474
-	/**
475
-	 * Method to retrieve a list of Agavi <configuration> elements regardless of
476
-	 * their namespace.
477
-	 *
478
-	 * @return     XmlConfigDomElement[] A list of XmlConfigDomElement elements.
479
-	 *
480
-	 * @author     David Zülke <[email protected]>
481
-	 * @since      1.0.0
482
-	 */
483
-	public function getConfigurationElements()
484
-	{
485
-		$retval = array();
486
-		
487
-		if($this->isAgaviConfiguration()) {
488
-			$agaviNs = $this->getAgaviEnvelopeNamespace();
474
+    /**
475
+     * Method to retrieve a list of Agavi <configuration> elements regardless of
476
+     * their namespace.
477
+     *
478
+     * @return     XmlConfigDomElement[] A list of XmlConfigDomElement elements.
479
+     *
480
+     * @author     David Zülke <[email protected]>
481
+     * @since      1.0.0
482
+     */
483
+    public function getConfigurationElements()
484
+    {
485
+        $retval = array();
486
+		
487
+        if($this->isAgaviConfiguration()) {
488
+            $agaviNs = $this->getAgaviEnvelopeNamespace();
489 489
 			
490
-			foreach($this->documentElement->childNodes as $node) {
491
-				if($node->nodeType == XML_ELEMENT_NODE && $node->localName == 'configuration' && $node->namespaceURI == $agaviNs) {
492
-					$retval[] = $node;
493
-				}
494
-			}
495
-		}
496
-		
497
-		return $retval;
498
-	}
490
+            foreach($this->documentElement->childNodes as $node) {
491
+                if($node->nodeType == XML_ELEMENT_NODE && $node->localName == 'configuration' && $node->namespaceURI == $agaviNs) {
492
+                    $retval[] = $node;
493
+                }
494
+            }
495
+        }
496
+		
497
+        return $retval;
498
+    }
499 499
 	
500
-	/**
501
-	 * Method to retrieve the Agavi <sandbox> element regardless of the namespace.
502
-	 *
503
-	 * @return     XmlConfigDomElement The <sandbox> element, or null.
504
-	 *
505
-	 * @author     David Zülke <[email protected]>
506
-	 * @since      1.0.0
507
-	 */
508
-	public function getSandbox()
509
-	{
510
-		if($this->isAgaviConfiguration()) {
511
-			$agaviNs = $this->getAgaviEnvelopeNamespace();
500
+    /**
501
+     * Method to retrieve the Agavi <sandbox> element regardless of the namespace.
502
+     *
503
+     * @return     XmlConfigDomElement The <sandbox> element, or null.
504
+     *
505
+     * @author     David Zülke <[email protected]>
506
+     * @since      1.0.0
507
+     */
508
+    public function getSandbox()
509
+    {
510
+        if($this->isAgaviConfiguration()) {
511
+            $agaviNs = $this->getAgaviEnvelopeNamespace();
512 512
 			
513
-			foreach($this->documentElement->childNodes as $node) {
514
-				if($node->nodeType == XML_ELEMENT_NODE && $node->localName == 'sandbox' && $node->namespaceURI == $agaviNs) {
515
-					return $node;
516
-				}
517
-			}
518
-		}
519
-	}
513
+            foreach($this->documentElement->childNodes as $node) {
514
+                if($node->nodeType == XML_ELEMENT_NODE && $node->localName == 'sandbox' && $node->namespaceURI == $agaviNs) {
515
+                    return $node;
516
+                }
517
+            }
518
+        }
519
+    }
520 520
 }
521 521
 
522 522
 ?>
523 523
\ No newline at end of file
Please login to merge, or discard this patch.
src/config/util/dom/XmlConfigDomElement.class.php 3 patches
Doc Comments   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 *                                  namespace will be used. If an empty string, no namespace
181 181
 	 *                                  will be used.
182 182
 	 *
183
-	 * @return     XmlConfigDomElement[] A list of the child elements.
183
+	 * @return     \DOMNodeList A list of the child elements.
184 184
 	 *
185 185
 	 * @author     David Zülke <[email protected]>
186 186
 	 * @since      1.0.0
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 	 * @param      string $localName    An attribute name.
440 440
 	 * @param      mixed  $default      A default attribute value.
441 441
 	 *
442
-	 * @return     mixed An attribute value, if the attribute exists, otherwise
442
+	 * @return     string An attribute value, if the attribute exists, otherwise
443 443
 	 *                   null or the given default.
444 444
 	 *
445 445
 	 * @see        DOMElement::getAttributeNS()
@@ -474,6 +474,7 @@  discard block
 block discarded – undo
474 474
 	/**
475 475
 	 * Retrieve all attributes of the element that are in the given namespace.
476 476
 	 *
477
+	 * @param string $namespaceUri
477 478
 	 * @return     array An associative array of attribute names and values.
478 479
 	 *
479 480
 	 * @author     David Zülke <[email protected]>
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 		$preserveWhitespace = $this->getAttributeNS(XmlConfigParser::NAMESPACE_XML_1998, 'space') == 'preserve';
112 112
 		$literalize = Toolkit::literalize($this->getAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ENVELOPE_LATEST, 'literalize')) !== false;
113 113
 		
114
-		if($literalize) {
115
-			if($preserveWhitespace && ($trimmedValue === '' || $value != $trimmedValue)) {
114
+		if ($literalize) {
115
+			if ($preserveWhitespace && ($trimmedValue === '' || $value != $trimmedValue)) {
116 116
 				// we must preserve whitespace, and there is leading or trailing whitespace in the original value, so we won't run Toolkit::literalize(), which trims the input and then converts "true" to a boolean and so forth
117 117
 				// however, we should still expand possible occurrences of config directives
118 118
 				$value = Toolkit::expandDirectives($value);
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 				// no need to preserve whitespace, or no leading/trailing whitespace, which means we can expand "true", "false" and so forth using Toolkit::literalize()
121 121
 				$value = Toolkit::literalize($trimmedValue);
122 122
 			}
123
-		} elseif(!$preserveWhitespace) {
123
+		} elseif (!$preserveWhitespace) {
124 124
 			$value = $trimmedValue;
125
-			if($value === '') {
125
+			if ($value === '') {
126 126
 				// with or without literalize, an empty string must be converted to NULL if xml:space is default (see ticket #1203 and AEP-100)
127 127
 				$value = null;
128 128
 			}
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	{
144 144
 		// should only pull elements from the default ns
145 145
 		$prefix = $this->ownerDocument->getDefaultNamespacePrefix();
146
-		if($prefix) {
146
+		if ($prefix) {
147 147
 			return $this->ownerDocument->getXpath()->query(sprintf('child::%s:*', $prefix), $this);
148 148
 		} else {
149 149
 			return $this->ownerDocument->getXpath()->query('child::*', $this);
@@ -242,16 +242,16 @@  discard block
 block discarded – undo
242 242
 		$marker = uniqid('', true);
243 243
 		$this->setAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker', $marker);
244 244
 		
245
-		if($pluralMagic) {
245
+		if ($pluralMagic) {
246 246
 			// we always assume that we either get plural names, or the singular of the singular is not different from the singular :)
247 247
 			$singularName = $this->singularize($name);
248
-			if($namespaceUri) {
248
+			if ($namespaceUri) {
249 249
 				$query = 'count(child::*[local-name() = "%2$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"]) + count(child::*[local-name() = "%1$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"]/*[local-name() = "%2$s" and namespace-uri() = "%3$s" and ../../@agavi_annotations_latest:marker = "%4$s"])';
250 250
 			} else {
251 251
 				$query = 'count(%1$s[../@agavi_annotations_latest:marker = "%4$s"]/%2$s[../../@agavi_annotations_latest:marker = "%4$s"]) + count(%2$s[../@agavi_annotations_latest:marker = "%4$s"])';
252 252
 			}
253 253
 		} else {
254
-			if($namespaceUri) {
254
+			if ($namespaceUri) {
255 255
 				$query = 'count(child::*[local-name() = "%1$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"])';
256 256
 			} else {
257 257
 				$query = 'count(%1$s[../@agavi_annotations_latest:marker = "%4$s"])';
@@ -318,16 +318,16 @@  discard block
 block discarded – undo
318 318
 		$marker = uniqid('', true);
319 319
 		$this->setAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker', $marker);
320 320
 		
321
-		if($pluralMagic) {
321
+		if ($pluralMagic) {
322 322
 			// we always assume that we either get plural names, or the singular of the singular is not different from the singular :)
323 323
 			$singularName = $this->singularize($name);
324
-			if($namespaceUri) {
324
+			if ($namespaceUri) {
325 325
 				$query = 'child::*[local-name() = "%2$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"] | child::*[local-name() = "%1$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"]/*[local-name() = "%2$s" and namespace-uri() = "%3$s" and ../../@agavi_annotations_latest:marker = "%4$s"]';
326 326
 			} else {
327 327
 				$query = '%1$s[../@agavi_annotations_latest:marker = "%4$s"]/%2$s[../../@agavi_annotations_latest:marker = "%4$s"] | %2$s[../@agavi_annotations_latest:marker = "%4$s"]';
328 328
 			}
329 329
 		} else {
330
-			if($namespaceUri) {
330
+			if ($namespaceUri) {
331 331
 				$query = 'child::*[local-name() = "%1$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"]';
332 332
 			} else {
333 333
 				$query = '%1$s[../@agavi_annotations_latest:marker = "%4$s"]';
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 		$marker = uniqid('', true);
389 389
 		$this->setAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker', $marker);
390 390
 		
391
-		if($namespaceUri) {
391
+		if ($namespaceUri) {
392 392
 			$query = 'self::node()[count(child::*[local-name() = "%1$s" and namespace-uri() = "%2$s" and ../@agavi_annotations_latest:marker = "%3$s"]) = 1]/*[local-name() = "%1$s" and namespace-uri() = "%2$s" and ../@agavi_annotations_latest:marker = "%3$s"]';
393 393
 		} else {
394 394
 			$query = 'self::node()[count(child::%1$s[../@agavi_annotations_latest:marker = "%3$s"]) = 1]/%1$s[../@agavi_annotations_latest:marker = "%3$s"]';
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 		
424 424
 		// getAttribute returns '' when the attribute doesn't exist, but any
425 425
 		// null-ish value is probably unacceptable anyway
426
-		if($retval == null) {
426
+		if ($retval == null) {
427 427
 			$retval = $default;
428 428
 		}
429 429
 		
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	{
452 452
 		$retval = parent::getAttributeNS($namespaceUri, $localName);
453 453
 		
454
-		if($retval === null) {
454
+		if ($retval === null) {
455 455
 			$retval = $default;
456 456
 		}
457 457
 		
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 	{
484 484
 		$retval = array();
485 485
 		
486
-		foreach($this->ownerDocument->getXpath()->query(sprintf('@*[namespace-uri() = "%s"]', $namespaceUri), $this) as $attribute) {
486
+		foreach ($this->ownerDocument->getXpath()->query(sprintf('@*[namespace-uri() = "%s"]', $namespaceUri), $this) as $attribute) {
487 487
 			$retval[$attribute->localName] = $attribute->nodeValue;
488 488
 		}
489 489
 		
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 	 */
501 501
 	public function hasAgaviParameters()
502 502
 	{
503
-		if($this->ownerDocument->isAgaviConfiguration()) {
503
+		if ($this->ownerDocument->isAgaviConfiguration()) {
504 504
 			return $this->has('parameters', XmlConfigParser::NAMESPACE_AGAVI_ENVELOPE_LATEST);
505 505
 		}
506 506
 		
@@ -524,19 +524,19 @@  discard block
 block discarded – undo
524 524
 		$result = $existing;
525 525
 		$offset = 0;
526 526
 		
527
-		if($this->ownerDocument->isAgaviConfiguration()) {
527
+		if ($this->ownerDocument->isAgaviConfiguration()) {
528 528
 			$elements = $this->get('parameters', XmlConfigParser::NAMESPACE_AGAVI_ENVELOPE_LATEST);
529 529
 
530 530
 			/** @var XmlConfigDomElement $element */
531
-			foreach($elements as $element) {
531
+			foreach ($elements as $element) {
532 532
 				$key = null;
533
-				if(!$element->hasAttribute('name')) {
533
+				if (!$element->hasAttribute('name')) {
534 534
 					$result[$key = $offset++] = null;
535 535
 				} else {
536 536
 					$key = $element->getAttribute('name');
537 537
 				}
538 538
 				
539
-				if($element->hasAgaviParameters()) {
539
+				if ($element->hasAgaviParameters()) {
540 540
 					$result[$key] = isset($result[$key]) && is_array($result[$key]) ? $result[$key] : array();
541 541
 					$result[$key] = $element->getAgaviParameters($result[$key]);
542 542
 				} else {
Please login to merge, or discard this patch.
Indentation   +463 added lines, -463 removed lines patch added patch discarded remove patch
@@ -36,517 +36,517 @@
 block discarded – undo
36 36
 class XmlConfigDomElement extends \DOMElement implements \IteratorAggregate
37 37
 {
38 38
 
39
-	/**
40
-	 * __toString() magic method, returns the element value.
41
-	 *
42
-	 * @see        AgaviXmlConfigDomElement::getValue()
43
-	 *
44
-	 * @return     string The element value.
45
-	 *
46
-	 * @author     David Zülke <[email protected]>
47
-	 * @since      1.0.0
48
-	 */
49
-	public function __toString()
50
-	{
51
-		return $this->getValue();
52
-	}
39
+    /**
40
+     * __toString() magic method, returns the element value.
41
+     *
42
+     * @see        AgaviXmlConfigDomElement::getValue()
43
+     *
44
+     * @return     string The element value.
45
+     *
46
+     * @author     David Zülke <[email protected]>
47
+     * @since      1.0.0
48
+     */
49
+    public function __toString()
50
+    {
51
+        return $this->getValue();
52
+    }
53 53
 	
54
-	/**
55
-	 * Returns the element name.
56
-	 *
57
-	 * @return     string The element name.
58
-	 *
59
-	 * @author     David Zülke <[email protected]>
60
-	 * @since      1.0.0
61
-	 */
62
-	public function getName()
63
-	{
64
-		// what to return here? name with prefix? no.
65
-		// but... element name, or with ns prefix?
66
-		return $this->nodeName;
67
-	}
54
+    /**
55
+     * Returns the element name.
56
+     *
57
+     * @return     string The element name.
58
+     *
59
+     * @author     David Zülke <[email protected]>
60
+     * @since      1.0.0
61
+     */
62
+    public function getName()
63
+    {
64
+        // what to return here? name with prefix? no.
65
+        // but... element name, or with ns prefix?
66
+        return $this->nodeName;
67
+    }
68 68
 	
69
-	/**
70
-	 * Returns the element value.
71
-	 *
72
-	 * @return     string The element value.
73
-	 *
74
-	 * @author     David Zülke <[email protected]>
75
-	 * @since      1.0.0
76
-	 */
77
-	public function getValue()
78
-	{
79
-		// TODO: or textContent?
80
-		// trimmed or not? in utf-8 or native encoding?
81
-		// I'd really say we only support utf-8 for the new api
82
-		return $this->nodeValue;
83
-	}
69
+    /**
70
+     * Returns the element value.
71
+     *
72
+     * @return     string The element value.
73
+     *
74
+     * @author     David Zülke <[email protected]>
75
+     * @since      1.0.0
76
+     */
77
+    public function getValue()
78
+    {
79
+        // TODO: or textContent?
80
+        // trimmed or not? in utf-8 or native encoding?
81
+        // I'd really say we only support utf-8 for the new api
82
+        return $this->nodeValue;
83
+    }
84 84
 	
85
-	/**
86
-	 * Returns the literal value. By default, that means whitespace is trimmed,
87
-	 * boolean literals ("on", "yes", "true", "no", "off", "false") are converted
88
-	 * and configuration directives ("%core.app_dir%") are expanded.
89
-	 *
90
-	 * Takes attributes {http://www.w3.org/XML/1998/namespace}space and
91
-	 * {http://agavi.org/agavi/config/global/envelope/1.1}literalize into account
92
-	 * when computing the literal value. This way, users can control the trimming
93
-	 * and the literalization of values.
94
-	 * 
95
-	 * AEP-100 has a list of all the conversion rules that apply.
96
-	 *
97
-	 * @return     mixed The element content converted according to the rules
98
-	 *                   defined in AEP-100.
99
-	 *
100
-	 * @author     David Zülke <[email protected]>
101
-	 * @since      1.1.0
102
-	 */
103
-	public function getLiteralValue()
104
-	{
105
-		$value = $this->getValue();
106
-		// XML specifies [\x9\xA\xD\x20] as whitespace
107
-		// trim strips more than that
108
-		// no problem though, because these other chars aren't legal in XML
109
-		$trimmedValue = trim($value);
85
+    /**
86
+     * Returns the literal value. By default, that means whitespace is trimmed,
87
+     * boolean literals ("on", "yes", "true", "no", "off", "false") are converted
88
+     * and configuration directives ("%core.app_dir%") are expanded.
89
+     *
90
+     * Takes attributes {http://www.w3.org/XML/1998/namespace}space and
91
+     * {http://agavi.org/agavi/config/global/envelope/1.1}literalize into account
92
+     * when computing the literal value. This way, users can control the trimming
93
+     * and the literalization of values.
94
+     * 
95
+     * AEP-100 has a list of all the conversion rules that apply.
96
+     *
97
+     * @return     mixed The element content converted according to the rules
98
+     *                   defined in AEP-100.
99
+     *
100
+     * @author     David Zülke <[email protected]>
101
+     * @since      1.1.0
102
+     */
103
+    public function getLiteralValue()
104
+    {
105
+        $value = $this->getValue();
106
+        // XML specifies [\x9\xA\xD\x20] as whitespace
107
+        // trim strips more than that
108
+        // no problem though, because these other chars aren't legal in XML
109
+        $trimmedValue = trim($value);
110 110
 		
111
-		$preserveWhitespace = $this->getAttributeNS(XmlConfigParser::NAMESPACE_XML_1998, 'space') == 'preserve';
112
-		$literalize = Toolkit::literalize($this->getAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ENVELOPE_LATEST, 'literalize')) !== false;
111
+        $preserveWhitespace = $this->getAttributeNS(XmlConfigParser::NAMESPACE_XML_1998, 'space') == 'preserve';
112
+        $literalize = Toolkit::literalize($this->getAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ENVELOPE_LATEST, 'literalize')) !== false;
113 113
 		
114
-		if($literalize) {
115
-			if($preserveWhitespace && ($trimmedValue === '' || $value != $trimmedValue)) {
116
-				// we must preserve whitespace, and there is leading or trailing whitespace in the original value, so we won't run Toolkit::literalize(), which trims the input and then converts "true" to a boolean and so forth
117
-				// however, we should still expand possible occurrences of config directives
118
-				$value = Toolkit::expandDirectives($value);
119
-			} else {
120
-				// no need to preserve whitespace, or no leading/trailing whitespace, which means we can expand "true", "false" and so forth using Toolkit::literalize()
121
-				$value = Toolkit::literalize($trimmedValue);
122
-			}
123
-		} elseif(!$preserveWhitespace) {
124
-			$value = $trimmedValue;
125
-			if($value === '') {
126
-				// with or without literalize, an empty string must be converted to NULL if xml:space is default (see ticket #1203 and AEP-100)
127
-				$value = null;
128
-			}
129
-		}
114
+        if($literalize) {
115
+            if($preserveWhitespace && ($trimmedValue === '' || $value != $trimmedValue)) {
116
+                // we must preserve whitespace, and there is leading or trailing whitespace in the original value, so we won't run Toolkit::literalize(), which trims the input and then converts "true" to a boolean and so forth
117
+                // however, we should still expand possible occurrences of config directives
118
+                $value = Toolkit::expandDirectives($value);
119
+            } else {
120
+                // no need to preserve whitespace, or no leading/trailing whitespace, which means we can expand "true", "false" and so forth using Toolkit::literalize()
121
+                $value = Toolkit::literalize($trimmedValue);
122
+            }
123
+        } elseif(!$preserveWhitespace) {
124
+            $value = $trimmedValue;
125
+            if($value === '') {
126
+                // with or without literalize, an empty string must be converted to NULL if xml:space is default (see ticket #1203 and AEP-100)
127
+                $value = null;
128
+            }
129
+        }
130 130
 		
131
-		return $value;
132
-	}
131
+        return $value;
132
+    }
133 133
 	
134
-	/**
135
-	 * Returns an iterator for the child nodes.
136
-	 *
137
-	 * @return     \Iterator An iterator.
138
-	 *
139
-	 * @author     David Zülke <[email protected]>
140
-	 * @since      1.0.0
141
-	 */
142
-	public function getIterator()
143
-	{
144
-		// should only pull elements from the default ns
145
-		$prefix = $this->ownerDocument->getDefaultNamespacePrefix();
146
-		if($prefix) {
147
-			return $this->ownerDocument->getXpath()->query(sprintf('child::%s:*', $prefix), $this);
148
-		} else {
149
-			return $this->ownerDocument->getXpath()->query('child::*', $this);
150
-		}
151
-	}
134
+    /**
135
+     * Returns an iterator for the child nodes.
136
+     *
137
+     * @return     \Iterator An iterator.
138
+     *
139
+     * @author     David Zülke <[email protected]>
140
+     * @since      1.0.0
141
+     */
142
+    public function getIterator()
143
+    {
144
+        // should only pull elements from the default ns
145
+        $prefix = $this->ownerDocument->getDefaultNamespacePrefix();
146
+        if($prefix) {
147
+            return $this->ownerDocument->getXpath()->query(sprintf('child::%s:*', $prefix), $this);
148
+        } else {
149
+            return $this->ownerDocument->getXpath()->query('child::*', $this);
150
+        }
151
+    }
152 152
 	
153
-	/**
154
-	 * Retrieve singular form of given element name.
155
-	 * This does special splitting only of the last part of the name if the name
156
-	 * of the element contains hyphens, underscores or dots.
157
-	 *
158
-	 * @param      string $name The element name to singularize.
159
-	 *
160
-	 * @return     string The singularized element name.
161
-	 *
162
-	 * @author     Noah Fontes <[email protected]>
163
-	 * @since      1.0.0
164
-	 */
165
-	protected function singularize($name)
166
-	{
167
-		// TODO: shouldn't this be static?
168
-		$names = preg_split('#([_\-\.])#', $name, -1, PREG_SPLIT_DELIM_CAPTURE);
169
-		$names[count($names) - 1] = Inflector::singularize(end($names));
170
-		return implode('', $names);
171
-	}
153
+    /**
154
+     * Retrieve singular form of given element name.
155
+     * This does special splitting only of the last part of the name if the name
156
+     * of the element contains hyphens, underscores or dots.
157
+     *
158
+     * @param      string $name The element name to singularize.
159
+     *
160
+     * @return     string The singularized element name.
161
+     *
162
+     * @author     Noah Fontes <[email protected]>
163
+     * @since      1.0.0
164
+     */
165
+    protected function singularize($name)
166
+    {
167
+        // TODO: shouldn't this be static?
168
+        $names = preg_split('#([_\-\.])#', $name, -1, PREG_SPLIT_DELIM_CAPTURE);
169
+        $names[count($names) - 1] = Inflector::singularize(end($names));
170
+        return implode('', $names);
171
+    }
172 172
 	
173
-	/**
174
-	 * Convenience method to retrieve child elements of the given name.
175
-	 * Accepts singular or plural forms of the name, and will detect and handle
176
-	 * parent containers with plural names properly.
177
-	 *
178
-	 * @param      string $name         The name of the element(s) to check for.
179
-	 * @param      string $namespaceUri The namespace URI. If null, the document default
180
-	 *                                  namespace will be used. If an empty string, no namespace
181
-	 *                                  will be used.
182
-	 *
183
-	 * @return     XmlConfigDomElement[] A list of the child elements.
184
-	 *
185
-	 * @author     David Zülke <[email protected]>
186
-	 * @since      1.0.0
187
-	 */
188
-	public function get($name, $namespaceUri = null)
189
-	{
190
-		return $this->getChildren($name, $namespaceUri, true);
191
-	}
173
+    /**
174
+     * Convenience method to retrieve child elements of the given name.
175
+     * Accepts singular or plural forms of the name, and will detect and handle
176
+     * parent containers with plural names properly.
177
+     *
178
+     * @param      string $name         The name of the element(s) to check for.
179
+     * @param      string $namespaceUri The namespace URI. If null, the document default
180
+     *                                  namespace will be used. If an empty string, no namespace
181
+     *                                  will be used.
182
+     *
183
+     * @return     XmlConfigDomElement[] A list of the child elements.
184
+     *
185
+     * @author     David Zülke <[email protected]>
186
+     * @since      1.0.0
187
+     */
188
+    public function get($name, $namespaceUri = null)
189
+    {
190
+        return $this->getChildren($name, $namespaceUri, true);
191
+    }
192 192
 	
193
-	/**
194
-	 * Convenience method to check if there are child elements of the given name.
195
-	 * Accepts singular or plural forms of the name, and will detect and handle
196
-	 * parent containers with plural names properly.
197
-	 *
198
-	 * @param      string $name         The name of the element(s) to check for.
199
-	 * @param      string $namespaceUri The namespace URI. If null, the document default
200
-	 *                                  namespace will be used. If an empty string, no namespace
201
-	 *                                  will be used.
202
-	 *
203
-	 * @return     bool True if one or more child elements with the given name
204
-	 *                  exist, false otherwise.
205
-	 *
206
-	 * @author     David Zülke <[email protected]>
207
-	 * @since      1.0.0
208
-	 */
209
-	public function has($name, $namespaceUri = null)
210
-	{
211
-		return $this->hasChildren($name, $namespaceUri, true);
212
-	}
193
+    /**
194
+     * Convenience method to check if there are child elements of the given name.
195
+     * Accepts singular or plural forms of the name, and will detect and handle
196
+     * parent containers with plural names properly.
197
+     *
198
+     * @param      string $name         The name of the element(s) to check for.
199
+     * @param      string $namespaceUri The namespace URI. If null, the document default
200
+     *                                  namespace will be used. If an empty string, no namespace
201
+     *                                  will be used.
202
+     *
203
+     * @return     bool True if one or more child elements with the given name
204
+     *                  exist, false otherwise.
205
+     *
206
+     * @author     David Zülke <[email protected]>
207
+     * @since      1.0.0
208
+     */
209
+    public function has($name, $namespaceUri = null)
210
+    {
211
+        return $this->hasChildren($name, $namespaceUri, true);
212
+    }
213 213
 	
214
-	/**
215
-	 * Count the number of child elements with a given name.
216
-	 *
217
-	 * @param      string $name         The name of the element.
218
-	 * @param      string $namespaceUri The namespace URI. If null, the document default
219
-	 *                                  namespace will be used. If an empty string, no namespace
220
-	 *                                  will be used.
221
-	 * @param      bool   $pluralMagic  Whether or not to apply automatic singular/plural
222
-	 *                                  handling that skips plural container elements.
223
-	 *
224
-	 * @return     int The number of child elements with the given name.
225
-	 *
226
-	 * @author     Noah Fontes <[email protected]>
227
-	 * @author     David Zülke <[email protected]>
228
-	 * @since      1.0.0
229
-	 */
230
-	public function countChildren($name, $namespaceUri = null, $pluralMagic = false)
231
-	{
232
-		// if arg is null, then only check for elements from our default namespace
233
-		// if namespace uri is null, use default ns. if empty string, use no ns
234
-		$namespaceUri = ($namespaceUri === null ? $this->ownerDocument->getDefaultNamespaceUri() : $namespaceUri);
214
+    /**
215
+     * Count the number of child elements with a given name.
216
+     *
217
+     * @param      string $name         The name of the element.
218
+     * @param      string $namespaceUri The namespace URI. If null, the document default
219
+     *                                  namespace will be used. If an empty string, no namespace
220
+     *                                  will be used.
221
+     * @param      bool   $pluralMagic  Whether or not to apply automatic singular/plural
222
+     *                                  handling that skips plural container elements.
223
+     *
224
+     * @return     int The number of child elements with the given name.
225
+     *
226
+     * @author     Noah Fontes <[email protected]>
227
+     * @author     David Zülke <[email protected]>
228
+     * @since      1.0.0
229
+     */
230
+    public function countChildren($name, $namespaceUri = null, $pluralMagic = false)
231
+    {
232
+        // if arg is null, then only check for elements from our default namespace
233
+        // if namespace uri is null, use default ns. if empty string, use no ns
234
+        $namespaceUri = ($namespaceUri === null ? $this->ownerDocument->getDefaultNamespaceUri() : $namespaceUri);
235 235
 		
236
-		// init our vars
237
-		$query = '';
238
-		$singularName = null;
236
+        // init our vars
237
+        $query = '';
238
+        $singularName = null;
239 239
 		
240
-		// tag our element, because older libxmls will mess things up otherwise
241
-		// http://trac.agavi.org/ticket/1039
242
-		$marker = uniqid('', true);
243
-		$this->setAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker', $marker);
240
+        // tag our element, because older libxmls will mess things up otherwise
241
+        // http://trac.agavi.org/ticket/1039
242
+        $marker = uniqid('', true);
243
+        $this->setAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker', $marker);
244 244
 		
245
-		if($pluralMagic) {
246
-			// we always assume that we either get plural names, or the singular of the singular is not different from the singular :)
247
-			$singularName = $this->singularize($name);
248
-			if($namespaceUri) {
249
-				$query = 'count(child::*[local-name() = "%2$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"]) + count(child::*[local-name() = "%1$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"]/*[local-name() = "%2$s" and namespace-uri() = "%3$s" and ../../@agavi_annotations_latest:marker = "%4$s"])';
250
-			} else {
251
-				$query = 'count(%1$s[../@agavi_annotations_latest:marker = "%4$s"]/%2$s[../../@agavi_annotations_latest:marker = "%4$s"]) + count(%2$s[../@agavi_annotations_latest:marker = "%4$s"])';
252
-			}
253
-		} else {
254
-			if($namespaceUri) {
255
-				$query = 'count(child::*[local-name() = "%1$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"])';
256
-			} else {
257
-				$query = 'count(%1$s[../@agavi_annotations_latest:marker = "%4$s"])';
258
-			}
259
-		}
245
+        if($pluralMagic) {
246
+            // we always assume that we either get plural names, or the singular of the singular is not different from the singular :)
247
+            $singularName = $this->singularize($name);
248
+            if($namespaceUri) {
249
+                $query = 'count(child::*[local-name() = "%2$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"]) + count(child::*[local-name() = "%1$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"]/*[local-name() = "%2$s" and namespace-uri() = "%3$s" and ../../@agavi_annotations_latest:marker = "%4$s"])';
250
+            } else {
251
+                $query = 'count(%1$s[../@agavi_annotations_latest:marker = "%4$s"]/%2$s[../../@agavi_annotations_latest:marker = "%4$s"]) + count(%2$s[../@agavi_annotations_latest:marker = "%4$s"])';
252
+            }
253
+        } else {
254
+            if($namespaceUri) {
255
+                $query = 'count(child::*[local-name() = "%1$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"])';
256
+            } else {
257
+                $query = 'count(%1$s[../@agavi_annotations_latest:marker = "%4$s"])';
258
+            }
259
+        }
260 260
 		
261
-		$retval = (int)$this->ownerDocument->getXpath()->evaluate(sprintf($query, $name, $singularName, $namespaceUri, $marker), $this);
261
+        $retval = (int)$this->ownerDocument->getXpath()->evaluate(sprintf($query, $name, $singularName, $namespaceUri, $marker), $this);
262 262
 		
263
-		$this->removeAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker');
263
+        $this->removeAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker');
264 264
 		
265
-		return $retval;
266
-	}
265
+        return $retval;
266
+    }
267 267
 	
268
-	/**
269
-	 * Determine whether there is at least one instance of a child element with a
270
-	 * given name.
271
-	 *
272
-	 * @param      string $name         The name of the element.
273
-	 * @param      string $namespaceUri The namespace URI. If null, the document default
274
-	 *                                  namespace will be used. If an empty string, no namespace
275
-	 *                                  will be used.
276
-	 * @param      bool   $pluralMagic  Whether or not to apply automatic singular/plural
277
-	 *                                  handling that skips plural container elements.
278
-	 *
279
-	 * @return     bool True if one or more child elements with the given name
280
-	 *                  exist, false otherwise.
281
-	 *
282
-	 * @author     Noah Fontes <[email protected]>
283
-	 * @author     David Zülke <[email protected]>
284
-	 * @since      1.0.0
285
-	 */
286
-	public function hasChildren($name, $namespaceUri = null, $pluralMagic = false)
287
-	{
288
-		return $this->countChildren($name, $namespaceUri, $pluralMagic) !== 0;
289
-	}
268
+    /**
269
+     * Determine whether there is at least one instance of a child element with a
270
+     * given name.
271
+     *
272
+     * @param      string $name         The name of the element.
273
+     * @param      string $namespaceUri The namespace URI. If null, the document default
274
+     *                                  namespace will be used. If an empty string, no namespace
275
+     *                                  will be used.
276
+     * @param      bool   $pluralMagic  Whether or not to apply automatic singular/plural
277
+     *                                  handling that skips plural container elements.
278
+     *
279
+     * @return     bool True if one or more child elements with the given name
280
+     *                  exist, false otherwise.
281
+     *
282
+     * @author     Noah Fontes <[email protected]>
283
+     * @author     David Zülke <[email protected]>
284
+     * @since      1.0.0
285
+     */
286
+    public function hasChildren($name, $namespaceUri = null, $pluralMagic = false)
287
+    {
288
+        return $this->countChildren($name, $namespaceUri, $pluralMagic) !== 0;
289
+    }
290 290
 	
291
-	/**
292
-	 * Retrieve all children with the given element name.
293
-	 *
294
-	 * @param      string $name         The name of the element.
295
-	 * @param      string $namespaceUri The namespace URI. If null, the document default
296
-	 *                                  namespace will be used. If an empty string, no namespace
297
-	 *                                  will be used.
298
-	 * @param      bool   $pluralMagic  Whether or not to apply automatic singular/plural
299
-	 *                                  handling that skips plural container elements.
300
-	 *
301
-	 * @return     \DOMNodeList A list of the child elements.
302
-	 *
303
-	 * @author     Noah Fontes <[email protected]>
304
-	 * @author     David Zülke <[email protected]>
305
-	 * @since      1.0.0
306
-	 */
307
-	public function getChildren($name, $namespaceUri = null, $pluralMagic = false)
308
-	{
309
-		// if arg is null, then only check for elements from our default namespace
310
-		// if namespace uri is null, use default ns. if empty string, use no ns
311
-		$namespaceUri = ($namespaceUri === null ? $this->ownerDocument->getDefaultNamespaceUri() : $namespaceUri);
291
+    /**
292
+     * Retrieve all children with the given element name.
293
+     *
294
+     * @param      string $name         The name of the element.
295
+     * @param      string $namespaceUri The namespace URI. If null, the document default
296
+     *                                  namespace will be used. If an empty string, no namespace
297
+     *                                  will be used.
298
+     * @param      bool   $pluralMagic  Whether or not to apply automatic singular/plural
299
+     *                                  handling that skips plural container elements.
300
+     *
301
+     * @return     \DOMNodeList A list of the child elements.
302
+     *
303
+     * @author     Noah Fontes <[email protected]>
304
+     * @author     David Zülke <[email protected]>
305
+     * @since      1.0.0
306
+     */
307
+    public function getChildren($name, $namespaceUri = null, $pluralMagic = false)
308
+    {
309
+        // if arg is null, then only check for elements from our default namespace
310
+        // if namespace uri is null, use default ns. if empty string, use no ns
311
+        $namespaceUri = ($namespaceUri === null ? $this->ownerDocument->getDefaultNamespaceUri() : $namespaceUri);
312 312
 		
313
-		// init our vars
314
-		$query = '';
315
-		$singularName = null;
313
+        // init our vars
314
+        $query = '';
315
+        $singularName = null;
316 316
 		
317
-		// tag our element, because libxml will mess things up otherwise
318
-		$marker = uniqid('', true);
319
-		$this->setAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker', $marker);
317
+        // tag our element, because libxml will mess things up otherwise
318
+        $marker = uniqid('', true);
319
+        $this->setAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker', $marker);
320 320
 		
321
-		if($pluralMagic) {
322
-			// we always assume that we either get plural names, or the singular of the singular is not different from the singular :)
323
-			$singularName = $this->singularize($name);
324
-			if($namespaceUri) {
325
-				$query = 'child::*[local-name() = "%2$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"] | child::*[local-name() = "%1$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"]/*[local-name() = "%2$s" and namespace-uri() = "%3$s" and ../../@agavi_annotations_latest:marker = "%4$s"]';
326
-			} else {
327
-				$query = '%1$s[../@agavi_annotations_latest:marker = "%4$s"]/%2$s[../../@agavi_annotations_latest:marker = "%4$s"] | %2$s[../@agavi_annotations_latest:marker = "%4$s"]';
328
-			}
329
-		} else {
330
-			if($namespaceUri) {
331
-				$query = 'child::*[local-name() = "%1$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"]';
332
-			} else {
333
-				$query = '%1$s[../@agavi_annotations_latest:marker = "%4$s"]';
334
-			}
335
-		}
336
-		/** @var \DOMXPath $xpath */
337
-		$xpath = $this->ownerDocument->getXpath();
338
-		$retval = $xpath->query(sprintf($query, $name, $singularName, $namespaceUri, $marker), $this);
321
+        if($pluralMagic) {
322
+            // we always assume that we either get plural names, or the singular of the singular is not different from the singular :)
323
+            $singularName = $this->singularize($name);
324
+            if($namespaceUri) {
325
+                $query = 'child::*[local-name() = "%2$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"] | child::*[local-name() = "%1$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"]/*[local-name() = "%2$s" and namespace-uri() = "%3$s" and ../../@agavi_annotations_latest:marker = "%4$s"]';
326
+            } else {
327
+                $query = '%1$s[../@agavi_annotations_latest:marker = "%4$s"]/%2$s[../../@agavi_annotations_latest:marker = "%4$s"] | %2$s[../@agavi_annotations_latest:marker = "%4$s"]';
328
+            }
329
+        } else {
330
+            if($namespaceUri) {
331
+                $query = 'child::*[local-name() = "%1$s" and namespace-uri() = "%3$s" and ../@agavi_annotations_latest:marker = "%4$s"]';
332
+            } else {
333
+                $query = '%1$s[../@agavi_annotations_latest:marker = "%4$s"]';
334
+            }
335
+        }
336
+        /** @var \DOMXPath $xpath */
337
+        $xpath = $this->ownerDocument->getXpath();
338
+        $retval = $xpath->query(sprintf($query, $name, $singularName, $namespaceUri, $marker), $this);
339 339
 		
340
-		$this->removeAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker');
340
+        $this->removeAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker');
341 341
 		
342
-		return $retval;
343
-	}
342
+        return $retval;
343
+    }
344 344
 	
345
-	/**
346
-	 * Determine whether this element has a particular child element. This method
347
-	 * succeeds only when there is exactly one child element with the given name.
348
-	 *
349
-	 * @param      string $name         The name of the element.
350
-	 * @param      string $namespaceUri The namespace URI. If null, the document default
351
-	 *                                  namespace will be used. If an empty string, no namespace
352
-	 *                                  will be used.
353
-	 *
354
-	 * @return     bool True if there is exactly one instance of an element with
355
-	 *                  the given name; false otherwise.
356
-	 *
357
-	 * @author     Noah Fontes <[email protected]>
358
-	 * @author     David Zülke <[email protected]>
359
-	 * @since      1.0.0
360
-	 */
361
-	public function hasChild($name, $namespaceUri = null)
362
-	{
363
-		return $this->getChild($name, $namespaceUri) !== null;
364
-	}
345
+    /**
346
+     * Determine whether this element has a particular child element. This method
347
+     * succeeds only when there is exactly one child element with the given name.
348
+     *
349
+     * @param      string $name         The name of the element.
350
+     * @param      string $namespaceUri The namespace URI. If null, the document default
351
+     *                                  namespace will be used. If an empty string, no namespace
352
+     *                                  will be used.
353
+     *
354
+     * @return     bool True if there is exactly one instance of an element with
355
+     *                  the given name; false otherwise.
356
+     *
357
+     * @author     Noah Fontes <[email protected]>
358
+     * @author     David Zülke <[email protected]>
359
+     * @since      1.0.0
360
+     */
361
+    public function hasChild($name, $namespaceUri = null)
362
+    {
363
+        return $this->getChild($name, $namespaceUri) !== null;
364
+    }
365 365
 	
366
-	/**
367
-	 * Return a single child element with a given name.
368
-	 * Only returns anything if there is exactly one child of this name.
369
-	 *
370
-	 * @param      string $name         The name of the element.
371
-	 * @param      string $namespaceUri The namespace URI. If null, the document default
372
-	 *                                  namespace will be used. If an empty string, no namespace
373
-	 *                                  will be used.
374
-	 *
375
-	 * @return     \DOMElement The child element, or null if none exists.
376
-	 *
377
-	 * @author     Noah Fontes <[email protected]>
378
-	 * @author     David Zülke <[email protected]>
379
-	 * @since      1.0.0
380
-	 */
381
-	public function getChild($name, $namespaceUri = null)
382
-	{
383
-		// if arg is null, then only check for elements from our default namespace
384
-		// if namespace uri is null, use default ns. if empty string, use no ns
385
-		$namespaceUri = ($namespaceUri === null ? $this->ownerDocument->getDefaultNamespaceUri() : $namespaceUri);
366
+    /**
367
+     * Return a single child element with a given name.
368
+     * Only returns anything if there is exactly one child of this name.
369
+     *
370
+     * @param      string $name         The name of the element.
371
+     * @param      string $namespaceUri The namespace URI. If null, the document default
372
+     *                                  namespace will be used. If an empty string, no namespace
373
+     *                                  will be used.
374
+     *
375
+     * @return     \DOMElement The child element, or null if none exists.
376
+     *
377
+     * @author     Noah Fontes <[email protected]>
378
+     * @author     David Zülke <[email protected]>
379
+     * @since      1.0.0
380
+     */
381
+    public function getChild($name, $namespaceUri = null)
382
+    {
383
+        // if arg is null, then only check for elements from our default namespace
384
+        // if namespace uri is null, use default ns. if empty string, use no ns
385
+        $namespaceUri = ($namespaceUri === null ? $this->ownerDocument->getDefaultNamespaceUri() : $namespaceUri);
386 386
 		
387
-		// tag our element, because libxml will mess things up otherwise
388
-		$marker = uniqid('', true);
389
-		$this->setAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker', $marker);
387
+        // tag our element, because libxml will mess things up otherwise
388
+        $marker = uniqid('', true);
389
+        $this->setAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker', $marker);
390 390
 		
391
-		if($namespaceUri) {
392
-			$query = 'self::node()[count(child::*[local-name() = "%1$s" and namespace-uri() = "%2$s" and ../@agavi_annotations_latest:marker = "%3$s"]) = 1]/*[local-name() = "%1$s" and namespace-uri() = "%2$s" and ../@agavi_annotations_latest:marker = "%3$s"]';
393
-		} else {
394
-			$query = 'self::node()[count(child::%1$s[../@agavi_annotations_latest:marker = "%3$s"]) = 1]/%1$s[../@agavi_annotations_latest:marker = "%3$s"]';
395
-		}
391
+        if($namespaceUri) {
392
+            $query = 'self::node()[count(child::*[local-name() = "%1$s" and namespace-uri() = "%2$s" and ../@agavi_annotations_latest:marker = "%3$s"]) = 1]/*[local-name() = "%1$s" and namespace-uri() = "%2$s" and ../@agavi_annotations_latest:marker = "%3$s"]';
393
+        } else {
394
+            $query = 'self::node()[count(child::%1$s[../@agavi_annotations_latest:marker = "%3$s"]) = 1]/%1$s[../@agavi_annotations_latest:marker = "%3$s"]';
395
+        }
396 396
 		
397
-		$retval = $this->ownerDocument->getXpath()->query(sprintf($query, $name, $namespaceUri, $marker), $this)->item(0);
397
+        $retval = $this->ownerDocument->getXpath()->query(sprintf($query, $name, $namespaceUri, $marker), $this)->item(0);
398 398
 		
399
-		$this->removeAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker');
399
+        $this->removeAttributeNS(XmlConfigParser::NAMESPACE_AGAVI_ANNOTATIONS_LATEST, 'agavi_annotations_latest:marker');
400 400
 		
401
-		return $retval;
402
-	}
401
+        return $retval;
402
+    }
403 403
 	
404
-	/**
405
-	 * Retrieve an attribute value.
406
-	 * Unlike DOMElement::getAttribute(), this method accepts an optional default
407
-	 * return value.
408
-	 *
409
-	 * @param      string $name    An attribute name.
410
-	 * @param      mixed  $default A default attribute value.
411
-	 *
412
-	 * @return     mixed An attribute value, if the attribute exists, otherwise
413
-	 *                   null or the given default.
414
-	 *
415
-	 * @see        DOMElement::getAttribute()
416
-	 *
417
-	 * @author     David Zülke <[email protected]>
418
-	 * @since      1.0.0
419
-	 */
420
-	public function getAttribute($name, $default = null)
421
-	{
422
-		$retval = parent::getAttribute($name);
404
+    /**
405
+     * Retrieve an attribute value.
406
+     * Unlike DOMElement::getAttribute(), this method accepts an optional default
407
+     * return value.
408
+     *
409
+     * @param      string $name    An attribute name.
410
+     * @param      mixed  $default A default attribute value.
411
+     *
412
+     * @return     mixed An attribute value, if the attribute exists, otherwise
413
+     *                   null or the given default.
414
+     *
415
+     * @see        DOMElement::getAttribute()
416
+     *
417
+     * @author     David Zülke <[email protected]>
418
+     * @since      1.0.0
419
+     */
420
+    public function getAttribute($name, $default = null)
421
+    {
422
+        $retval = parent::getAttribute($name);
423 423
 		
424
-		// getAttribute returns '' when the attribute doesn't exist, but any
425
-		// null-ish value is probably unacceptable anyway
426
-		if($retval == null) {
427
-			$retval = $default;
428
-		}
424
+        // getAttribute returns '' when the attribute doesn't exist, but any
425
+        // null-ish value is probably unacceptable anyway
426
+        if($retval == null) {
427
+            $retval = $default;
428
+        }
429 429
 		
430
-		return $retval;
431
-	}
430
+        return $retval;
431
+    }
432 432
 	
433
-	/**
434
-	 * Retrieve a namespaced attribute value.
435
-	 * Unlike DOMElement::getAttributeNS(), this method accepts an optional
436
-	 * default return value.
437
-	 *
438
-	 * @param      string $namespaceUri A namespace URI.
439
-	 * @param      string $localName    An attribute name.
440
-	 * @param      mixed  $default      A default attribute value.
441
-	 *
442
-	 * @return     mixed An attribute value, if the attribute exists, otherwise
443
-	 *                   null or the given default.
444
-	 *
445
-	 * @see        DOMElement::getAttributeNS()
446
-	 *
447
-	 * @author     David Zülke <[email protected]>
448
-	 * @since      1.0.0
449
-	 */
450
-	public function getAttributeNS($namespaceUri, $localName, $default = null)
451
-	{
452
-		$retval = parent::getAttributeNS($namespaceUri, $localName);
433
+    /**
434
+     * Retrieve a namespaced attribute value.
435
+     * Unlike DOMElement::getAttributeNS(), this method accepts an optional
436
+     * default return value.
437
+     *
438
+     * @param      string $namespaceUri A namespace URI.
439
+     * @param      string $localName    An attribute name.
440
+     * @param      mixed  $default      A default attribute value.
441
+     *
442
+     * @return     mixed An attribute value, if the attribute exists, otherwise
443
+     *                   null or the given default.
444
+     *
445
+     * @see        DOMElement::getAttributeNS()
446
+     *
447
+     * @author     David Zülke <[email protected]>
448
+     * @since      1.0.0
449
+     */
450
+    public function getAttributeNS($namespaceUri, $localName, $default = null)
451
+    {
452
+        $retval = parent::getAttributeNS($namespaceUri, $localName);
453 453
 		
454
-		if($retval === null) {
455
-			$retval = $default;
456
-		}
454
+        if($retval === null) {
455
+            $retval = $default;
456
+        }
457 457
 		
458
-		return $retval;
459
-	}
458
+        return $retval;
459
+    }
460 460
 	
461
-	/**
462
-	 * Retrieve all attributes of the element that are in no namespace.
463
-	 *
464
-	 * @return     array An associative array of attribute names and values.
465
-	 *
466
-	 * @author     David Zülke <[email protected]>
467
-	 * @since      1.0.0
468
-	 */
469
-	public function getAttributes()
470
-	{
471
-		return $this->getAttributesNS('');
472
-	}
461
+    /**
462
+     * Retrieve all attributes of the element that are in no namespace.
463
+     *
464
+     * @return     array An associative array of attribute names and values.
465
+     *
466
+     * @author     David Zülke <[email protected]>
467
+     * @since      1.0.0
468
+     */
469
+    public function getAttributes()
470
+    {
471
+        return $this->getAttributesNS('');
472
+    }
473 473
 	
474
-	/**
475
-	 * Retrieve all attributes of the element that are in the given namespace.
476
-	 *
477
-	 * @return     array An associative array of attribute names and values.
478
-	 *
479
-	 * @author     David Zülke <[email protected]>
480
-	 * @since      1.0.0
481
-	 */
482
-	public function getAttributesNS($namespaceUri)
483
-	{
484
-		$retval = array();
474
+    /**
475
+     * Retrieve all attributes of the element that are in the given namespace.
476
+     *
477
+     * @return     array An associative array of attribute names and values.
478
+     *
479
+     * @author     David Zülke <[email protected]>
480
+     * @since      1.0.0
481
+     */
482
+    public function getAttributesNS($namespaceUri)
483
+    {
484
+        $retval = array();
485 485
 		
486
-		foreach($this->ownerDocument->getXpath()->query(sprintf('@*[namespace-uri() = "%s"]', $namespaceUri), $this) as $attribute) {
487
-			$retval[$attribute->localName] = $attribute->nodeValue;
488
-		}
486
+        foreach($this->ownerDocument->getXpath()->query(sprintf('@*[namespace-uri() = "%s"]', $namespaceUri), $this) as $attribute) {
487
+            $retval[$attribute->localName] = $attribute->nodeValue;
488
+        }
489 489
 		
490
-		return $retval;
491
-	}
490
+        return $retval;
491
+    }
492 492
 	
493
-	/**
494
-	 * Check whether or not the element has Agavi parameters as children.
495
-	 *
496
-	 * @return     bool True, if there are parameters, false otherwise.
497
-	 *
498
-	 * @author     David Zülke <[email protected]>
499
-	 * @since      1.0.0
500
-	 */
501
-	public function hasAgaviParameters()
502
-	{
503
-		if($this->ownerDocument->isAgaviConfiguration()) {
504
-			return $this->has('parameters', XmlConfigParser::NAMESPACE_AGAVI_ENVELOPE_LATEST);
505
-		}
493
+    /**
494
+     * Check whether or not the element has Agavi parameters as children.
495
+     *
496
+     * @return     bool True, if there are parameters, false otherwise.
497
+     *
498
+     * @author     David Zülke <[email protected]>
499
+     * @since      1.0.0
500
+     */
501
+    public function hasAgaviParameters()
502
+    {
503
+        if($this->ownerDocument->isAgaviConfiguration()) {
504
+            return $this->has('parameters', XmlConfigParser::NAMESPACE_AGAVI_ENVELOPE_LATEST);
505
+        }
506 506
 		
507
-		return false;
508
-	}
507
+        return false;
508
+    }
509 509
 	
510
-	/**
511
-	 * Retrieve all of the Agavi parameter elements associated with this
512
-	 * element.
513
-	 *
514
-	 * @param      array An array of existing parameters.
515
-	 *
516
-	 * @return     array The complete array of parameters.
517
-	 *
518
-	 * @author     Noah Fontes <[email protected]>
519
-	 * @author     David Zülke <[email protected]>
520
-	 * @since      1.0.0
521
-	 */
522
-	public function getAgaviParameters(array $existing = array())
523
-	{
524
-		$result = $existing;
525
-		$offset = 0;
510
+    /**
511
+     * Retrieve all of the Agavi parameter elements associated with this
512
+     * element.
513
+     *
514
+     * @param      array An array of existing parameters.
515
+     *
516
+     * @return     array The complete array of parameters.
517
+     *
518
+     * @author     Noah Fontes <[email protected]>
519
+     * @author     David Zülke <[email protected]>
520
+     * @since      1.0.0
521
+     */
522
+    public function getAgaviParameters(array $existing = array())
523
+    {
524
+        $result = $existing;
525
+        $offset = 0;
526 526
 		
527
-		if($this->ownerDocument->isAgaviConfiguration()) {
528
-			$elements = $this->get('parameters', XmlConfigParser::NAMESPACE_AGAVI_ENVELOPE_LATEST);
527
+        if($this->ownerDocument->isAgaviConfiguration()) {
528
+            $elements = $this->get('parameters', XmlConfigParser::NAMESPACE_AGAVI_ENVELOPE_LATEST);
529 529
 
530
-			/** @var XmlConfigDomElement $element */
531
-			foreach($elements as $element) {
532
-				$key = null;
533
-				if(!$element->hasAttribute('name')) {
534
-					$result[$key = $offset++] = null;
535
-				} else {
536
-					$key = $element->getAttribute('name');
537
-				}
530
+            /** @var XmlConfigDomElement $element */
531
+            foreach($elements as $element) {
532
+                $key = null;
533
+                if(!$element->hasAttribute('name')) {
534
+                    $result[$key = $offset++] = null;
535
+                } else {
536
+                    $key = $element->getAttribute('name');
537
+                }
538 538
 				
539
-				if($element->hasAgaviParameters()) {
540
-					$result[$key] = isset($result[$key]) && is_array($result[$key]) ? $result[$key] : array();
541
-					$result[$key] = $element->getAgaviParameters($result[$key]);
542
-				} else {
543
-					$result[$key] = $element->getLiteralValue();
544
-				}
545
-			}
546
-		}
539
+                if($element->hasAgaviParameters()) {
540
+                    $result[$key] = isset($result[$key]) && is_array($result[$key]) ? $result[$key] : array();
541
+                    $result[$key] = $element->getAgaviParameters($result[$key]);
542
+                } else {
543
+                    $result[$key] = $element->getLiteralValue();
544
+                }
545
+            }
546
+        }
547 547
 		
548
-		return $result;
549
-	}
548
+        return $result;
549
+    }
550 550
 }
551 551
 
552 552
 ?>
553 553
\ No newline at end of file
Please login to merge, or discard this patch.