Mysql   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 3

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createTable() 0 4 1
A showTables() 0 4 1
A header() 0 6 1
A footer() 0 6 1
1
<?php
2
/**
3
 * Webino (http://webino.sk)
4
 *
5
 * @link        https://github.com/webino/WebinoDbDump/ for the canonical source repository
6
 * @copyright   Copyright (c) 2014-2017 Webino, s. r. o. (http://webino.sk)
7
 * @license     BSD-3-Clause
8
 */
9
10
namespace WebinoDbDump\Db\Dump\Platform\Mysql;
11
12
use ArrayObject;
13
use WebinoDbDump\Db\Dump\Platform\AbstractPlatform;
14
use WebinoDbDump\Db\Dump\Platform\PlatformInterface;
15
16
/**
17
 * Mysql database dump utility platform
18
 *
19
 * @author Peter Bačinský <[email protected]>
20
 */
21
class Mysql extends AbstractPlatform implements PlatformInterface
22
{
23
    /**
24
     *
25
     */
26
    public function createTable(ArrayObject $table)
27
    {
28
        return new Table\Table(current($table), $this->adapter);
29
    }
30
31
    /**
32
     *
33
     */
34
    public function showTables()
35
    {
36
        return $this->adapter->executeQuery('SHOW TABLES');
37
    }
38
39
    /**
40
     *
41
     */
42
    public function header()
43
    {
44
        return 'SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=\'NO_AUTO_VALUE_ON_ZERO\';' . PHP_EOL
45
               . 'SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;' . PHP_EOL
46
               . PHP_EOL;
47
    }
48
49
    /**
50
     *
51
     */
52
    public function footer()
53
    {
54
        return 'SET SQL_MODE=@OLD_SQL_MODE;' . PHP_EOL
55
               . 'SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;' . PHP_EOL
56
               . PHP_EOL;
57
    }
58
}
59