@@ -32,10 +32,10 @@ function getDirectAdminConfig()
3232{
3333 $ config = get ('directadmin ' , []);
3434
35- if (!is_array ($ config ) ||
36- !isset ($ config ['host ' ]) ||
37- !isset ($ config ['username ' ]) ||
38- !isset ($ config ['password ' ])) {
35+ if (!is_array ($ config )
36+ || !isset ($ config ['host ' ])
37+ || !isset ($ config ['username ' ])
38+ || !isset ($ config ['password ' ])) {
3939 throw new \RuntimeException ("Please set the following DirectAdmin config: " . PHP_EOL . "set('directadmin', ['host' => '127.0.0.1', 'port' => 2222, 'username' => 'admin', 'password' => 'password']); " );
4040 }
4141
@@ -76,10 +76,9 @@ function DirectAdmin(string $action, array $data = [])
7676task ('directadmin:createdb ' , function () {
7777 $ config = getDirectAdminConfig ();
7878
79- if (!is_array ($ config ) ||
80- !isset ($ config ['db_name ' ]) ||
81- !isset ($ config ['db_user ' ]) ||
82- !isset ($ config ['db_password ' ])) {
79+ if (!isset ($ config ['db_name ' ])
80+ || !isset ($ config ['db_user ' ])
81+ || !isset ($ config ['db_password ' ])) {
8382 throw new \RuntimeException ("Please add the following DirectAdmin config: " . PHP_EOL . "add('directadmin', ['db_name' => 'test', 'db_user' => 'test', 'db_password' => '123456']); " );
8483 }
8584
@@ -96,8 +95,7 @@ function DirectAdmin(string $action, array $data = [])
9695task ('directadmin:deletedb ' , function () {
9796 $ config = getDirectAdminConfig ();
9897
99- if (!is_array ($ config ) ||
100- !isset ($ config ['db_user ' ])) {
98+ if (!isset ($ config ['db_user ' ])) {
10199 throw new \RuntimeException ("Please add the following DirectAdmin config: " . PHP_EOL . "add('directadmin', ['db_user' => 'test_database']); " );
102100 }
103101
@@ -111,8 +109,7 @@ function DirectAdmin(string $action, array $data = [])
111109task ('directadmin:createdomain ' , function () {
112110 $ config = getDirectAdminConfig ();
113111
114- if (!is_array ($ config ) ||
115- !isset ($ config ['domain_name ' ])) {
112+ if (!isset ($ config ['domain_name ' ])) {
116113 throw new \RuntimeException ("Please add the following DirectAdmin config: " . PHP_EOL . "add('directadmin', ['domain_name' => 'test.example.com']); " );
117114 }
118115
@@ -129,8 +126,7 @@ function DirectAdmin(string $action, array $data = [])
129126task ('directadmin:deletedomain ' , function () {
130127 $ config = getDirectAdminConfig ();
131128
132- if (!is_array ($ config ) ||
133- !isset ($ config ['domain_name ' ])) {
129+ if (!isset ($ config ['domain_name ' ])) {
134130 throw new \RuntimeException ("Please add the following DirectAdmin config: " . PHP_EOL . "add('directadmin', ['domain_name' => 'test.example.com']); " );
135131 }
136132
@@ -145,8 +141,7 @@ function DirectAdmin(string $action, array $data = [])
145141task ('directadmin:symlink-private-html ' , function () {
146142 $ config = getDirectAdminConfig ();
147143
148- if (!is_array ($ config ) ||
149- !isset ($ config ['domain_name ' ])) {
144+ if (!isset ($ config ['domain_name ' ])) {
150145 throw new \RuntimeException ("Please add the following DirectAdmin config: " . PHP_EOL . "add('directadmin', ['domain_name' => 'test.example.com']); " );
151146 }
152147
@@ -161,9 +156,8 @@ function DirectAdmin(string $action, array $data = [])
161156task ('directadmin:php-version ' , function () {
162157 $ config = getDirectAdminConfig ();
163158
164- if (!is_array ($ config ) ||
165- !isset ($ config ['domain_name ' ]) ||
166- !isset ($ config ['domain_php_version ' ])) {
159+ if (!isset ($ config ['domain_name ' ])
160+ || !isset ($ config ['domain_php_version ' ])) {
167161 throw new \RuntimeException ("Please add the following DirectAdmin config: " . PHP_EOL . "add('directadmin', ['domain_name' => 'test.example.com', 'domain_php_version' => 1]); " );
168162 }
169163
0 commit comments