Completed
Push — master ( 6af878...d015d4 )
by Mikołaj
02:37
created

Model::import()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 9.4285
1
<?php
2
3
namespace Rudolf\Modules\Tools\Admin\One\DatabaseImport;
4
5
use Rudolf\Framework\Model\AdminModel;
6
7
class Model extends AdminModel
8
{
9
    public function clear()
10
    {
11
        $tables = $this->pdo->query('SHOW TABLES');
12
13
        foreach ($tables as $table) {
14
            $this->pdo->exec('DROP TABLE IF EXISTS ' . $table[0]);
15
        }
16
    }
17
18
    public function import($content)
19
    {
20
        $this->pdo->exec($content);
21
22
        return substr_count($content, ";\n") + 1;
23
    }
24
}
25