Xml::buildClass()   F
last analyzed

Complexity

Conditions 21
Paths 17496

Size

Total Lines 87

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 462

Importance

Changes 0
Metric Value
cc 21
nc 17496
nop 3
dl 0
loc 87
rs 0
c 0
b 0
f 0
ccs 0
cts 48
cp 0
crap 462

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of phpDocumentor.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author    Mike van Riel <[email protected]>
11
 * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com)
12
 * @license   http://www.opensource.org/licenses/mit-license.php MIT
13
 * @link      http://phpdoc.org
14
 */
15
16
namespace phpDocumentor\Plugin\Core\Transformer\Writer;
17
18
use phpDocumentor\Application;
19
use phpDocumentor\Descriptor\ClassDescriptor;
20
use phpDocumentor\Descriptor\ConstantDescriptor;
21
use phpDocumentor\Descriptor\FileDescriptor;
22
use phpDocumentor\Descriptor\FunctionDescriptor;
23
use phpDocumentor\Descriptor\InterfaceDescriptor;
24
use phpDocumentor\Descriptor\ProjectDescriptor;
25
use phpDocumentor\Descriptor\TraitDescriptor;
26
use phpDocumentor\Descriptor\Validator\Error;
27
use phpDocumentor\Plugin\Core\Transformer\Behaviour\Tag\AuthorTag;
28
use phpDocumentor\Plugin\Core\Transformer\Behaviour\Tag\CoversTag;
29
use phpDocumentor\Plugin\Core\Transformer\Behaviour\Tag\IgnoreTag;
30
use phpDocumentor\Plugin\Core\Transformer\Behaviour\Tag\InternalTag;
31
use phpDocumentor\Plugin\Core\Transformer\Behaviour\Tag\LicenseTag;
32
use phpDocumentor\Plugin\Core\Transformer\Behaviour\Tag\MethodTag;
33
use phpDocumentor\Plugin\Core\Transformer\Behaviour\Tag\ParamTag;
34
use phpDocumentor\Plugin\Core\Transformer\Behaviour\Tag\PropertyTag;
35
use phpDocumentor\Plugin\Core\Transformer\Behaviour\Tag\ReturnTag;
36
use phpDocumentor\Plugin\Core\Transformer\Behaviour\Tag\UsesTag;
37
use phpDocumentor\Plugin\Core\Transformer\Behaviour\Tag\VarTag;
38
use phpDocumentor\Plugin\Core\Transformer\Writer\Xml\ArgumentConverter;
39
use phpDocumentor\Plugin\Core\Transformer\Writer\Xml\ConstantConverter;
40
use phpDocumentor\Plugin\Core\Transformer\Writer\Xml\DocBlockConverter;
41
use phpDocumentor\Plugin\Core\Transformer\Writer\Xml\InterfaceConverter;
42
use phpDocumentor\Plugin\Core\Transformer\Writer\Xml\MethodConverter;
43
use phpDocumentor\Plugin\Core\Transformer\Writer\Xml\PropertyConverter;
44
use phpDocumentor\Plugin\Core\Transformer\Writer\Xml\TagConverter;
45
use phpDocumentor\Plugin\Core\Transformer\Writer\Xml\TraitConverter;
46
use phpDocumentor\Transformer\Router\RouterAbstract;
47
use phpDocumentor\Transformer\Transformation;
48
use phpDocumentor\Transformer\Transformer;
49
use phpDocumentor\Transformer\Writer\Translatable;
50
use phpDocumentor\Transformer\Writer\WriterAbstract;
51
use phpDocumentor\Translator\Translator;
52
53
/**
54
 * Converts the structural information of phpDocumentor into an XML file.
55
 */
