Test Failed
Pull Request — master (#104)
by Alex
04:39
created

MetadataManager::addPropertyToComplexType()   C

Complexity

Conditions 7
Paths 9

Size

Total Lines 29
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 29
rs 6.7272
cc 7
eloc 23
nc 9
nop 7
1
<?php
2
3
namespace AlgoWeb\ODataMetadata;
4
5
use AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType;
6
use AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\AssociationSetAnonymousType\EndAnonymousType;
7
use AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\EntitySetAnonymousType;
8
use AlgoWeb\ODataMetadata\MetadataV3\edm\EntityContainer\FunctionImportAnonymousType;
9
use AlgoWeb\ODataMetadata\MetadataV3\edm\TAssociationEndType;
10
use AlgoWeb\ODataMetadata\MetadataV3\edm\TAssociationType;
11
use AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypePropertyType;
12
use AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypeType;
13
use AlgoWeb\ODataMetadata\MetadataV3\edm\TConstraintType;
14
use AlgoWeb\ODataMetadata\MetadataV3\edm\TDocumentationType;
15
use AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityPropertyType;
16
use AlgoWeb\ODataMetadata\MetadataV3\edm\TEntityTypeType;
17
use AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionImportReturnTypeType;
18
use AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionReturnTypeType;
19
use AlgoWeb\ODataMetadata\MetadataV3\edm\TFunctionType;
20
use AlgoWeb\ODataMetadata\MetadataV3\edm\TNavigationPropertyType;
21
use AlgoWeb\ODataMetadata\MetadataV3\edm\TPropertyRefType;
22
use AlgoWeb\ODataMetadata\MetadataV3\edm\TReferentialConstraintRoleElementType;
23
use AlgoWeb\ODataMetadata\MetadataV3\edm\TTextType;
24
use AlgoWeb\ODataMetadata\MetadataV3\edmx\Edmx;
25
use Illuminate\Support\Str;
26
use JMS\Serializer\SerializerBuilder;
27
28
class MetadataManager
29
{
30
    private $V3Edmx = null;
31
    private $lastError = null;
32
    private $serializer = null;
33
34
    public function __construct($namespaceName = "Data", $containerName = "DefaultContainer")
35
    {
36
        $this->V3Edmx = new Edmx($namespaceName, $containerName);
37
        if (!$this->V3Edmx->isOK($msg)) {
38
            throw new \Exception($msg);
39
        }
40
        $this->initSerialiser();
41
        assert(null != $this->serializer, "Serializer must not be null at end of constructor");
42
    }
43
44
    public function getEdmx()
45
    {
46
        $msg = null;
47
        assert($this->V3Edmx->isOk($msg), $msg);
48
        return $this->V3Edmx;
49
    }
50
51
    public function getEdmxXML()
52
    {
53
        assert(null != $this->serializer, "Serializer must not be null when trying to get edmx xml");
54
        return $this->serializer->serialize($this->getEdmx(), "xml");
55
    }
56
57
    public function addEntityType($name, $accessType = "Public", $summary = null, $longDescription = null)
58
    {
59
        $NewEntity = new TEntityTypeType();
60
        $NewEntity->setName($name);
61
        if (null != $summary || null != $longDescription) {
62
            $documentation = $this->generateDocumentation($summary, $longDescription);
63
            $NewEntity->setDocumentation($documentation);
64
        }
65
66
        $entitySet = new EntitySetAnonymousType();
67
        $entitySet->setName(Str::plural($NewEntity->getName(), 2));
68
        $namespace = $this->V3Edmx->getDataServiceType()->getSchema()[0]->getNamespace();
69 View Code Duplication
        if (0 == strlen(trim($namespace))) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
70
            $entityTypeName = $NewEntity->getName();
71
        } else {
72
            $entityTypeName = $namespace . "." . $NewEntity->getName();
73
        }
74
        $entitySet->setEntityType($entityTypeName);
75
        $entitySet->setGetterAccess($accessType);
76
77
        $this->V3Edmx->getDataServiceType()->getSchema()[0]->addToEntityType($NewEntity);
78
        $this->V3Edmx->getDataServiceType()->getSchema()[0]->getEntityContainer()[0]->addToEntitySet($entitySet);
79
        if (!$this->V3Edmx->isok($this->lastError)) {
80
            return false;
81
        }
82
        return [$NewEntity, $entitySet];
83
    }
84
85
    public function addComplexType($name, $accessType = "Public", $summary = null, $longDescription = null)
86
    {
87
        $NewEntity = new TComplexTypeType();
88
        $NewEntity->setName($name);
89
        $NewEntity->setTypeAccess($accessType);
90 View Code Duplication
        if (null != $summary || null != $longDescription) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
91
            $documentation = new TDocumentationType();
92
            $documentation->setSummary($summary);
93
            $documentation->setLongDescription($longDescription);
94
            $NewEntity->setDocumentation($documentation);
95
        }
96
        $this->V3Edmx->getDataServiceType()->getSchema()[0]->addToComplexType($NewEntity);
97
98
        return $NewEntity;
99
    }
