Completed
Push — master ( 79ff26...9e9048 )
by Niels
02:04
created
src/DirectAdmin/Objects/Domain.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -133,10 +133,13 @@  discard block
 block discarded – undo
133 133
             'from' => $domain,
134 134
             'action' => 'add',
135 135
         ];
136
-        if ($alias) {
136
+        if ($alias)
137
+        {
137 138
             $parameters['alias'] = 'yes';
138 139
             $list = &$this->aliases;
139
-        } else {
140
+        }
141
+        else
142
+        {
140 143
             $list = &$this->pointers;
141 144
         }
142 145
         $this->getContext()->invokeApiPost('DOMAIN_POINTER', $parameters);
@@ -301,7 +304,8 @@  discard block
 block discarded – undo
301 304
             'action' => $action,
302 305
             'domain' => $this->domainName,
303 306
         ], $parameters));
304
-        if ($clearCache) {
307
+        if ($clearCache)
308
+        {
305 309
             $this->clearCache();
306 310
         }
307 311
         return $response;
@@ -338,9 +342,12 @@  discard block
 block discarded – undo
338 342
         $this->domainName = $config['domain'];
339 343
 
340 344
         // Determine owner
341
-        if ($config['username'] === $context->getUsername()) {
345
+        if ($config['username'] === $context->getUsername())
346
+        {
342 347
             $this->owner = $context->getContextUser();
343
-        } else {
348
+        }
349
+        else
350
+        {
344 351
             throw new DirectAdminException('Could not determine relationship between context user and domain');
345 352
         }
346 353
 
Please login to merge, or discard this patch.
src/DirectAdmin/Objects/Users/User.php 1 patch
Braces   +21 added lines, -10 removed lines patch added patch discarded remove patch
@@ -43,7 +43,8 @@  discard block
 block discarded – undo
43 43
     public function __construct($name, UserContext $context, $config = null)
44 44
     {
45 45
         parent::__construct($name, $context);
46
-        if (isset($config)) {
46
+        if (isset($config))
47
+        {
47 48
             $this->setCache(self::CACHE_CONFIG, $config);
48 49
         }
49 50
     }
@@ -163,7 +164,8 @@  discard block
 block discarded – undo
163 164
      */
164 165
     public function getDefaultDomain()
165 166
     {
166
-        if (empty($name = $this->getConfig('domain'))) {
167
+        if (empty($name = $this->getConfig('domain')))
168
+        {
167 169
             return null;
168 170
         }
169 171
         return $this->getDomain($name);
@@ -206,9 +208,11 @@  discard block
 block discarded – undo
206 208
     {
207 209
         return $this->getCache(self::CACHE_DATABASES, function () {
208 210
             $databases = [];
209
-            foreach ($this->getSelfManagedContext()->invokeApiGet('DATABASES') as $fullName) {
211
+            foreach ($this->getSelfManagedContext()->invokeApiGet('DATABASES') as $fullName)
212
+            {
210 213
                 list($user, $db) = explode('_', $fullName, 2);
211
-                if ($this->getUsername() != $user) {
214
+                if ($this->getUsername() != $user)
215
+                {
212 216
                     throw new DirectAdminException('Username incorrect on database ' . $fullName);
213 217
                 }
214 218
                 $databases[$db] = new Database($db, $this, $this->getSelfManagedContext());
@@ -223,7 +227,8 @@  discard block
 block discarded – undo
223 227
      */
224 228
     public function getDomain($domainName)
225 229
     {
226
-        if (!isset($this->domains)) {
230
+        if (!isset($this->domains))
231
+        {
227 232
             $this->getDomains();
228 233
         }
229 234
         return isset($this->domains[$domainName]) ? $this->domains[$domainName] : null;
@@ -234,10 +239,14 @@  discard block
 block discarded – undo
234 239
      */
235 240
     public function getDomains()
236 241
     {
237
-        if (!isset($this->domains)) {
238
-            if (!$this->isSelfManaged()) {
242
+        if (!isset($this->domains))
243
+        {
244
+            if (!$this->isSelfManaged())
245
+            {
239 246
                 $this->domains = $this->impersonate()->getDomains();
240
-            } else {
247
+            }
248
+            else
249
+            {
241 250
                 $this->domains = BaseObject::toRichObjectArray($this->getContext()->invokeApiGet('ADDITIONAL_DOMAINS'), Domain::class, $this->getContext());
242 251
             }
243 252
         }
@@ -282,7 +291,8 @@  discard block
 block discarded – undo
282 291
     public function impersonate()
283 292
     {
284 293
         /** @var ResellerContext $context */
285
-        if (!($context = $this->getContext()) instanceof ResellerContext) {
294
+        if (!($context = $this->getContext()) instanceof ResellerContext)
295
+        {
286 296
             throw new DirectAdminException('You need to be at least a reseller to impersonate');
287 297
         }
288 298
         return $context->impersonateUser($this->getUsername());
@@ -348,7 +358,8 @@  discard block
 block discarded – undo
348 358
     public static function fromConfig($config, UserContext $context)
349 359
     {
350 360
         $name = $config['username'];
351
-        switch ($config['usertype']) {
361
+        switch ($config['usertype'])
362
+        {
352 363
             case DirectAdmin::ACCOUNT_TYPE_USER:
353 364
                 return new self($name, $context, $config);
354 365
             case DirectAdmin::ACCOUNT_TYPE_RESELLER:
Please login to merge, or discard this patch.