Completed
Push — master ( 23c932...aa6457 )
by Federico
01:57
created

CallbackStrategy::isValid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Elastica\Connection\Strategy;
4
5
use Elastica\Connection;
6
7
/**
8
 * Description of CallbackStrategy.
9
 *
10
 * @author chabior
11
 */
12
class CallbackStrategy implements StrategyInterface
13
{
14
    /**
15
     * @var callable
16
     */
17
    protected $_callback;
18
19
    /**
20
     * @param callable $callback
21
     */
22
    public function __construct(callable $callback)
23
    {
24
        $this->_callback = $callback;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function getConnection(array $connections): Connection
31
    {
32
        return \call_user_func_array($this->_callback, [$connections]);
33
    }
34
}
35