100
101
    public function getSerialiser()
102
    {
103
        return $this->serializer;
104
    }
105
106
    public function addPropertyToComplexType(
107
        \AlgoWeb\ODataMetadata\MetadataV3\edm\TComplexTypeType $complexType,
108
        $name,
109
        $type,
110
        $defaultValue = null,
111
        $nullable = false,
112
        $summary = null,
113
        $longDescription = null
114
    ) {
115
        if (is_array($defaultValue) || is_object($defaultValue)) {
116
            throw new \InvalidArgumentException("Default value cannot be object or array");
117
        }
118
        if (null != $defaultValue) {
119
            $defaultValue = var_export($defaultValue, true);
120
        }
121
        $NewProperty = new TComplexTypePropertyType();
122
        $NewProperty->setName($name);
123
        $NewProperty->setType($type);
124
        $NewProperty->setNullable($nullable);
125
        if (null != $summary || null != $longDescription) {
126
            $documentation = $this->generateDocumentation($summary, $longDescription);
127
            $NewProperty->addToDocumentation($documentation);
128
        }
129
        if (null != $defaultValue) {
130
            $NewProperty->setDefaultValue($defaultValue);
131
        }
132
        $complexType->addToProperty($NewProperty);
133
        return $NewProperty;
134
    }
135
136
    public function addPropertyToEntityType(
137
        $entityType,
138
        $name,
139
        $type,
140
        $defaultValue = null,
141
        $nullable = false,
142
        $isKey = false,
143
        $storeGeneratedPattern = null,
144
        $summary = null,
145
        $longDescription = null
146
    ) {
147
        $NewProperty = new TEntityPropertyType();
148
        $NewProperty->setName($name);
149
        $NewProperty->setType($type);
150
        $NewProperty->setStoreGeneratedPattern($storeGeneratedPattern);
151
        $NewProperty->setNullable($nullable);
152 View Code Duplication
        if (null != $summary || null != $longDescription) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
153
            $documentation = new TDocumentationType();
154
            $documentation->setSummary($summary);
155
            $documentation->setLongDescription($longDescription);
156
            $NewProperty->addToDocumentation($documentation);
157
        }
158
        if (null != $defaultValue) {
159
            $NewProperty->setDefaultValue($defaultValue);
160
        }
161
        $entityType->addToProperty($NewProperty);
162
        if ($isKey) {
163
            $Key = new TPropertyRefType();
164
            $Key->setName($name);
165
            $entityType->addToKey($Key);
166
        }
167
        if (!$this->V3Edmx->isok($this->lastError)) {
168
            return false;
169
        }
170
        return $NewProperty;
171
    }
