Completed
Pull Request — master (#148)
by
unknown
02:18
created

DoctrineMongoDb   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 19
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A check() 0 7 1
1
<?php
2
3
namespace Liip\MonitorBundle\Check;
4
5
use Doctrine\Bundle\MongoDBBundle\ManagerRegistry;
6
use ZendDiagnostics\Check\AbstractCheck;
7
use ZendDiagnostics\Result\Success;
8
9
class DoctrineMongoDb extends AbstractCheck
10
{
11
    protected $manager;
12
    protected $connectionName;
13
14
    public function __construct(ManagerRegistry $registry, $connectionName = null)
15
    {
16
        $this->manager = $registry;
17
        $this->connectionName = $connectionName;
18
    }
19
20
    public function check()
21
    {
22
        $connection = $this->manager->getConnection();
23
        $connection->connect();
24
25
        return new Success();
26
    }
27
}
28