@@ -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)) { |
@@ -80,60 +80,60 @@ |
||
| 80 | 80 | ]; |
| 81 | 81 | |
| 82 | 82 | if (count($this->tables) > 0) { |
| 83 | - $options['tables'] = '--tables ' . implode(' ', $this->tables); |
|
| 83 | + $options[ 'tables' ] = '--tables ' . implode(' ', $this->tables); |
|
| 84 | 84 | } |
| 85 | 85 | // Ignore Tables |
| 86 | - $ignoreTables = []; |
|
| 86 | + $ignoreTables = [ ]; |
|
| 87 | 87 | foreach ($this->ignoreTables as $tableName) { |
| 88 | - $ignoreTables[] = "--ignore-table={$this->dbName}.{$tableName}"; |
|
| 89 | - $options['ignoreTables'] = implode(' ', $ignoreTables); |
|
| 88 | + $ignoreTables[ ] = "--ignore-table={$this->dbName}.{$tableName}"; |
|
| 89 | + $options[ 'ignoreTables' ] = implode(' ', $ignoreTables); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | if ($this->singleTransaction) { |
| 93 | - $options['singleTransaction'] = '--single-transaction'; |
|
| 93 | + $options[ 'singleTransaction' ] = '--single-transaction'; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | if ($this->skipLockTables) { |
| 97 | - $options['skipLockTables'] = '--skip-lock-tables'; |
|
| 97 | + $options[ 'skipLockTables' ] = '--skip-lock-tables'; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | if ($this->quick) { |
| 101 | - $options['quick'] = '--quick'; |
|
| 101 | + $options[ 'quick' ] = '--quick'; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | if (!$this->createTables) { |
| 105 | - $options['createTables'] = '--no-create-info'; |
|
| 105 | + $options[ 'createTables' ] = '--no-create-info'; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | if ($this->skipComments) { |
| 109 | - $options['skipComments'] = '--skip-comments'; |
|
| 109 | + $options[ 'skipComments' ] = '--skip-comments'; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | if ($this->socket !== '') { |
| 113 | - $options['socket'] = "--socket={$this->socket}"; |
|
| 113 | + $options[ 'socket' ] = "--socket={$this->socket}"; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | if ($this->defaultCharacterSet) { |
| 117 | - $options['defaultCharacterSet'] = '--default-character-set=' . $this->defaultCharacterSet; |
|
| 117 | + $options[ 'defaultCharacterSet' ] = '--default-character-set=' . $this->defaultCharacterSet; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $options['authenticate'] = "--defaults-extra-file={$credentialFile}"; |
|
| 120 | + $options[ 'authenticate' ] = "--defaults-extra-file={$credentialFile}"; |
|
| 121 | 121 | |
| 122 | 122 | // Dump command |
| 123 | 123 | $dumpCommand = sprintf( |
| 124 | 124 | '%smysqldump %s %s %s %s %s %s %s %s %s %s %s', |
| 125 | 125 | $this->dumpCommandPath, |
| 126 | - $options['authenticate'], |
|
| 126 | + $options[ 'authenticate' ], |
|
| 127 | 127 | $this->dbName, |
| 128 | - $options['socket'], |
|
| 129 | - $options['skipComments'], |
|
| 130 | - $options['createTables'], |
|
| 131 | - $options['singleTransaction'], |
|
| 132 | - $options['skipLockTables'], |
|
| 133 | - $options['quick'], |
|
| 134 | - $options['defaultCharacterSet'], |
|
| 135 | - $options['tables'], |
|
| 136 | - $options['ignoreTables'] |
|
| 128 | + $options[ 'socket' ], |
|
| 129 | + $options[ 'skipComments' ], |
|
| 130 | + $options[ 'createTables' ], |
|
| 131 | + $options[ 'singleTransaction' ], |
|
| 132 | + $options[ 'skipLockTables' ], |
|
| 133 | + $options[ 'quick' ], |
|
| 134 | + $options[ 'defaultCharacterSet' ], |
|
| 135 | + $options[ 'tables' ], |
|
| 136 | + $options[ 'ignoreTables' ] |
|
| 137 | 137 | ); |
| 138 | 138 | // Add compressor if compress is enable |
| 139 | 139 | if ($this->isCompress) { |
@@ -60,57 +60,57 @@ |
||
| 60 | 60 | ]; |
| 61 | 61 | // Database |
| 62 | 62 | if (!empty($this->dbName)) { |
| 63 | - $options['database'] = "--db {$this->dbName}"; |
|
| 63 | + $options[ 'database' ] = "--db {$this->dbName}"; |
|
| 64 | 64 | } |
| 65 | 65 | // Username |
| 66 | 66 | if (!empty($this->username)) { |
| 67 | - $options['username'] = "--username {$this->username}"; |
|
| 67 | + $options[ 'username' ] = "--username {$this->username}"; |
|
| 68 | 68 | } |
| 69 | 69 | //Password |
| 70 | 70 | if (!empty($this->password)) { |
| 71 | - $options['password'] = "--password {$this->password}"; |
|
| 71 | + $options[ 'password' ] = "--password {$this->password}"; |
|
| 72 | 72 | } |
| 73 | 73 | // Host |
| 74 | 74 | if (!empty($this->host)) { |
| 75 | - $options['host'] = "--host {$this->host}"; |
|
| 75 | + $options[ 'host' ] = "--host {$this->host}"; |
|
| 76 | 76 | } |
| 77 | 77 | // Port |
| 78 | 78 | if (!empty($this->port)) { |
| 79 | - $options['port'] = "--port {$this->port}"; |
|
| 79 | + $options[ 'port' ] = "--port {$this->port}"; |
|
| 80 | 80 | } |
| 81 | 81 | // Collection |
| 82 | 82 | if (!empty($this->collection)) { |
| 83 | - $options['collection'] = "--collection {$this->collection}"; |
|
| 83 | + $options[ 'collection' ] = "--collection {$this->collection}"; |
|
| 84 | 84 | } |
| 85 | 85 | // Authentication Database |
| 86 | 86 | if (!empty($this->authenticationDatabase)) { |
| 87 | - $options[] = "--authenticationDatabase {$this->authenticationDatabase}"; |
|
| 87 | + $options[ ] = "--authenticationDatabase {$this->authenticationDatabase}"; |
|
| 88 | 88 | } |
| 89 | 89 | // Archive |
| 90 | 90 | if ($this->isCompress) { |
| 91 | - $options['archive'] = "--archive --gzip"; |
|
| 91 | + $options[ 'archive' ] = "--archive --gzip"; |
|
| 92 | 92 | } |
| 93 | 93 | // Dump Command |
| 94 | 94 | $dumpCommand = sprintf( |
| 95 | 95 | '%smongodump %s %s %s %s %s %s %s %s', |
| 96 | 96 | $this->dumpCommandPath, |
| 97 | - $options['archive'], |
|
| 98 | - $options['database'], |
|
| 99 | - $options['username'], |
|
| 100 | - $options['password'], |
|
| 101 | - $options['host'], |
|
| 102 | - $options['port'], |
|
| 103 | - $options['collection'], |
|
| 104 | - $options['authenticationDatabase'] |
|
| 97 | + $options[ 'archive' ], |
|
| 98 | + $options[ 'database' ], |
|
| 99 | + $options[ 'username' ], |
|
| 100 | + $options[ 'password' ], |
|
| 101 | + $options[ 'host' ], |
|
| 102 | + $options[ 'port' ], |
|
| 103 | + $options[ 'collection' ], |
|
| 104 | + $options[ 'authenticationDatabase' ] |
|
| 105 | 105 | ); |
| 106 | 106 | // Generate dump command from uri |
| 107 | 107 | if ($this->uri) { |
| 108 | 108 | $dumpCommand = sprintf( |
| 109 | 109 | '%smongodump %s --uri %s %s', |
| 110 | 110 | $this->dumpCommandPath, |
| 111 | - $options['archive'], |
|
| 111 | + $options[ 'archive' ], |
|
| 112 | 112 | $this->uri, |
| 113 | - $options['collection'] |
|
| 113 | + $options[ 'collection' ] |
|
| 114 | 114 | ); |
| 115 | 115 | } |
| 116 | 116 | |