Code Duplication    Length = 17-20 lines in 2 locations

eZ/Bundle/EzPublishElasticsearchSearchEngineBundle/Command/ElasticsearchCreateIndexCommand.php 2 locations

@@ 79-98 (lines=20) @@
76
        $progress = $this->getHelperSet()->get('progress');
77
        $progress->start($output, $totalCount);
78
        $i = 0;
79
        do {
80
            $contentObjects = array();
81
82
            for ($k = 0; $k <= $bulkCount; ++$k) {
83
                if (!$row = $stmt->fetch(PDO::FETCH_ASSOC)) {
84
                    break;
85
                }
86
87
                $contentObjects[] = $persistenceHandler->contentHandler()->load(
88
                    $row['id'],
89
                    $row['current_version']
90
                );
91
            }
92
93
            if (!empty($contentObjects)) {
94
                $searchHandler->bulkIndexContent($contentObjects);
95
            }
96
97
            $progress->advance($k);
98
        } while (($i += $bulkCount) < $totalCount);
99
100
        $progress->finish();
101
@@ 137-153 (lines=17) @@
134
        $progress = $this->getHelperSet()->get('progress');
135
        $progress->start($output, $totalCount);
136
        $i = 0;
137
        do {
138
            $locations = array();
139
140
            for ($k = 0; $k <= $bulkCount; ++$k) {
141
                if (!$row = $stmt->fetch(PDO::FETCH_ASSOC)) {
142
                    break;
143
                }
144
145
                $locations[] = $persistenceHandler->locationHandler()->load($row['node_id']);
146
            }
147
148
            if (!empty($locations)) {
149
                $searchHandler->bulkIndexLocations($locations);
150
            }
151
152
            $progress->advance($k);
153
        } while (($i += $bulkCount) < $totalCount);
154
155
        $progress->finish();
156
    }