Code Duplication    Length = 25-25 lines in 2 locations

lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureShardManager.php 1 location

@@ 201-225 (lines=25) @@
198
     /**
199
      * {@inheritDoc}
200
      */
201
    public function queryAll($sql, array $params = [], array $types = [])
202
    {
203
        $shards = $this->getShards();
204
        if (!$shards) {
205
            throw new \RuntimeException("No shards found for " . $this->federationName);
206
        }
207
208
        $result = [];
209
        $oldDistribution = $this->getCurrentDistributionValue();
210
211
        foreach ($shards as $shard) {
212
            $this->selectShard($shard['rangeLow']);
213
            foreach ($this->conn->fetchAll($sql, $params, $types) as $row) {
214
                $result[] = $row;
215
            }
216
        }
217
218
        if ($oldDistribution === null) {
219
            $this->selectGlobal();
220
        } else {
221
            $this->selectShard($oldDistribution);
222
        }
223
224
        return $result;
225
    }
226
227
    /**
228
     * Splits Federation at a given distribution value.

lib/Doctrine/DBAL/Sharding/PoolingShardManager.php 1 location

@@ 107-131 (lines=25) @@
104
     *
105
     * @throws \RuntimeException
106
     */
107
    public function queryAll($sql, array $params, array $types)
108
    {
109
        $shards = $this->getShards();
110
        if (!$shards) {
111
            throw new \RuntimeException("No shards found.");
112
        }
113
114
        $result = [];
115
        $oldDistribution = $this->getCurrentDistributionValue();
116
117
        foreach ($shards as $shard) {
118
            $this->conn->connect($shard['id']);
119
            foreach ($this->conn->fetchAll($sql, $params, $types) as $row) {
120
                $result[] = $row;
121
            }
122
        }
123
124
        if ($oldDistribution === null) {
125
            $this->selectGlobal();
126
        } else {
127
            $this->selectShard($oldDistribution);
128
        }
129
130
        return $result;
131
    }
132
}
133