Completed
Push — master ( 5e6003...ff6361 )
by Matthew
03:07
created

DatabaseDataServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 14 1
1
<?php
2
3
namespace Ps2alerts\Api\ServiceProvider;
4
5
use Aura\Sql\ExtendedPdo;
6
use League\Container\ServiceProvider;
7
8
class DatabaseDataServiceProvider extends ServiceProvider
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    /**
11
     * @var array
12
     */
13
    protected $provides = [
14
        'Database\Data'
15
    ];
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function register()
21
    {
22
        $this->getContainer()->singleton('Database\Data', function () {
23
            $config = $this->getContainer()->get('config')['database_data'];
24
25
            $pdo = new ExtendedPdo(
26
                "mysql:host={$config['host']};dbname={$config['schema']}",
27
                $config['user'],
28
                $config['password']
29
            );
30
31
            return $pdo;
32
        });
33
    }
34
}
35