Code Duplication    Length = 14-18 lines in 2 locations

eZ/Publish/Core/Persistence/Legacy/Content/Handler.php 1 location

@@ 456-469 (lines=14) @@
453
     *
454
     * @return \eZ\Publish\SPI\Persistence\Content\VersionInfo
455
     */
456
    public function loadVersionInfo(int $contentId, $versionNo)
457
    {
458
        $rows = $this->contentGateway->loadVersionInfo($contentId, $versionNo);
459
        if (empty($rows)) {
460
            throw new NotFound('content', $contentId);
461
        }
462
463
        $versionInfo = $this->mapper->extractVersionInfoListFromRows(
464
            $rows,
465
            $this->contentGateway->loadVersionedNameData([['id' => $contentId, 'version' => $versionNo]])
466
        );
467
468
        return reset($versionInfo);
469
    }
470
471
    /**
472
     * Returns the number of versions with draft status created by the given $userId.

eZ/Publish/Core/Persistence/Legacy/Content/Type/Handler.php 1 location

@@ 488-505 (lines=18) @@
485
     *
486
     * @return \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition
487
     */
488
    public function getFieldDefinition($id, $status)
489
    {
490
        $rows = $this->contentTypeGateway->loadFieldDefinition($id, $status);
491
492
        if ($rows === false) {
493
            throw new NotFoundException(
494
                'FieldDefinition',
495
                [
496
                    'id' => $id,
497
                    'status' => $status,
498
                ]
499
            );
500
        }
501
502
        $multilingualData = $this->mapper->extractMultilingualData($rows);
503
504
        return $this->mapper->extractFieldFromRow(reset($rows), $multilingualData);
505
    }
506
507
    /**
508
     * Counts the number of Content instances of the ContentType identified by given $contentTypeId.