DriverFactory::create()   A
last analyzed

Complexity

Conditions 5
Paths 5

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
eloc 11
c 1
b 0
f 0
nc 5
nop 2
dl 0
loc 17
rs 9.6111
1
<?php 
2
3
namespace Yaro\LogEnvelope\Drivers;
4
5
use Yaro\LogEnvelope\Drivers\Mail;
6
use Yaro\LogEnvelope\Drivers\Database;
7
use Yaro\LogEnvelope\Drivers\Telegram;
8
use Yaro\LogEnvelope\Drivers\Slack;
9
use Yaro\LogEnvelope\Drivers\Dummy;
10
11
class DriverFactory 
12
{
13
    
14
    public static function create($driver, $data)
15
    {
16
        switch ($driver) {
17
            case 'mail':
18
                return new Mail($data);
19
            
20
            case 'database':
21
                return new Database($data);
22
                
23
            case 'telegram':
24
                return new Telegram($data);
25
                
26
            case 'slack':
27
                return new Slack($data);
28
            
29
            default:
30
                return new Dummy($data);
31
        }
32
    } // end create
33
    
34
}
35