DriverFactory   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 17 5
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