172
173
    public function addNavigationPropertyToEntityType(
174
        TEntityTypeType $principalType,
175
        $principalMultiplicity,
176
        $principalProperty,
177
        TEntityTypeType $dependentType,
178
        $dependentMultiplicity,
179
        $dependentProperty = "",
180
        array $principalConstraintProperty = null,
181
        array $dependentConstraintProperty = null,
182
        $principalGetterAccess = "Public",
183
        $principalSetterAccess = "Public",
184
        $dependentGetterAccess = "Public",
185
        $dependentSetterAccess = "Public",
186
        $principalSummery = null,
187
        $principalLongDescription = null,
188
        $dependentSummery = null,
189
        $dependentLongDescription = null
190
    ) {
191
        $principalEntitySetName = Str::plural($principalType->getName(), 2);
192
        $dependentEntitySetName = Str::plural($dependentType->getName(), 2);
193
        $relationName = $principalType->getName() . "_" . $principalProperty . "_"
194
                        . $dependentType->getName() . "_" . $dependentProperty;
195
        $relationName = trim($relationName, "_");
196
197
        $namespace = $this->V3Edmx->getDataServiceType()->getSchema()[0]->getNamespace();
198
        if (0 == strlen(trim($namespace))) {
199
            $relationFQName = $relationName;
200
        } else {
201
            $relationFQName = $namespace . "." . $relationName;
202
        }
203
204
        $principalNavigationProperty = new TNavigationPropertyType();
205
        $principalNavigationProperty->setName($principalProperty);
206
        $principalNavigationProperty->setToRole(trim($dependentEntitySetName . "_" . $dependentProperty, "_"));
207
        $principalNavigationProperty->setFromRole($principalEntitySetName . "_" . $principalProperty);
208
        $principalNavigationProperty->setRelationship($relationFQName);
209
        $principalNavigationProperty->setGetterAccess($principalGetterAccess);
210
        $principalNavigationProperty->setSetterAccess($principalSetterAccess);
211
        if (null != $principalSummery || null != $principalLongDescription) {
212
            $principalDocumentation = new TDocumentationType();
213
            $principalDocumentation->setSummary($principalSummery);
214
            $principalDocumentation->setLongDescription($principalLongDescription);
215
            $principalNavigationProperty->setDocumentation($principalDocumentation);
216
        }
217
        $principalType->addToNavigationProperty($principalNavigationProperty);
218
        $dependentNavigationProperty = null;
219
        if (!empty($dependentProperty)) {
220
            $dependentNavigationProperty = new TNavigationPropertyType();
221
            $dependentNavigationProperty->setName($dependentProperty);
222
            $dependentNavigationProperty->setToRole($principalEntitySetName . "_" . $principalProperty);
223
            $dependentNavigationProperty->setFromRole($dependentEntitySetName . "_" . $dependentProperty);
224
            $dependentNavigationProperty->setRelationship($relationFQName);
225
            $dependentNavigationProperty->setGetterAccess($dependentGetterAccess);
226
            $dependentNavigationProperty->setSetterAccess($dependentSetterAccess);
227
            if (null != $dependentSummery || null != $dependentLongDescription) {
228
                $dependentDocumentation = new TDocumentationType();
229
                $dependentDocumentation->setSummary($dependentSummery);
230
                $dependentDocumentation->setLongDescription($dependentLongDescription);
231
                $dependentNavigationProperty->setDocumentation($dependentDocumentation);
232
            }
233
            $dependentType->addToNavigationProperty($dependentNavigationProperty);
234
        }
235
236
        $assocation = $this->createAssocationFromNavigationProperty(
237
            $principalType,
238
            $dependentType,
239
            $principalNavigationProperty,
240
            $dependentNavigationProperty,
241
            $principalMultiplicity,
242
            $dependentMultiplicity,
243
            $principalConstraintProperty,
244
            $dependentConstraintProperty
245
        );
246
247
        $this->V3Edmx->getDataServiceType()->getSchema()[0]->addToAssociation($assocation);
248
249
        $associationSet = $this->createAssocationSetForAssocation(
250
            $assocation,
251
            $principalEntitySetName,
252
            $dependentEntitySetName
253
        );
254
255
        $this->V3Edmx->getDataServiceType()->getSchema()[0]
256
            ->getEntityContainer()[0]->addToAssociationSet($associationSet);
257
258
        if (!$this->V3Edmx->isok($this->lastError)) {
259
            return false;
260
        }
261
        return [$principalNavigationProperty, $dependentNavigationProperty];
262
    }
