Completed
Push — 6.7 ( eacd1f...2a3684 )
by
unknown
25:16
created

ExceptionConversion::loadContentInfoList()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 1
dl 10
loc 10
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * File containing the Content Gateway base class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\Core\Persistence\Legacy\Content\Gateway;
10
11
use eZ\Publish\Core\Persistence\Legacy\Content\Gateway;
12
use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue;
13
use eZ\Publish\SPI\Persistence\Content;
14
use eZ\Publish\SPI\Persistence\Content\CreateStruct;
15
use eZ\Publish\SPI\Persistence\Content\UpdateStruct;
16
use eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct;
17
use eZ\Publish\SPI\Persistence\Content\VersionInfo;
18
use eZ\Publish\SPI\Persistence\Content\Field;
19
use eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct as RelationCreateStruct;
20
use Doctrine\DBAL\DBALException;
21
use PDOException;
22
use RuntimeException;
23
24
/**
25
 * Base class for content gateways.
26
 */
27
class ExceptionConversion extends Gateway
28
{
29
    /**
30
     * The wrapped gateway.
31
     *
32
     * @var Gateway
33
     */
34
    protected $innerGateway;
35
36
    /**
37
     * Creates a new exception conversion gateway around $innerGateway.
38
     *
39
     * @param Gateway $innerGateway
40
     */
41
    public function __construct(Gateway $innerGateway)
42
    {
43
        $this->innerGateway = $innerGateway;
44
    }
45
46
    /**
47
     * Get context definition for external storage layers.
48
     *
49
     * @return array
50
     */
51 View Code Duplication
    public function getContext()
52
    {
53
        try {
54
            return $this->innerGateway->getContext();
55
        } catch (DBALException $e) {
56
            throw new RuntimeException('Database error', 0, $e);
57
        } catch (PDOException $e) {
58
            throw new RuntimeException('Database error', 0, $e);
59
        }
60
    }
61
62
    /**
63
     * Inserts a new content object.
64
     *
65
     * @param \eZ\Publish\SPI\Persistence\Content\CreateStruct $struct
66
     * @param mixed $currentVersionNo
67
     *
68
     * @return int ID
69
     */
70 View Code Duplication
    public function insertContentObject(CreateStruct $struct, $currentVersionNo = 1)
71
    {
72
        try {
73
            return $this->innerGateway->insertContentObject($struct, $currentVersionNo);
74
        } catch (DBALException $e) {
75
            throw new RuntimeException('Database error', 0, $e);
76
        } catch (PDOException $e) {
77
            throw new RuntimeException('Database error', 0, $e);
78
        }
79
    }
80
81
    /**
82
     * Inserts a new version.
83
     *
84
     * @param \eZ\Publish\SPI\Persistence\Content\VersionInfo $versionInfo
85
     * @param \eZ\Publish\SPI\Persistence\Content\Field[] $fields
86
     *
87
     * @return int ID
88
     */
89 View Code Duplication
    public function insertVersion(VersionInfo $versionInfo, array $fields)
90
    {
91
        try {
92
            return $this->innerGateway->insertVersion($versionInfo, $fields);
93
        } catch (DBALException $e) {
94
            throw new RuntimeException('Database error', 0, $e);
95
        } catch (PDOException $e) {
96
            throw new RuntimeException('Database error', 0, $e);
97
        }
98
    }
99
100
    /**
101
     * Updates an existing content identified by $contentId in respect to $struct.
102
     *
103
     * @param int $contentId
104
     * @param \eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct $struct
105
     * @param \eZ\Publish\SPI\Persistence\Content\VersionInfo $prePublishVersionInfo Provided on publish
106
     */
107 View Code Duplication
    public function updateContent($contentId, MetadataUpdateStruct $struct, VersionInfo $prePublishVersionInfo = null)
108
    {
109
        try {
110
            return $this->innerGateway->updateContent($contentId, $struct, $prePublishVersionInfo);
111
        } catch (DBALException $e) {
112
            throw new RuntimeException('Database error', 0, $e);
113
        } catch (PDOException $e) {
114
            throw new RuntimeException('Database error', 0, $e);
115
        }
116
    }
117
118
    /**
119
     * Updates version $versionNo for content identified by $contentId, in respect to $struct.
120
     *
121
     * @param int $contentId
122
     * @param int $versionNo
123
     * @param \eZ\Publish\SPI\Persistence\Content\UpdateStruct $struct
124
     */
125 View Code Duplication
    public function updateVersion($contentId, $versionNo, UpdateStruct $struct)
126
    {
127
        try {
128
            return $this->innerGateway->updateVersion($contentId, $versionNo, $struct);
129
        } catch (DBALException $e) {
130
            throw new RuntimeException('Database error', 0, $e);
131
        } catch (PDOException $e) {
132
            throw new RuntimeException('Database error', 0, $e);
133
        }
134
    }
135
136
    /**
137
     * Updates "always available" flag for content identified by $contentId, in respect to $alwaysAvailable.
138
     *
139
     * @param int $contentId
140
     * @param bool $newAlwaysAvailable New "always available" value
141
     */
142 View Code Duplication
    public function updateAlwaysAvailableFlag($contentId, $newAlwaysAvailable)
143
    {
144
        try {
145
            return $this->innerGateway->updateAlwaysAvailableFlag($contentId, $newAlwaysAvailable);
146
        } catch (DBALException $e) {
147
            throw new RuntimeException('Database error', 0, $e);
148
        } catch (PDOException $e) {
149
            throw new RuntimeException('Database error', 0, $e);
150
        }
151
    }
152
153
    /**
154
     * Sets the state of object identified by $contentId and $version to $state.
155
     *
156
     * The $status can be one of STATUS_DRAFT, STATUS_PUBLISHED, STATUS_ARCHIVED
157
     *
158
     * @param int $contentId
159
     * @param int $version
160
     * @param int $status
161
     *
162
     * @return bool
163
     */
164 View Code Duplication
    public function setStatus($contentId, $version, $status)
165
    {
166
        try {
167
            return $this->innerGateway->setStatus($contentId, $version, $status);
168
        } catch (DBALException $e) {
169
            throw new RuntimeException('Database error', 0, $e);
170
        } catch (PDOException $e) {
171
            throw new RuntimeException('Database error', 0, $e);
172
        }
173
    }
174
175
    /**
176
     * Inserts a new field.
177
     *
178
     * Only used when a new field is created (i.e. a new object or a field in a
179
     * new language!). After that, field IDs need to stay the same, only the
180
     * version number changes.
181
     *
182
     * @param \eZ\Publish\SPI\Persistence\Content $content
183
     * @param \eZ\Publish\SPI\Persistence\Content\Field $field
184
     * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue $value
185
     *
186
     * @return int ID
187
     */
188 View Code Duplication
    public function insertNewField(Content $content, Field $field, StorageFieldValue $value)
189
    {
190
        try {
191
            return $this->innerGateway->insertNewField($content, $field, $value);
192
        } catch (DBALException $e) {
193
            throw new RuntimeException('Database error', 0, $e);
194
        } catch (PDOException $e) {
195
            throw new RuntimeException('Database error', 0, $e);
196
        }
197
    }
198
199
    /**
200
     * Inserts an existing field.
201
     *
202
     * Used to insert a field with an exsting ID but a new version number.
203
     *
204
     * @param Content $content
205
     * @param Field $field
206
     * @param StorageFieldValue $value
207
     */
208 View Code Duplication
    public function insertExistingField(Content $content, Field $field, StorageFieldValue $value)
209
    {
210
        try {
211
            return $this->innerGateway->insertExistingField($content, $field, $value);
212
        } catch (DBALException $e) {
213
            throw new RuntimeException('Database error', 0, $e);
214
        } catch (PDOException $e) {
215
            throw new RuntimeException('Database error', 0, $e);
216
        }
217
    }
218
219
    /**
220
     * Updates an existing field.
221
     *
222
     * @param Field $field
223
     * @param StorageFieldValue $value
224
     */
225 View Code Duplication
    public function updateField(Field $field, StorageFieldValue $value)
226
    {
227
        try {
228
            return $this->innerGateway->updateField($field, $value);
229
        } catch (DBALException $e) {
230
            throw new RuntimeException('Database error', 0, $e);
231
        } catch (PDOException $e) {
232
            throw new RuntimeException('Database error', 0, $e);
233
        }
234
    }
235
236
    /**
237
     * Updates an existing, non-translatable field.
238
     *
239
     * @param \eZ\Publish\SPI\Persistence\Content\Field $field
240
     * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue $value
241
     * @param int $contentId
242
     */
243 View Code Duplication
    public function updateNonTranslatableField(
244
        Field $field,
245
        StorageFieldValue $value,
246
        $contentId
247
    ) {
248
        try {
249
            return $this->innerGateway->updateNonTranslatableField($field, $value, $contentId);
250
        } catch (DBALException $e) {
251
            throw new RuntimeException('Database error', 0, $e);
252
        } catch (PDOException $e) {
253
            throw new RuntimeException('Database error', 0, $e);
254
        }
255
    }
256
257
    /**
258
     * Loads data for a content object.
259
     *
260
     * Returns an array with the relevant data.
261
     *
262
     * @param mixed $contentId
263
     * @param mixed $version
264
     * @param string[] $translations
265
     *
266
     * @return array
267
     */
268 View Code Duplication
    public function load($contentId, $version, array $translations = null)
269
    {
270
        try {
271
            return $this->innerGateway->load($contentId, $version, $translations);
272
        } catch (DBALException $e) {
273
            throw new RuntimeException('Database error', 0, $e);
274
        } catch (PDOException $e) {
275
            throw new RuntimeException('Database error', 0, $e);
276
        }
277
    }
278
279
    /**
280
     * {@inheritdoc}
281
     */
282 View Code Duplication
    public function loadContentList(array $contentIds, array $translations = null)
283
    {
284
        try {
285
            return $this->innerGateway->loadContentList($contentIds, $translations);
0 ignored issues
show
Bug introduced by
It seems like $translations defined by parameter $translations on line 282 can also be of type array; however, eZ\Publish\Core\Persiste...eway::loadContentList() does only seem to accept null|array<integer,string>, maybe add an additional type check?

This check looks at variables that have been passed in as parameters and are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
286
        } catch (DBALException $e) {
287
            throw new RuntimeException('Database error', 0, $e);
288
        } catch (PDOException $e) {
289
            throw new RuntimeException('Database error', 0, $e);
290
        }
291
    }
292
293
    /**
294
     * Loads data for a content object identified by its remote ID.
295
     *
296
     * Returns an array with the relevant data.
297
     *
298
     * @param mixed $remoteId
299
     *
300
     * @return array
301
     */
302 View Code Duplication
    public function loadContentInfoByRemoteId($remoteId)
303
    {
304
        try {
305
            return $this->innerGateway->loadContentInfoByRemoteId($remoteId);
306
        } catch (DBALException $e) {
307
            throw new \RuntimeException('Database error', 0, $e);
308
        } catch (\PDOException $e) {
309
            throw new \RuntimeException('Database error', 0, $e);
310
        }
311
    }
312
313
    /**
314
     * Loads info for a content object identified by its location ID (node ID).
315
     *
316
     * Returns an array with the relevant data.
317
     *
318
     * @param int $locationId
319
     *
320
     * @throws \eZ\Publish\Core\Base\Exceptions\NotFoundException
321
     *
322
     * @return array
323
     */
324 View Code Duplication
    public function loadContentInfoByLocationId($locationId)
325
    {
326
        try {
327
            return $this->innerGateway->loadContentInfoByLocationId($locationId);
328
        } catch (DBALException $e) {
329
            throw new \RuntimeException('Database error', 0, $e);
330
        } catch (\PDOException $e) {
331
            throw new \RuntimeException('Database error', 0, $e);
332
        }
333
    }
334
335
    /**
336
     * Loads info for content identified by $contentId.
337
     * Will basically return a hash containing all field values for ezcontentobject table plus following keys:
338
     *  - always_available => Boolean indicating if content's language mask contains alwaysAvailable bit field
339
     *  - main_language_code => Language code for main (initial) language. E.g. "eng-GB".
340
     *
341
     * @param int $contentId
342
     *
343
     * @throws \eZ\Publish\Core\Base\Exceptions\NotFoundException
344
     *
345
     * @return array
346
     */
347 View Code Duplication
    public function loadContentInfo($contentId)
348
    {
349
        try {
350
            return $this->innerGateway->loadContentInfo($contentId);
351
        } catch (DBALException $e) {
352
            throw new RuntimeException('Database error', 0, $e);
353
        } catch (PDOException $e) {
354
            throw new RuntimeException('Database error', 0, $e);
355
        }
356
    }
357
358 View Code Duplication
    public function loadContentInfoList(array $contentIds)
359
    {
360
        try {
361
            return $this->innerGateway->loadContentInfoList($contentIds);
362
        } catch (DBALException $e) {
363
            throw new RuntimeException('Database error', 0, $e);
364
        } catch (PDOException $e) {
365
            throw new RuntimeException('Database error', 0, $e);
366
        }
367
    }
368
369
    /**
370
     * Loads version info for content identified by $contentId and $versionNo.
371
     * Will basically return a hash containing all field values from ezcontentobject_version table plus following keys:
372
     *  - names => Hash of content object names. Key is the language code, value is the name.
373
     *  - languages => Hash of language ids. Key is the language code (e.g. "eng-GB"), value is the language numeric id without the always available bit.
374
     *  - initial_language_code => Language code for initial language in this version.
375
     *
376
     * @param int $contentId
377
     * @param int $versionNo
378
     *
379
     * @return array
380
     */
381 View Code Duplication
    public function loadVersionInfo($contentId, $versionNo)
382
    {
383
        try {
384
            return $this->innerGateway->loadVersionInfo($contentId, $versionNo);
385
        } catch (DBALException $e) {
386
            throw new RuntimeException('Database error', 0, $e);
387
        } catch (PDOException $e) {
388
            throw new RuntimeException('Database error', 0, $e);
389
        }
390
    }
391
392
    /**
393
     * Returns data for all versions with given status created by the given $userId.
394
     *
395
     * @param int $userId
396
     * @param int $status
397
     *
398
     * @return string[][]
399
     */
400 View Code Duplication
    public function listVersionsForUser($userId, $status = VersionInfo::STATUS_DRAFT)
401
    {
402
        try {
403
            return $this->innerGateway->listVersionsForUser($userId, $status);
404
        } catch (DBALException $e) {
405
            throw new RuntimeException('Database error', 0, $e);
406
        } catch (PDOException $e) {
407
            throw new RuntimeException('Database error', 0, $e);
408
        }
409
    }
410
411
    /**
412
     * Returns all version data for the given $contentId.
413
     *
414
     * Result is returned with oldest version first (using version id as it has index and is auto increment).
415
     *
416
     * @param mixed $contentId
417
     * @param mixed|null $status Optional argument to filter versions by status, like {@see VersionInfo::STATUS_ARCHIVED}.
418
     * @param int $limit Limit for items returned, -1 means none.
419
     *
420
     * @return string[][]
421
     */
422 View Code Duplication
    public function listVersions($contentId, $status = null, $limit = -1)
423
    {
424
        try {
425
            return $this->innerGateway->listVersions($contentId, $status, $limit);
426
        } catch (DBALException $e) {
427
            throw new RuntimeException('Database error', 0, $e);
428
        } catch (PDOException $e) {
429
            throw new RuntimeException('Database error', 0, $e);
430
        }
431
    }
432
433
    /**
434
     * Returns all version numbers for the given $contentId.
435
     *
436
     * @param mixed $contentId
437
     *
438
     * @return int[]
439
     */
440 View Code Duplication
    public function listVersionNumbers($contentId)
441
    {
442
        try {
443
            return $this->innerGateway->listVersionNumbers($contentId);
444
        } catch (DBALException $e) {
445
            throw new RuntimeException('Database error', 0, $e);
446
        } catch (PDOException $e) {
447
            throw new RuntimeException('Database error', 0, $e);
448
        }
449
    }
450
451
    /**
452
     * Returns last version number for content identified by $contentId.
453
     *
454
     * @param int $contentId
455
     *
456
     * @return int
457
     */
458 View Code Duplication
    public function getLastVersionNumber($contentId)
459
    {
460
        try {
461
            return $this->innerGateway->getLastVersionNumber($contentId);
462
        } catch (DBALException $e) {
463
            throw new RuntimeException('Database error', 0, $e);
464
        } catch (PDOException $e) {
465
            throw new RuntimeException('Database error', 0, $e);
466
        }
467
    }
468
469
    /**
470
     * Returns all IDs for locations that refer to $contentId.
471
     *
472
     * @param int $contentId
473
     *
474
     * @return int[]
475
     */
476 View Code Duplication
    public function getAllLocationIds($contentId)
477
    {
478
        try {
479
            return $this->innerGateway->getAllLocationIds($contentId);
480
        } catch (DBALException $e) {
481
            throw new RuntimeException('Database error', 0, $e);
482
        } catch (PDOException $e) {
483
            throw new RuntimeException('Database error', 0, $e);
484
        }
485
    }
486
487
    /**
488
     * Returns all field IDs of $contentId grouped by their type.
489
     * If $versionNo is set only field IDs for that version are returned.
490
     *
491
     * @param int $contentId
492
     * @param int|null $versionNo
493
     *
494
     * @return int[][]
495
     */
496 View Code Duplication
    public function getFieldIdsByType($contentId, $versionNo = null)
497
    {
498
        try {
499
            return $this->innerGateway->getFieldIdsByType($contentId, $versionNo);
500
        } catch (DBALException $e) {
501
            throw new RuntimeException('Database error', 0, $e);
502
        } catch (PDOException $e) {
503
            throw new RuntimeException('Database error', 0, $e);
504
        }
505
    }
506
507
    /**
508
     * Deletes relations to and from $contentId.
509
     * If $versionNo is set only relations for that version are deleted.
510
     *
511
     * @param int $contentId
512
     * @param int|null $versionNo
513
     */
514 View Code Duplication
    public function deleteRelations($contentId, $versionNo = null)
515
    {
516
        try {
517
            return $this->innerGateway->deleteRelations($contentId, $versionNo);
518
        } catch (DBALException $e) {
519
            throw new RuntimeException('Database error', 0, $e);
520
        } catch (PDOException $e) {
521
            throw new RuntimeException('Database error', 0, $e);
522
        }
523
    }
524
525
    /**
526
     * Removes relations to Content with $contentId from Relation and RelationList field type fields.
527
     *
528
     * @param int $contentId
529
     */
530 View Code Duplication
    public function removeReverseFieldRelations($contentId)
531
    {
532
        try {
533
            return $this->innerGateway->removeReverseFieldRelations($contentId);
534
        } catch (DBALException $e) {
535
            throw new RuntimeException('Database error', 0, $e);
536
        } catch (PDOException $e) {
537
            throw new RuntimeException('Database error', 0, $e);
538
        }
539
    }
540
541
    /**
542
     * Deletes the field with the given $fieldId.
543
     *
544
     * @param int $fieldId
545
     */
546 View Code Duplication
    public function deleteField($fieldId)
547
    {
548
        try {
549
            return $this->innerGateway->deleteField($fieldId);
550
        } catch (DBALException $e) {
551
            throw new RuntimeException('Database error', 0, $e);
552
        } catch (PDOException $e) {
553
            throw new RuntimeException('Database error', 0, $e);
554
        }
555
    }
556
557
    /**
558
     * Deletes all fields of $contentId in all versions.
559
     * If $versionNo is set only fields for that version are deleted.
560
     *
561
     * @param int $contentId
562
     * @param int|null $versionNo
563
     */
564 View Code Duplication
    public function deleteFields($contentId, $versionNo = null)
565
    {
566
        try {
567
            return $this->innerGateway->deleteFields($contentId, $versionNo);
568
        } catch (DBALException $e) {
569
            throw new RuntimeException('Database error', 0, $e);
570
        } catch (PDOException $e) {
571
            throw new RuntimeException('Database error', 0, $e);
572
        }
573
    }
574
575
    /**
576
     * Deletes all versions of $contentId.
577
     * If $versionNo is set only that version is deleted.
578
     *
579
     * @param int $contentId
580
     * @param int|null $versionNo
581
     */
582 View Code Duplication
    public function deleteVersions($contentId, $versionNo = null)
583
    {
584
        try {
585
            return $this->innerGateway->deleteVersions($contentId, $versionNo);
586
        } catch (DBALException $e) {
587
            throw new RuntimeException('Database error', 0, $e);
588
        } catch (PDOException $e) {
589
            throw new RuntimeException('Database error', 0, $e);
590
        }
591
    }
592
593
    /**
594
     * Deletes all names of $contentId.
595
     * If $versionNo is set only names for that version are deleted.
596
     *
597
     * @param int $contentId
598
     * @param int|null $versionNo
599
     */
600 View Code Duplication
    public function deleteNames($contentId, $versionNo = null)
601
    {
602
        try {
603
            return $this->innerGateway->deleteNames($contentId, $versionNo);
604
        } catch (DBALException $e) {
605
            throw new RuntimeException('Database error', 0, $e);
606
        } catch (PDOException $e) {
607
            throw new RuntimeException('Database error', 0, $e);
608
        }
609
    }
610
611
    /**
612
     * Sets the content object name.
613
     *
614
     * @param int $contentId
615
     * @param int $version
616
     * @param string $name
617
     * @param string $language
618
     */
619 View Code Duplication
    public function setName($contentId, $version, $name, $language)
620
    {
621
        try {
622
            return $this->innerGateway->setName($contentId, $version, $name, $language);
623
        } catch (DBALException $e) {
624
            throw new RuntimeException('Database error', 0, $e);
625
        } catch (PDOException $e) {
626
            throw new RuntimeException('Database error', 0, $e);
627
        }
628
    }
629
630
    /**
631
     * Deletes the actual content object referred to by $contentId.
632
     *
633
     * @param int $contentId
634
     */
635 View Code Duplication
    public function deleteContent($contentId)
636
    {
637
        try {
638
            return $this->innerGateway->deleteContent($contentId);
639
        } catch (DBALException $e) {
640
            throw new RuntimeException('Database error', 0, $e);
641
        } catch (PDOException $e) {
642
            throw new RuntimeException('Database error', 0, $e);
643
        }
644
    }
645
646
    /**
647
     * Loads data of related to/from $contentId.
648
     *
649
     * @param int $contentId
650
     * @param int $contentVersionNo
651
     * @param int $relationType
652
     *
653
     * @return mixed[][] Content data, array structured like {@see \eZ\Publish\Core\Persistence\Legacy\Content\Gateway::load()}
654
     */
655 View Code Duplication
    public function loadRelations($contentId, $contentVersionNo = null, $relationType = null)
656
    {
657
        try {
658
            return $this->innerGateway->loadRelations($contentId, $contentVersionNo, $relationType);
659
        } catch (DBALException $e) {
660
            throw new RuntimeException('Database error', 0, $e);
661
        } catch (PDOException $e) {
662
            throw new RuntimeException('Database error', 0, $e);
663
        }
664
    }
665
666
    /**
667
     * Loads data of related to/from $contentId.
668
     *
669
     * @param int $contentId
670
     * @param bool $reverse Reverse relation, default false
0 ignored issues
show
Bug introduced by
There is no parameter named $reverse. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
671
     * @param int $contentVersionNo
0 ignored issues
show
Bug introduced by
There is no parameter named $contentVersionNo. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
672
     * @param int $relationType
673
     *
674
     * @return mixed[][] Content data, array structured like {@see \eZ\Publish\Core\Persistence\Legacy\Content\Gateway::load()}
675
     */
676 View Code Duplication
    public function loadReverseRelations($contentId, $relationType = null)
677
    {
678
        try {
679
            return $this->innerGateway->loadReverseRelations($contentId, $relationType);
680
        } catch (DBALException $e) {
681
            throw new RuntimeException('Database error', 0, $e);
682
        } catch (PDOException $e) {
683
            throw new RuntimeException('Database error', 0, $e);
684
        }
685
    }
686
687
    /**
688
     * Deletes the relation with the given $relationId.
689
     *
690
     * @param int $relationId
691
     * @param int $type {@see \eZ\Publish\API\Repository\Values\Content\Relation::COMMON,
692
     *                 \eZ\Publish\API\Repository\Values\Content\Relation::EMBED,
693
     *                 \eZ\Publish\API\Repository\Values\Content\Relation::LINK,
694
     *                 \eZ\Publish\API\Repository\Values\Content\Relation::FIELD}
695
     */
696 View Code Duplication
    public function deleteRelation($relationId, $type)
697
    {
698
        try {
699
            return $this->innerGateway->deleteRelation($relationId, $type);
700
        } catch (DBALException $e) {
701
            throw new RuntimeException('Database error', 0, $e);
702
        } catch (PDOException $e) {
703
            throw new RuntimeException('Database error', 0, $e);
704
        }
705
    }
706
707
    /**
708
     * Inserts a new relation database record.
709
     *
710
     * @param \eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct $createStruct
0 ignored issues
show
Documentation introduced by
There is no parameter named $createStruct. Did you maybe mean $struct?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
711
     *
712
     * @return int ID the inserted ID
713
     */
714 View Code Duplication
    public function insertRelation(RelationCreateStruct $struct)
715
    {
716
        try {
717
            return $this->innerGateway->insertRelation($struct);
718
        } catch (DBALException $e) {
719
            throw new RuntimeException('Database error', 0, $e);
720
        } catch (PDOException $e) {
721
            throw new RuntimeException('Database error', 0, $e);
722
        }
723
    }
724
725
    /**
726
     * Returns all Content IDs for a given $contentTypeId.
727
     *
728
     * @param int $contentTypeId
729
     *
730
     * @return int[]
731
     */
732 View Code Duplication
    public function getContentIdsByContentTypeId($contentTypeId)
733
    {
734
        try {
735
            return $this->innerGateway->getContentIdsByContentTypeId($contentTypeId);
736
        } catch (DBALException $e) {
737
            throw new RuntimeException('Database error', 0, $e);
738
        } catch (PDOException $e) {
739
            throw new RuntimeException('Database error', 0, $e);
740
        }
741
    }
742
743
    /**
744
     * Load name data for set of content id's and corresponding version number.
745
     *
746
     * @param array[] $rows array of hashes with 'id' and 'version' to load names for
747
     *
748
     * @return array
749
     */
750 View Code Duplication
    public function loadVersionedNameData($rows)
751
    {
752
        try {
753
            return $this->innerGateway->loadVersionedNameData($rows);
754
        } catch (DBALException $e) {
755
            throw new RuntimeException('Database error', 0, $e);
756
        } catch (PDOException $e) {
757
            throw new RuntimeException('Database error', 0, $e);
758
        }
759
    }
760
761
    /**
762
     * Batch method for copying all relation meta data for copied Content object.
763
     *
764
     * {@inheritdoc}
765
     *
766
     * @param int $originalContentId
767
     * @param int $copiedContentId
768
     * @param int|null $versionNo If specified only copy for a given version number, otherwise all.
769
     */
770 View Code Duplication
    public function copyRelations($originalContentId, $copiedContentId, $versionNo = null)
771
    {
772
        try {
773
            return $this->innerGateway->copyRelations($originalContentId, $copiedContentId, $versionNo);
774
        } catch (DBALException $e) {
775
            throw new RuntimeException('Database error', 0, $e);
776
        } catch (PDOException $e) {
777
            throw new RuntimeException('Database error', 0, $e);
778
        }
779
    }
780
}
781