Code Duplication    Length = 20-23 lines in 2 locations

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

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

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

@@ 530-549 (lines=20) @@
527
     *
528
     * @return \eZ\Publish\SPI\Persistence\Content\VersionInfo[]
529
     */
530
    public function loadDraftsForUser($userId)
531
    {
532
        $rows = $this->contentGateway->listVersionsForUser($userId, VersionInfo::STATUS_DRAFT);
533
        if (empty($rows)) {
534
            return array();
535
        }
536
537
        $idVersionPairs = array_map(
538
            function ($row) {
539
                return array(
540
                    'id' => $row['ezcontentobject_version_contentobject_id'],
541
                    'version' => $row['ezcontentobject_version_version'],
542
                );
543
            },
544
            $rows
545
        );
546
        $nameRows = $this->contentGateway->loadVersionedNameData($idVersionPairs);
547
548
        return $this->mapper->extractVersionInfoListFromRows($rows, $nameRows);
549
    }
550
551
    /**
552
     * Sets the status of object identified by $contentId and $version to $status.