263
264
    protected function createAssocationFromNavigationProperty(
265
        TEntityTypeType $principalType,
266
        TEntityTypeType $dependentType,
267
        TNavigationPropertyType $principalNavigationProperty,
268
        TNavigationPropertyType $dependentNavigationProperty = null,
269
        $principalMultiplicity,
270
        $dependentMultiplicity,
271
        array $principalConstraintProperty = null,
272
        array $dependentConstraintProperty = null
273
    ) {
274
        $multCombo = [ '*' => ['*', '1'], '0..1' => ['1'], '1' => ['*', '0..1']];
275
        $multKeys = array_keys($multCombo);
276
        if (null != $dependentNavigationProperty) {
277
            if ($dependentNavigationProperty->getRelationship() != $principalNavigationProperty->getRelationship()) {
278
                $msg = "if you have both a dependent property and a principal property,"
279
                       ." they should both have the same relationship";
280
                throw new \Exception($msg);
281
            }
282
            if ($dependentNavigationProperty->getFromRole() != $principalNavigationProperty->getToRole() ||
283
                $dependentNavigationProperty->getToRole() != $principalNavigationProperty->getFromRole()
284
            ) {
285
                throw new \Exception("The from roles and two roles from matching properties should match");
286
            }
287
        }
288
        if (!in_array($principalMultiplicity, $multKeys) || !in_array($dependentMultiplicity, $multKeys)) {
289
            throw new \InvalidArgumentException("Malformed multiplicity - valid values are *, 0..1 and 1");
290
        }
291
        if (!in_array($dependentMultiplicity, $multCombo[$principalMultiplicity])) {
292
            throw new \InvalidArgumentException(
293
                "Invalid multiplicity combination - ". $principalMultiplicity . ' ' . $dependentMultiplicity
294
            );
295
        }
296
297
        $namespace = $this->V3Edmx->getDataServiceType()->getSchema()[0]->getNamespace();
298
299
        if (0 == strlen(trim($namespace))) {
300
            $principalTypeFQName = $principalType->getName();
301
            $dependentTypeFQName = $dependentType->getName();
302
        } else {
303
            $principalTypeFQName = $namespace . "." . $principalType->getName();
304
            $dependentTypeFQName = $namespace . "." . $dependentType->getName();
305
        }
306
        $association = new TAssociationType();
307
        $relationship = $principalNavigationProperty->getRelationship();
308
        if (strpos($relationship, '.') !== false) {
309
            $relationship = substr($relationship, strpos($relationship, '.') + 1);
310
        }
311
312
        $principalTargRole = $principalNavigationProperty->getToRole();
313
        $principalSrcRole = $principalNavigationProperty->getFromRole();
314
        $dependentTargRole = null != $dependentNavigationProperty ? $dependentNavigationProperty->getToRole() : null;
315
316
        $association->setName($relationship);
317
        $principalEnd = new TAssociationEndType();
318
        $principalEnd->setType($principalTypeFQName);
319
        $principalEnd->setRole($principalTargRole);
320
        $principalEnd->setMultiplicity($principalMultiplicity);
321
        $association->addToEnd($principalEnd);
322
        $dependentEnd = new TAssociationEndType();
323
        $dependentEnd->setType($dependentTypeFQName);
324
        $dependentEnd->setMultiplicity($dependentMultiplicity);
325
        $association->addToEnd($dependentEnd);
326
327
        $dependentEnd->setRole(null != $dependentNavigationProperty ? $dependentTargRole : $principalSrcRole);
328
329
        $principalReferralConstraint = null;
330
        $dependentReferralConstraint = null;
331
332 View Code Duplication
        if (null != $principalConstraintProperty && 0 < count($principalConstraintProperty)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
333
            $principalReferralConstraint = new TReferentialConstraintRoleElementType();
334
            $principalReferralConstraint->setRole($principalTargRole);
335
            foreach ($principalConstraintProperty as $propertyRef) {
336
                $TpropertyRef = new TPropertyRefType();
337
                $TpropertyRef->setName($propertyRef);
338
                $principalReferralConstraint->addToPropertyRef($TpropertyRef);
339
            }
340
        }
341 View Code Duplication
        if (null != $dependentConstraintProperty && 0 < count($dependentConstraintProperty)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
342
            $dependentReferralConstraint = new TReferentialConstraintRoleElementType();
343
            $dependentReferralConstraint->setRole($dependentTargRole);
344
            foreach ($dependentConstraintProperty as $propertyRef) {
345
                $TpropertyRef = new TPropertyRefType();
346
                $TpropertyRef->setName($propertyRef);
347
                $dependentReferralConstraint->addToPropertyRef($TpropertyRef);
348
            }
349
        }
350
351
        if (null != $dependentReferralConstraint || null != $principalReferralConstraint) {
352
            $constraint = new TConstraintType();
353
            $constraint->setPrincipal($principalReferralConstraint);
0 ignored issues
show
Bug introduced by
It seems like $principalReferralConstraint defined by null on line 329 can be null; however, AlgoWeb\ODataMetadata\Me...intType::setPrincipal() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
354
            $constraint->setDependent($dependentReferralConstraint);
0 ignored issues
show
Bug introduced by
It seems like $dependentReferralConstraint defined by null on line 330 can be null; however, AlgoWeb\ODataMetadata\Me...intType::setDependent() does not accept null, maybe add an additional type check?

Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code:

/** @return stdClass|null */
function mayReturnNull() { }

function doesNotAcceptNull(stdClass $x) { }

// With potential error.
function withoutCheck() {
    $x = mayReturnNull();
    doesNotAcceptNull($x); // Potential error here.
}

// Safe - Alternative 1
function withCheck1() {
    $x = mayReturnNull();
    if ( ! $x instanceof stdClass) {
        throw new \LogicException('$x must be defined.');
    }
    doesNotAcceptNull($x);
}

// Safe - Alternative 2
function withCheck2() {
    $x = mayReturnNull();
    if ($x instanceof stdClass) {
        doesNotAcceptNull($x);
    }
}
Loading history...
355
            $association->setReferentialConstraint($constraint);
356
        }
357
        return $association;
358
    }
