@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | { |
11 | 11 | use DumperTrait; |
12 | 12 | |
13 | - public function __construct(array $options = []) |
|
13 | + public function __construct(array $options = [ ]) |
|
14 | 14 | { |
15 | 15 | foreach ($options as $option => $value) { |
16 | 16 | if (property_exists($this, $option)) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @return $this |
23 | 23 | */ |
24 | - public static function create(array $options = []) |
|
24 | + public static function create(array $options = [ ]) |
|
25 | 25 | { |
26 | 26 | return new static($options); |
27 | 27 | } |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | /*@var int*/ |
22 | 22 | protected $timeout = 0; |
23 | 23 | /*@var array*/ |
24 | - protected $tables = []; |
|
24 | + protected $tables = [ ]; |
|
25 | 25 | /*@var array*/ |
26 | - protected $ignoreTables = []; |
|
26 | + protected $ignoreTables = [ ]; |
|
27 | 27 | /*@var string*/ |
28 | 28 | protected $destinationPath = 'dump.sql'; |
29 | 29 | /*@var string*/ |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | if (is_string($tables)) { |
104 | - $tables = [$tables]; |
|
104 | + $tables = [ $tables ]; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | if (!is_array($tables)) { |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | if (is_string($tables)) { |
127 | - $tables = [$tables]; |
|
127 | + $tables = [ $tables ]; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | if (!is_array($tables)) { |
@@ -67,60 +67,60 @@ |
||
67 | 67 | |
68 | 68 | protected function prepareDumpCommand(string $credentialFile, string $destinationPath): string |
69 | 69 | { |
70 | - $options = []; |
|
70 | + $options = [ ]; |
|
71 | 71 | |
72 | 72 | if (count($this->tables) > 0) { |
73 | - $options['tables'] = '--tables ' . implode(' ', $this->tables); |
|
73 | + $options[ 'tables' ] = '--tables ' . implode(' ', $this->tables); |
|
74 | 74 | } |
75 | 75 | // Ignore Tables |
76 | - $ignoreTables = []; |
|
76 | + $ignoreTables = [ ]; |
|
77 | 77 | foreach ($this->ignoreTables as $tableName) { |
78 | - $ignoreTables[] = "--ignore-table=" . $databaseArg . "." . $tableName; |
|
79 | - $options['ignoreTables'] = implode(' ', $ignoreTables); |
|
78 | + $ignoreTables[ ] = "--ignore-table=" . $databaseArg . "." . $tableName; |
|
79 | + $options[ 'ignoreTables' ] = implode(' ', $ignoreTables); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | if ($this->singleTransaction) { |
83 | - $options['singleTransaction'] = '--single-transaction'; |
|
83 | + $options[ 'singleTransaction' ] = '--single-transaction'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | if ($this->skipLockTables) { |
87 | - $options['skipLockTables'] = '--skip-lock-tables'; |
|
87 | + $options[ 'skipLockTables' ] = '--skip-lock-tables'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | if ($this->quick) { |
91 | - $options['quick'] = '--quick'; |
|
91 | + $options[ 'quick' ] = '--quick'; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | if (!$this->createTables) { |
95 | - $options['createTables'] = '--no-create-info'; |
|
95 | + $options[ 'createTables' ] = '--no-create-info'; |
|
96 | 96 | } |
97 | 97 | if ($this->skipComments) { |
98 | - $options['skipComments'] = '--skip-comments'; |
|
98 | + $options[ 'skipComments' ] = '--skip-comments'; |
|
99 | 99 | } |
100 | 100 | if ($this->socket !== '') { |
101 | - $options['socket'] = "--socket={$this->socket}"; |
|
101 | + $options[ 'socket' ] = "--socket={$this->socket}"; |
|
102 | 102 | } |
103 | 103 | if ($this->defaultCharacterSet) { |
104 | - $options['defaultCharacterSet'] = '--default-character-set=' . $this->defaultCharacterSet; |
|
104 | + $options[ 'defaultCharacterSet' ] = '--default-character-set=' . $this->defaultCharacterSet; |
|
105 | 105 | } |
106 | 106 | |
107 | - $options['authenticate'] = "--defaults-extra-file={$credentialFile}"; |
|
107 | + $options[ 'authenticate' ] = "--defaults-extra-file={$credentialFile}"; |
|
108 | 108 | |
109 | 109 | // Dump command |
110 | 110 | $dumpCommand = sprintf( |
111 | 111 | '%smysqldump %s %s %s %s %s %s %s %s %s %s %s', |
112 | 112 | $this->dumpCommandPath, |
113 | - $options['authenticate'] ?? "", |
|
113 | + $options[ 'authenticate' ] ?? "", |
|
114 | 114 | $this->dbName, |
115 | - $options['socket'] ?? "", |
|
116 | - $options['skipComments'] ?? "", |
|
117 | - $options['createTables'] ?? "", |
|
118 | - $options['singleTransaction'] ?? "", |
|
119 | - $options['skipLockTables'] ?? "", |
|
120 | - $options['quick'] ?? "", |
|
121 | - $options['defaultCharacterSet'] ?? "", |
|
122 | - $options['tables'] ?? "", |
|
123 | - $options['ignoreTables'] ?? "" |
|
115 | + $options[ 'socket' ] ?? "", |
|
116 | + $options[ 'skipComments' ] ?? "", |
|
117 | + $options[ 'createTables' ] ?? "", |
|
118 | + $options[ 'singleTransaction' ] ?? "", |
|
119 | + $options[ 'skipLockTables' ] ?? "", |
|
120 | + $options[ 'quick' ] ?? "", |
|
121 | + $options[ 'defaultCharacterSet' ] ?? "", |
|
122 | + $options[ 'tables' ] ?? "", |
|
123 | + $options[ 'ignoreTables' ] ?? "" |
|
124 | 124 | ); |
125 | 125 | // Add compressor if compress is enable |
126 | 126 | if ($this->isCompress) { |