ExportTrait::exportDatabases()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Lagdo\DbAdmin\Db\Driver\Facades;
4
5
/**
6
 * Facade to export functions
7
 */
8
trait ExportTrait
9
{
10
    use AbstractTrait;
11
12
    /**
13
     * Get the facade
14
     *
15
     * @return ExportFacade
16
     */
17
    protected function exportFacade(): ExportFacade
18
    {
19
        return $this->di()->g(ExportFacade::class);
20
    }
21
22
    /**
23
     * Get data for export
24
     *
25
     * @return array
26
     */
27
    public function getExportOptions(): array
28
    {
29
        $this->connectToDatabase();
30
        $this->breadcrumbs(true)->item($this->utils->trans->lang('Export'));
31
        return $this->exportFacade()->getExportOptions($this->dbName);
32
    }
33
34
    /**
35
     * @return array
36
     */
37
    public function getSelectValues(): array
38
    {
39
        $this->connectToServer();
40
        return $this->exportFacade()->getSelectValues();
41
    }
42
43
    /**
44
     * Export databases
45
     * The databases and tables parameters are array where the keys are names and the values
46
     * are boolean which indicate whether the corresponding data should be exported too.
47
     *
48
     * @param array  $databases     The databases to dump
49
     * @param array  $dumpOptions   The export options
50
     *
51
     * @return array|string
52
     */
53
    public function exportDatabases(array $databases, array $dumpOptions)
54
    {
55
        $this->connectToServer();
56
        return $this->exportFacade()->exportDatabases($databases, $dumpOptions);
57
    }
58
}
59