359
360
    protected function createAssocationSetForAssocation(
361
        TAssociationType $association,
362
        $principalEntitySetName,
363
        $dependentEntitySetName
364
    ) {
365
        $as = new AssociationSetAnonymousType();
366
        $name = $association->getName();
367
        $as->setName($name);
368
        $namespace = $this->V3Edmx->getDataServiceType()->getSchema()[0]->getNamespace();
369 View Code Duplication
        if (0 == strlen(trim($namespace))) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
370
            $associationSetName = $association->getName();
371
        } else {
372
            $associationSetName = $namespace . "." . $association->getName();
373
        }
374
        $as->setAssociation($associationSetName);
375
        $end1 = new EndAnonymousType();
376
        $end1->setRole($association->getEnd()[0]->getRole());
377
        $end1->setEntitySet($principalEntitySetName);
378
        $end2 = new EndAnonymousType();
379
        $end2->setRole($association->getEnd()[1]->getRole());
380
        $end2->setEntitySet($dependentEntitySetName);
381
        $as->addToEnd($end1);
382
        $as->addToEnd($end2);
383
        return $as;
384
    }
385
386
    public function getLastError()
387
    {
388
        return $this->lastError;
389
    }
390
391
    /**
392
     * @param string $name
393
     * @param IsOK $expectedReturnType
394
     * @param TTextType $shortDesc
395
     * @param TTextType $longDesc
396
     * @return FunctionImportAnonymousType
397
     */
398
    public function createSingleton(
399
        $name,
400
        IsOK $expectedReturnType,
401
        TTextType $shortDesc = null,
402
        TTextType $longDesc = null
403
    ) {
404
        if (!($expectedReturnType instanceof TEntityTypeType) && !($expectedReturnType instanceof TComplexTypeType)) {
405
            $msg = "Expected return type must be either TEntityType or TComplexType";
406
            throw new \InvalidArgumentException($msg);
407
        }
408
409
        if (!is_string($name) || empty($name)) {
410
            $msg = "Name must be a non-empty string";
411
            throw new \InvalidArgumentException($msg);
412
        }
413
414
        $documentation = null;
415
        if (null != $shortDesc || null != $longDesc) {
416
            $documentation = $this->generateDocumentation($shortDesc, $longDesc);
417
        }
418
        $funcType = new FunctionImportAnonymousType();
419
        $funcType->setName($name);
420
421
        $typeName = $expectedReturnType->getName();
422
        $returnType = new TFunctionImportReturnTypeType();
423
        $returnType->setType($typeName);
424
        $returnType->setEntitySetAttribute($typeName);
425
        assert($returnType->isOK($msg), $msg);
426
        $funcType->addToReturnType($returnType);
427
        if (null != $documentation) {
428
            $funcType->setDocumentation($documentation);
429
        }
430
431
        $this->getEdmx()->getDataServiceType()->getSchema()[0]->getEntityContainer()[0]->addToFunctionImport($funcType);
432
433
        return $funcType;
434
    }
435
436
    private function initSerialiser()
437
    {
438
        $ymlDir = __DIR__ . DIRECTORY_SEPARATOR . "MetadataV3" . DIRECTORY_SEPARATOR . "JMSmetadata";
439
        $this->serializer =
440
            SerializerBuilder::create()
441
                ->addMetadataDir($ymlDir)
442
                ->build();
443
    }
444
445
    public function __sleep()
446
    {
447
        $this->serializer = null;
448
        $result = array_keys(get_object_vars($this));
449
        return $result;
450
    }
451
452
    public function __wakeup()
453
    {
454
        $this->initSerialiser();
455
    }
456
457
    /**
458
     * @param $summary
459
     * @param $longDescription
460
     * @return TDocumentationType
461
     */
462
    private function generateDocumentation($summary, $longDescription)
463
    {
464
        $documentation = new TDocumentationType();
465
        $documentation->setSummary($summary);
466
        $documentation->setLongDescription($longDescription);
467
        return $documentation;
468
    }
469
}
470