Browse Source

Minor changes

Visman 1 year ago
parent
commit
e88121236c
7 changed files with 27 additions and 14 deletions
  1. 1 0
      .gitignore
  2. 0 1
      app/Controllers/Primary.php
  3. 0 1
      app/Controllers/Routing.php
  4. 14 6
      app/Core/Config.php
  5. 2 0
      app/Core/DB.php
  6. 7 2
      app/Core/ErrorHandler.php
  7. 3 4
      app/Core/Mail.php

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
+/_*
 /.htaccess
 /index.php
 /app/config/main.php

+ 0 - 1
app/Controllers/Primary.php

@@ -46,7 +46,6 @@ class Primary
             $confChange = [
                 'multiple' => [
                     'CtrlRouting' => \ForkBB\Controllers\Update::class,
-
                     'AdminUpdate' => \ForkBB\Models\Pages\Admin\Update::class,
                 ],
             ];

+ 0 - 1
app/Controllers/Routing.php

@@ -639,7 +639,6 @@ class Routing
                 'Moderate:action',
                 'Moderate'
             );
-
         }
 
         // только админ

+ 14 - 6
app/Core/Config.php

@@ -172,6 +172,7 @@ class Config
                 switch ($type) {
                     case 'ZERO':
                         $type = 'NEW';
+
                         break;
                     case 'NEW':
                     case '=>':
@@ -180,6 +181,7 @@ class Config
                         $value_before    = $other;
                         $other           = '';
                         $type            = 'VALUE';
+
                         break;
                     default:
                         throw new ForkException('Config array cannot be parsed (3)');
@@ -219,6 +221,7 @@ class Config
                     case 'VALUE':
                     case 'VALUE_OR_KEY':
                         $type = 'NEW';
+
                         break;
                     default:
                         throw new ForkException('Config array cannot be parsed (6)');
@@ -234,6 +237,7 @@ class Config
                         $value        = null;
                         $value_before = '';
                         $type         = '=>';
+
                         break;
                     default:
                         throw new ForkException('Config array cannot be parsed (7)');
@@ -251,7 +255,8 @@ class Config
                     case 'VALUE_OR_KEY':
                     case 'VALUE':
                     case '=>':
-                            $other .= $token;
+                        $other .= $token;
+
                         break;
                     default:
                         throw new ForkException('Config array cannot be parsed (8)');
@@ -291,9 +296,11 @@ class Config
                         }
 
                         $type = 'VALUE_OR_KEY';
+
                         break;
                     case '=>':
                         $type = 'VALUE';
+
                         break;
                     default:
                         throw new ForkException('Config array cannot be parsed (10)');
@@ -311,11 +318,11 @@ class Config
     protected function isFormat(mixed $data): bool
     {
         return \is_array($data)
-        && \array_key_exists('value', $data)
-        && \array_key_exists('value_before', $data)
-        && \array_key_exists('value_after', $data)
-        && \array_key_exists('key_before', $data)
-        && \array_key_exists('key_after', $data);
+            && \array_key_exists('value', $data)
+            && \array_key_exists('value_before', $data)
+            && \array_key_exists('value_after', $data)
+            && \array_key_exists('key_before', $data)
+            && \array_key_exists('key_after', $data);
     }
 
     /**
@@ -429,6 +436,7 @@ class Config
             return false;
         } else {
             $result = $config[$key];
+
             unset($config[$key]);
 
             return $result;

+ 2 - 0
app/Core/DB.php

@@ -226,10 +226,12 @@ class DB
                     case 's':
                     case 'f':
                         $value = [1];
+
                         break;
                     default:
                         $value = [1];
                         $type  = 's';
+
                         break;
                 }
 

+ 7 - 2
app/Core/ErrorHandler.php

@@ -67,8 +67,8 @@ class ErrorHandler
         \set_error_handler([$this, 'errorHandler'], \E_ALL);
         \set_exception_handler([$this, 'exceptionHandler']);
         \register_shutdown_function([$this, 'shutdownHandler']);
-
         \ob_start();
+
         $this->obLevel = \ob_get_level();
     }
 
@@ -198,6 +198,7 @@ class ErrorHandler
                 if (isset($error['exception'])) {
                     $context['exception'] = $error['exception'];
                 }
+
                 $context['headers'] = false;
 
                 $this->c->Log->{$method}($this->message($error), $context);
@@ -279,15 +280,19 @@ EOT;
                             switch ($type) {
                                 case 'boolean':
                                     $type = $arg ? 'true' : 'false';
+
                                     break;
                                 case 'array':
                                     $type .= '(' . \count($arg) . ')';
+
                                     break;
                                 case 'resource':
                                     $type = \get_resource_type($arg);
+
                                     break;
                                 case 'object':
                                     $type .= '{' . \get_class($arg) . '}';
+
                                     break;
                             }
 
@@ -296,8 +301,8 @@ EOT;
                         }
                     }
                     $line .= ')';
+                    $line  = $this->e(\str_replace($this->hidePath, '...', $line));
 
-                    $line = $this->e(\str_replace($this->hidePath, '...', $line));
                     echo "<li>{$line}</li>";
                 }
 

+ 3 - 4
app/Core/Mail.php

@@ -37,7 +37,7 @@ class Mail
 
     public function __construct(string $host, string $user, #[SensitiveParameter] string $pass, int $ssl, string $eol, protected Container $c)
     {
-        if ('' != $host) {
+        if ('' !== $host) {
             $hp = \explode(':', $host, 2);
 
             if (
@@ -103,11 +103,10 @@ class Mail
             return false;
         }
 
-
-        if ($strict) {
+        if (true === $strict) {
             $level = $this->c->ErrorHandler->logOnly(\E_WARNING);
 
-            if ($ip) {
+            if (\is_string($ip)) {
                 $mx = \checkdnsrr($ip, 'MX'); // ipv6 в пролёте :(
             } else {
                 $mx = \dns_get_record($domainASCII, \DNS_MX);