Code Duplication    Length = 20-23 lines in 2 locations

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

@@ 125-147 (lines=23) @@
122
     *
123
     * @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[]
124
     */
125
    public function listVersions($contentId, $status = null, $limit = -1)
126
    {
127
        $rows = $this->contentGateway->listVersions($contentId, $status, $limit);
128
        if (empty($rows)) {
129
            return array();
130
        }
131
132
        $idVersionPairs = array_map(
133
            function ($row) use ($contentId) {
134
                return array(
135
                    'id' => $contentId,
136
                    'version' => $row['ezcontentobject_version_version'],
137
                );
138
            },
139
            $rows
140
        );
141
        $nameRows = $this->contentGateway->loadVersionedNameData($idVersionPairs);
142
143
        return $this->contentMapper->extractVersionInfoListFromRows(
144
            $rows,
145
            $nameRows
146
        );
147
    }
148
149
    /**
150
     * Loads the data for the location identified by $locationId.

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

@@ 490-509 (lines=20) @@
487
     *
488
     * @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[]
489
     */
490
    public function loadDraftsForUser($userId)
491
    {
492
        $rows = $this->contentGateway->listVersionsForUser($userId, VersionInfo::STATUS_DRAFT);
493
        if (empty($rows)) {
494
            return array();
495
        }
496
497
        $idVersionPairs = array_map(
498
            function ($row) {
499
                return array(
500
                    'id' => $row['ezcontentobject_version_contentobject_id'],
501
                    'version' => $row['ezcontentobject_version_version'],
502
                );
503
            },
504
            $rows
505
        );
506
        $nameRows = $this->contentGateway->loadVersionedNameData($idVersionPairs);
507
508
        return $this->mapper->extractVersionInfoListFromRows($rows, $nameRows);
509
    }
510
511
    /**
512
     * Sets the status of object identified by $contentId and $version to $status.