Random::getConnection()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Manticoresearch\Connection\Strategy;
4
5
use Manticoresearch\Connection;
6
7
/**
8
 * Class Random
9
 * @package Manticoresearch\Connection\Strategy
10
 */
11
class Random implements SelectorInterface
12
{
13
    /**
14
     * @param array $connections
15
     * @return Connection
16
     */
17
    public function getConnection(array $connections):Connection
18
    {
19
        shuffle($connections);
20
        return $connections[0];
21
    }
22
}
23