MySqlDsn   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 14
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A toString() 0 3 1
1
<?php
2
/**
3
 * This file is part of the Yep package.
4
 * Copyright (c) 2016 Martin Zeman (Zemistr) (http://www.zemistr.eu)
5
 */
6
7
namespace Yep\Dsn;
8
9
/**
10
 * Class MySQLDsn
11
 *
12
 * @package Yep\Dsn
13
 * @author  Martin Zeman (Zemistr) <[email protected]>
14
 *
15
 * PDO_MYSQL
16
 * mysql:host=localhost;dbname=testdb
17
 * mysql:host=localhost;port=3307;dbname=testdb
18
 */
19
class MySqlDsn extends BaseDns {
20 4
  public function __construct(string $dbName, string $host = 'localhost', int $port = 3306) {
21 4
    $this->setDbName($dbName);
22 4
    $this->setHost($host);
23 4
    $this->setPort($port);
24 4
  }
25
26
  /**
27
   * @return string
28
   */
29 1
  public function toString() : string {
30 1
    return 'mysql:host=' . $this->getHost() . ';dbname=' . $this->getDbName() . ';port=' . $this->getPort();
31
  }
32
}
33