Completed
Push — master ( 84470e...c291b9 )
by Ron
03:30
created

ServiceDispatcherBuilder::withMySQL()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
namespace Kir\Services\Cmd\Dispatcher;
3
4
use Kir\Services\Cmd\Dispatcher\AttributeRepositories\MySQLAttributeRepository;
5
use Kir\Services\Cmd\Dispatcher\AttributeRepositories\SqliteAttributeRepository;
6
use Kir\Services\Cmd\Dispatcher\Builder\MySQLBuilder;
7
use Kir\Services\Cmd\Dispatcher\Dispatchers\DefaultDispatcher;
8
use PDO;
9
10
class ServiceDispatcherBuilder {
11
	public static function withSQLite(string $filename): DefaultDispatcher {
12
		$repos = new SqliteAttributeRepository(new PDO(sprintf('sqlite:%s', $filename)));
13
		return new DefaultDispatcher($repos);
14
	}
15
	
16
	public static function withMySQL(PDO $pdo, array $options): MySQLBuilder {
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
17
		$repos = new MySQLAttributeRepository($pdo);
18
		return new DefaultDispatcher($repos);
19
	}
20
}
21