56
class Xml extends WriterAbstract implements Translatable
57
{
58
    /** @var \DOMDocument $xml */
59
    protected $xml;
60
61
    /** @var Translator $translator */
62
    protected $translator;
63
64
    protected $docBlockConverter;
65
66
    protected $argumentConverter;
67
68
    protected $methodConverter;
69
70
    protected $propertyConverter;
71
72
    protected $constantConverter;
73
74
    protected $interfaceConverter;
75
76
    protected $traitConverter;
77
78 2
    public function __construct(RouterAbstract $router)
79
    {
80 2
        $this->docBlockConverter = new DocBlockConverter(new TagConverter(), $router);
81 2
        $this->argumentConverter = new ArgumentConverter();
82 2
        $this->methodConverter = new MethodConverter($this->argumentConverter, $this->docBlockConverter);
83 2
        $this->propertyConverter = new PropertyConverter($this->docBlockConverter);
84 2
        $this->constantConverter = new ConstantConverter($this->docBlockConverter);
85 2
        $this->interfaceConverter = new InterfaceConverter(
86 2
            $this->docBlockConverter,
87 2
            $this->methodConverter,
88 2
            $this->constantConverter
89
        );
90 2
        $this->traitConverter = new TraitConverter(
91 2
            $this->docBlockConverter,
92 2
            $this->methodConverter,
93 2
            $this->propertyConverter
94
        );
95 2
    }
96
97
    /**
98
     * Returns an instance of the object responsible for translating content.
99
     *
100
     * @return Translator
101
     */
102
    public function getTranslator()
103
    {
104
        return $this->translator;
105
    }
106
107
    /**
108
     * Sets a new object capable of translating strings on this writer.
109
     */
110 2
    public function setTranslator(Translator $translator)
111
    {
112 2
        $this->translator = $translator;
113 2
    }
114
115
    /**
116
     * This method generates the AST output
117
     *
118
     * @param ProjectDescriptor $project        Document containing the structure.
119
     * @param Transformation    $transformation Transformation to execute.
120
     */
121 2
    public function transform(ProjectDescriptor $project, Transformation $transformation)
122
    {
123 2
        $artifact = $this->getDestinationPath($transformation);
124
125 2
        $this->checkForSpacesInPath($artifact);
126
127 2
        $this->xml = new \DOMDocument('1.0', 'utf-8');
128 2
        $this->xml->formatOutput = true;
129 2
        $document_element = new \DOMElement('project');
130 2
        $this->xml->appendChild($document_element);
131
132 2
        $document_element->setAttribute('title', $project->getName());
133 2
        $document_element->setAttribute('version', Application::VERSION());
134
135 2
        $this->buildPartials($document_element, $project);
136
137 2
        $transformer = $transformation->getTransformer();
138
139 2
        foreach ($project->getFiles() as $file) {
140 1
            $this->buildFile($document_element, $file, $transformer);
141
        }
142
143 2
        $this->finalize($project);
144 2
        file_put_contents($artifact, $this->xml->saveXML());
145 2
    }
146
147 2
    protected function buildPartials(\DOMElement $parent, ProjectDescriptor $project)
148
    {
149 2
        $child = new \DOMElement('partials');
150 2
        $parent->appendChild($child);
151 2
        foreach ($project->getPartials() as $name => $element) {
152
            $partial = new \DOMElement('partial');
153
            $child->appendChild($partial);
154
            $partial->setAttribute('name', $name);
155
            $partial->appendChild(new \DOMText($element));
156
        }
157 2
    }
158
159 1
    protected function buildFile(\DOMElement $parent, FileDescriptor $file, Transformer $transformer)
160
    {
161 1
        $child = new \DOMElement('file');
162 1
        $parent->appendChild($child);
163
164 1
        $path = ltrim($file->getPath(), './');
165 1
        $child->setAttribute('path', $path);
166 1
        $child->setAttribute(
167 1
            'generated-path',
168 1
            $transformer->generateFilename($path)
169
        );
170 1
        $child->setAttribute('hash', $file->getHash());
171
172 1
        $this->docBlockConverter->convert($child, $file);
173
174
        // add namespace aliases
175 1
        foreach ($file->getNamespaceAliases() as $alias => $namespace) {
176 1
            $alias_obj = new \DOMElement('namespace-alias', $namespace);
177 1
            $child->appendChild($alias_obj);
178 1
            $alias_obj->setAttribute('name', (string) $alias);
179
        }
180
181
        /** @var ConstantDescriptor $constant */
182 1
        foreach ($file->getConstants() as $constant) {
183
            $this->constantConverter->convert($child, $constant);
184
        }
185
186
        /** @var FunctionDescriptor $function */
187 1
        foreach ($file->getFunctions() as $function) {
188
            $this->buildFunction($child, $function);
189
        }
190
191
        /** @var InterfaceDescriptor $interface */
192 1
        foreach ($file->getInterfaces() as $interface) {
193
            $this->interfaceConverter->convert($child, $interface);
194
        }
195
196
        /** @var ClassDescriptor $class */
197 1
        foreach ($file->getClasses() as $class) {
198
            $this->buildClass($child, $class);
199
        }
200
201
        /** @var TraitDescriptor $class */
202 1
        foreach ($file->getTraits() as $trait) {
203
            $this->traitConverter->convert($child, $trait);
204
        }
205
206
        // add markers
207 1
        if (count($file->getMarkers()) > 0) {
208
            $markers = new \DOMElement('markers');
209
            $child->appendChild($markers);
210
211
            foreach ($file->getMarkers() as $marker) {
212
                if (! $marker['type']) {
213
                    continue;
214
                }
215
216
                $type = preg_replace('/[^A-Za-z0-9\-]/', '', $marker['type']);
217
                $marker_obj = new \DOMElement(strtolower($type));
218
                $markers->appendChild($marker_obj);
219
220
                $marker_obj->appendChild(new \DOMText(trim($marker['message'])));
221
                $marker_obj->setAttribute('line', $marker['line']);
222
            }
223
        }
224
225 1
        $errors = $file->getAllErrors();
226 1
        if (count($errors) > 0) {
227
            $parse_errors = new \DOMElement('parse_markers');
228
            $child->appendChild($parse_errors);
229
230
            /** @var Error $error */
231
            foreach ($errors as $error) {
232
                $this->createErrorEntry($error, $parse_errors);
233
            }
234
        }
235
236
        // if we want to include the source for each file; append a new
237
        // element 'source' which contains a compressed, encoded version
238
        // of the source
239 1
        if ($file->getSource()) {
0 ignored issues
show
Bug Best Practice introduced by Mike van Riel
The expression $file->getSource() of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
240
            $child->appendChild(new \DOMElement('source', base64_encode(gzcompress($file->getSource()))));
241
        }
242 1
    }
243
244
    /**
245
     * Creates an entry in the ParseErrors collection of a file for a given error.
246
     *
247
     * @param Error       $error
248
     * @param \DOMElement $parse_errors
249
     */
250
    protected function createErrorEntry($error, $parse_errors)
251
    {
252
        $marker_obj = new \DOMElement(strtolower($error->getSeverity()));
253
        $parse_errors->appendChild($marker_obj);
254
255
        $message = ($this->getTranslator())
256
            ? vsprintf($this->getTranslator()->translate($error->getCode()), $error->getContext())
257
            : $error->getCode();
258
259
        $marker_obj->appendChild(new \DOMText($message));
260
        $marker_obj->setAttribute('line', $error->getLine());
261
        $marker_obj->setAttribute('code', $error->getCode());
262
    }
263
264
    /**
265
     * Retrieves the destination location for this artifact.
266
     *
267
     * @return string
268
     */
269 2
    protected function getDestinationPath(Transformation $transformation)
270
    {
271 2
        return $transformation->getTransformer()->getTarget()
272 2
            . DIRECTORY_SEPARATOR . $transformation->getArtifact();
273
    }
274
275
    /**
276
     * Export this function definition to the given parent DOMElement.
277
     *
278
     * @param \DOMElement        $parent   Element to augment.
279
     * @param FunctionDescriptor $function Element to export.
280
     * @param \DOMElement        $child    if supplied this element will be augmented instead of freshly added.
281
     */
282
    public function buildFunction(\DOMElement $parent, FunctionDescriptor $function, \DOMElement $child = null)
283
    {
284
        if (!$child) {
285
            $child = new \DOMElement('function');
286
            $parent->appendChild($child);
287
        }
288
289
        $namespace = $function->getNamespace()
290
            ? $function->getNamespace()
291
            : $parent->getAttribute('namespace');
292
        $child->setAttribute('namespace', ltrim($namespace, '\\'));
293
        $child->setAttribute('line', $function->getLine());
294
295
        $child->appendChild(new \DOMElement('name', $function->getName()));
296
        $child->appendChild(new \DOMElement('full_name', $function->getFullyQualifiedStructuralElementName()));
297
298
        $this->docBlockConverter->convert($child, $function);
299
300
        foreach ($function->getArguments() as $argument) {
301
            $this->argumentConverter->convert($child, $argument);
302
        }
303
    }
304
305
    /**
306
     * Exports the given reflection object to the parent XML element.
307
     *
308
     * This method creates a new child element on the given parent XML element
309
     * and takes the properties of the Reflection argument and sets the
310
     * elements and attributes on the child.
311
     *
312
     * If a child DOMElement is provided then the properties and attributes are
313
     * set on this but the child element is not appended onto the parent. This
314
     * is the responsibility of the invoker. Essentially this means that the
315
     * $parent argument is ignored in this case.
316
     *
317
     * @param \DOMElement     $parent The parent element to augment.
318
     * @param ClassDescriptor $class  The data source.
319
     * @param \DOMElement     $child  Optional: child element to use instead of creating a
320
     *      new one on the $parent.
321
     */
322
    public function buildClass(\DOMElement $parent, ClassDescriptor $class, \DOMElement $child = null)
323
    {
324
        if (!$child) {
325
            $child = new \DOMElement('class');
326
            $parent->appendChild($child);
327
        }
328
329
        $child->setAttribute('final', $class->isFinal() ? 'true' : 'false');
330
        $child->setAttribute('abstract', $class->isAbstract() ? 'true' : 'false');
331
332
        if ($class->getParent() !== null) {
333
            $parentFqcn = $class->getParent() instanceof ClassDescriptor
334
                ? (string) $class->getParent()->getFullyQualifiedStructuralElementName()
335
                : (string) $class->getParent();
336
            $child->appendChild(new \DOMElement('extends', $parentFqcn));
337
        }
338
339
        /** @var InterfaceDescriptor $interface */
340
        foreach ($class->getInterfaces() as $interface) {
341
            $interfaceFqcn = $interface instanceof InterfaceDescriptor
342
                ? (string) $interface->getFullyQualifiedStructuralElementName()
343
                : (string) $interface;
344
            $child->appendChild(new \DOMElement('implements', $interfaceFqcn));
345
        }
346
347
        if ($child === null) {
348
            $child = new \DOMElement('interface');
349
            $parent->appendChild($child);
350
        }
351
352
        $namespace = $class->getNamespace()->getFullyQualifiedStructuralElementName();
353
        $child->setAttribute('namespace', ltrim($namespace, '\\'));
354
        $child->setAttribute('line', $class->getLine());
355
356
        $child->appendChild(new \DOMElement('name', $class->getName()));
357
        $child->appendChild(new \DOMElement('full_name', $class->getFullyQualifiedStructuralElementName()));
358
359
        $this->docBlockConverter->convert($child, $class);
360
361
        foreach ($class->getConstants() as $constant) {
362
            // TODO #840: Workaround; for some reason there are NULLs in the constants array.
363
            if ($constant) {
364
                $this->constantConverter->convert($child, $constant);
365
            }
366
        }
367
368
        foreach ($class->getInheritedConstants() as $constant) {
369
            // TODO #840: Workaround; for some reason there are NULLs in the constants array.
370
            if ($constant) {
371
                $this->constantConverter->convert($child, $constant);
372
            }
373
        }
374
375
        foreach ($class->getProperties() as $property) {
376
            // TODO #840: Workaround; for some reason there are NULLs in the properties array.
377
            if ($property) {
378
                $this->propertyConverter->convert($child, $property);
379
            }
380
        }
381
382
        foreach ($class->getInheritedProperties() as $property) {
383
            // TODO #840: Workaround; for some reason there are NULLs in the properties array.
384
            if ($property) {
385
                $this->propertyConverter->convert($child, $property);
386
            }
387
        }
388
389
        foreach ($class->getMethods() as $method) {
390
            // TODO #840: Workaround; for some reason there are NULLs in the methods array.
391
            if ($method) {
392
                $this->methodConverter->convert($child, $method);
393
            }
394
        }
395
396
        foreach ($class->getInheritedMethods() as $method) {
397
            // TODO #840: Workaround; for some reason there are NULLs in the methods array.
398
            if ($method) {
399
                $methodElement = $this->methodConverter->convert($child, $method);
400
                $methodElement->appendChild(
401
                    new \DOMElement(
402
                        'inherited_from',
403
                        $method->getParent()->getFullyQualifiedStructuralElementName()
404
                    )
405
                );
406
            }
407
        }
408
    }
409
410
    /**
411
     * Finalizes the processing and executing all post-processing actions.
412
     *
413
     * This method is responsible for extracting and manipulating the data that
414
     * is global to the project, such as:
415
     *
416
     * - Package tree
417
     * - Namespace tree
418
     * - Marker list
419
     * - Deprecated elements listing
420
     * - Removal of objects related to visibility
421
     */
422 2
    protected function finalize(ProjectDescriptor $projectDescriptor)
423
    {
424
        // TODO: move all these behaviours to a central location for all template parsers
425 2
        $behaviour = new AuthorTag();
426 2
        $behaviour->process($this->xml);
427 2
        $behaviour = new CoversTag();
428 2
        $behaviour->process($this->xml);
429 2
        $behaviour = new IgnoreTag();
430 2
        $behaviour->process($this->xml);
431 2
        $behaviour = new InternalTag(
432 2
            $projectDescriptor->isVisibilityAllowed(ProjectDescriptor\Settings::VISIBILITY_INTERNAL)
433
        );
434 2
        $behaviour->process($this->xml);
435 2
        $behaviour = new LicenseTag();
436 2
        $behaviour->process($this->xml);
437 2
        $behaviour = new MethodTag();
438 2
        $behaviour->process($this->xml);
439 2
        $behaviour = new ParamTag();
440 2
        $behaviour->process($this->xml);
441 2
        $behaviour = new PropertyTag();
442 2
        $behaviour->process($this->xml);
443 2
        $behaviour = new ReturnTag();
444 2
        $behaviour->process($this->xml);
445 2
        $behaviour = new UsesTag();
446 2
        $behaviour->process($this->xml);
447 2
        $behaviour = new VarTag();
448 2
        $behaviour->process($this->xml);
449 2
        $this->buildPackageTree($this->xml);
450 2
        $this->buildNamespaceTree($this->xml);
451 2
        $this->buildDeprecationList($this->xml);
452 2
    }
453
454
    /**
455
     * Collects all packages and subpackages, and adds a new section in the
456
     * DOM to provide an overview.
457
     *
458
     * @param \DOMDocument $dom Packages are extracted and a summary inserted
459
     *     in this object.
460
     */
461 2
    protected function buildPackageTree(\DOMDocument $dom)
462
    {
463 2
        $xpath = new \DOMXPath($dom);
464 2
        $packages = ['global' => true];
465 2
        $qry = $xpath->query('//@package');
466 2
        for ($i = 0; $i < $qry->length; ++$i) {
467 1
            if (isset($packages[$qry->item($i)->nodeValue])) {
468
                continue;
469
            }
470
471 1
            $packages[$qry->item($i)->nodeValue] = true;
472
        }
473
474 2
        $packages = $this->generateNamespaceTree(array_keys($packages));
475 2
        $this->generateNamespaceElements($packages, $dom->documentElement, 'package');
476 2
    }
477
478
    /**
479
     * Collects all namespaces and sub-namespaces, and adds a new section in
480
     * the DOM to provide an overview.
481
     *
482
     * @param \DOMDocument $dom Namespaces are extracted and a summary inserted
483
     *     in this object.
484
     */
485 2
    protected function buildNamespaceTree(\DOMDocument $dom)
486
    {
487 2
        $xpath = new \DOMXPath($dom);
488 2
        $namespaces = [];
489 2
        $qry = $xpath->query('//@namespace');
490 2
        for ($i = 0; $i < $qry->length; ++$i) {
491
            if (isset($namespaces[$qry->item($i)->nodeValue])) {
492
                continue;
493
            }
494
495
            $namespaces[$qry->item($i)->nodeValue] = true;
496
        }
497
498 2
        $namespaces = $this->generateNamespaceTree(array_keys($namespaces));
499 2
        $this->generateNamespaceElements($namespaces, $dom->documentElement);
500 2
    }
501
502
    /**
503
     * Adds a node to the xml for deprecations and the count value
504
     *
505
     * @param \DOMDocument $dom Markers are extracted and a summary inserted in this object.
506
     */
507 2
    protected function buildDeprecationList(\DOMDocument $dom)
508
    {
509 2
        $nodes = $this->getNodeListForTagBasedQuery($dom, 'deprecated');
510
511 2
        $node = new \DOMElement('deprecated');
512 2
        $dom->documentElement->appendChild($node);
513 2
        $node->setAttribute('count', (string) $nodes->length);
514 2
    }
515
516
    /**
517
     * Build a tag based query string and return result
518
     *
519
     * @param \DOMDocument $dom    Markers are extracted and a summary inserted
520
     *      in this object.
521
     * @param string       $marker The marker we're searching for throughout xml
522
     *
523
     * @return \DOMNodeList
524
     */
525 2
    protected function getNodeListForTagBasedQuery($dom, $marker)
526
    {
527 2
        $xpath = new \DOMXPath($dom);
528
529 2
        $query = '/project/file/markers/' . $marker . '|';
530 2
        $query .= '/project/file/docblock/tag[@name="' . $marker . '"]|';
531 2
        $query .= '/project/file/class/docblock/tag[@name="' . $marker . '"]|';
532 2
        $query .= '/project/file/class/*/docblock/tag[@name="' . $marker . '"]|';
533 2
        $query .= '/project/file/interface/docblock/tag[@name="' . $marker . '"]|';
534 2
        $query .= '/project/file/interface/*/docblock/tag[@name="' . $marker . '"]|';
535 2
        $query .= '/project/file/function/docblock/tag[@name="' . $marker . '"]|';
536 2
        $query .= '/project/file/constant/docblock/tag[@name="' . $marker . '"]';
537
538 2
        return $xpath->query($query);
539
    }
540
541
    /**
542
     * Generates a hierarchical array of namespaces with their singular name
543
     * from a single level list of namespaces with their full name.
544
     *
545
     * @param array $namespaces the list of namespaces as retrieved from the xml.
546
     *
547
     * @return array
548
     */
549 2
    protected function generateNamespaceTree($namespaces)
550
    {
551 2
        sort($namespaces);
552
553 2
        $result = [];
554 2
        foreach ($namespaces as $namespace) {
555 2
            if (!$namespace) {
556
                $namespace = 'global';
557
            }
558
559 2
            $namespace_list = explode('\\', $namespace);
560
561 2
            $node = &$result;
562 2
            foreach ($namespace_list as $singular) {
563 2
                if (!isset($node[$singular])) {
564 2
                    $node[$singular] = [];
565
                }
566
567 2
                $node = &$node[$singular];
568
            }
569
        }
570
571 2
        return $result;
572
    }
573
574
    /**
575
     * Recursive method to create a hierarchical set of nodes in the dom.
576
     *
577
     * @param array[]     $namespaces     the list of namespaces to process.
578
     * @param \DOMElement $parent_element the node to receive the children of
579
     *                                    the above list.
580
     * @param string      $node_name      the name of the summary element.
581
     */
582 2
    protected function generateNamespaceElements($namespaces, $parent_element, $node_name = 'namespace')
583
    {
584 2
        foreach ($namespaces as $name => $sub_namespaces) {
585 2
            $node = new \DOMElement($node_name);
586 2
            $parent_element->appendChild($node);
587 2
            $node->setAttribute('name', $name);
588 2
            $fullName = $parent_element->nodeName === $node_name
589
                ? $parent_element->getAttribute('full_name') . '\\' . $name
590 2
                : $name;
591 2
            $node->setAttribute('full_name', $fullName);
592 2
            $this->generateNamespaceElements($sub_namespaces, $node, $node_name);
593
        }
594 2
    }
595
}
596