Completed
Push — master ( 0d9cbc...8d7e77 )
by yuuki
02:23
created

CouchbaseConnector   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 1
c 2
b 0
f 1
lcom 1
cbo 0
dl 0
loc 25
ccs 7
cts 7
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A connect() 0 10 1
1
<?php
2
3
/**
4
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
10
 * THE SOFTWARE.
11
 */
12
13
namespace Ytake\LaravelCouchbase\Database;
14
15
/**
16
 * Class CouchbaseConnector.
17
 *
18
 * @author Yuuki Takezawa<[email protected]>
19
 */
20
class CouchbaseConnector implements Connectable
21
{
22
    /** @var array */
23
    protected $configure = [
24
        'host' => '127.0.0.1',
25
        'user' => '',
26
        'password' => '',
27
    ];
28
29
    /**
30
     * @param array $servers
31
     *
32
     * @return \CouchbaseCluster
33
     */
34 23
    public function connect(array $servers)
35
    {
36 23
        $configure = array_merge($this->configure, $servers);
37
38 23
        return new \CouchbaseCluster(
39 23
            $configure['host'],
40 23
            $configure['user'],
41 23
            $configure['password']
42 23
        );
43
    }
44
}
45