改名
This commit is contained in:
@@ -12,7 +12,7 @@ namespace Database\Base;
|
||||
|
||||
use ArrayIterator;
|
||||
use Database\ActiveQuery;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use ReflectionException;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Database\ActiveRecord;
|
||||
@@ -55,7 +55,7 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
#[Pure] public function getLength(): int
|
||||
public function getLength(): int
|
||||
{
|
||||
return count($this->_item);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace Database;
|
||||
|
||||
use Database\Base\AbstractCollection;
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
/**
|
||||
* Class Collection
|
||||
@@ -80,7 +79,7 @@ class Collection extends AbstractCollection
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
#[Pure] public function slice($start = 0, $length = 20): array
|
||||
public function slice($start = 0, $length = 20): array
|
||||
{
|
||||
if (empty($this->_item) || !is_array($this->_item)) {
|
||||
return [];
|
||||
@@ -128,7 +127,7 @@ class Collection extends AbstractCollection
|
||||
/**
|
||||
* @return ActiveRecord|array
|
||||
*/
|
||||
#[Pure] public function current(): ActiveRecord|array
|
||||
public function current(): ActiveRecord|array
|
||||
{
|
||||
return current($this->_item);
|
||||
}
|
||||
@@ -136,7 +135,7 @@ class Collection extends AbstractCollection
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
#[Pure] public function size(): int
|
||||
public function size(): int
|
||||
{
|
||||
return (int)count($this->_item);
|
||||
}
|
||||
@@ -240,7 +239,7 @@ class Collection extends AbstractCollection
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public function isEmpty(): bool
|
||||
public function isEmpty(): bool
|
||||
{
|
||||
return $this->size() < 1;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Database\Condition;
|
||||
use Database\ActiveQuery;
|
||||
use Database\Base\ConditionClassMap;
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Core\Str;
|
||||
use Snowflake\Snowflake;
|
||||
|
||||
@@ -59,7 +59,7 @@ class ArrayCondition extends Condition
|
||||
* @param $value
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] private function isMath($value): bool
|
||||
private function isMath($value): bool
|
||||
{
|
||||
return isset($value[0]) && in_array($value[0], $this->math);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
namespace Database\Condition;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Abstracts\BaseObject;
|
||||
use Snowflake\Core\Str;
|
||||
|
||||
@@ -127,7 +127,7 @@ abstract class Condition extends BaseObject
|
||||
* @param string $oprea
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public function typeBuilder($column, $value = null, $oprea = '='): string
|
||||
public function typeBuilder($column, $value = null, $oprea = '='): string
|
||||
{
|
||||
if (is_numeric($value)) {
|
||||
if ($value != (int)$value) {
|
||||
|
||||
@@ -11,7 +11,7 @@ declare(strict_types=1);
|
||||
namespace Database;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use ReflectionException;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Database\Mysql\Schema;
|
||||
@@ -152,7 +152,7 @@ class Connection extends Component
|
||||
* @param $sql
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public function isWrite($sql): bool
|
||||
public function isWrite($sql): bool
|
||||
{
|
||||
if (empty($sql)) return false;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ declare(strict_types=1);
|
||||
namespace Database\Mysql;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Database\Connection;
|
||||
use Exception;
|
||||
@@ -163,7 +163,7 @@ class Columns extends Component
|
||||
* @param $format
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public function isInt($format): bool
|
||||
public function isInt($format): bool
|
||||
{
|
||||
return in_array($format, ['int', 'bigint', 'tinyint', 'smallint', 'mediumint']);
|
||||
}
|
||||
@@ -172,7 +172,7 @@ class Columns extends Component
|
||||
* @param $format
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public function isFloat($format): bool
|
||||
public function isFloat($format): bool
|
||||
{
|
||||
return in_array($format, ['float', 'double', 'decimal']);
|
||||
}
|
||||
@@ -181,7 +181,7 @@ class Columns extends Component
|
||||
* @param $format
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public function isJson($format): bool
|
||||
public function isJson($format): bool
|
||||
{
|
||||
return in_array($format, ['json']);
|
||||
}
|
||||
@@ -190,7 +190,7 @@ class Columns extends Component
|
||||
* @param $format
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public function isString($format): bool
|
||||
public function isString($format): bool
|
||||
{
|
||||
return in_array($format, ['varchar', 'char', 'text', 'longtext', 'tinytext', 'mediumtext']);
|
||||
}
|
||||
@@ -232,7 +232,7 @@ class Columns extends Component
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Pure] public function getFirstPrimary(): array|string|null
|
||||
public function getFirstPrimary(): array|string|null
|
||||
{
|
||||
if (isset($this->_auto_increment[$this->table])) {
|
||||
return $this->_auto_increment[$this->table];
|
||||
|
||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
namespace Database\Orm;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Abstracts\BaseObject;
|
||||
use Database\ActiveQuery;
|
||||
use Exception;
|
||||
@@ -206,7 +206,7 @@ class Change extends BaseObject
|
||||
* @return string
|
||||
* 构建SQL语句
|
||||
*/
|
||||
#[Pure] private function inserts($table, $fields, $data): string
|
||||
private function inserts($table, $fields, $data): string
|
||||
{
|
||||
$query = [
|
||||
'INSERT IGNORE INTO', '%s', '(%s)', 'VALUES %s'
|
||||
|
||||
@@ -3,7 +3,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Database\Orm;
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use ReflectionException;
|
||||
use Snowflake\Core\JSON;
|
||||
use Snowflake\Core\Str;
|
||||
@@ -61,7 +61,7 @@ trait Condition
|
||||
* @param $join
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] private function builderJoin($join): string
|
||||
private function builderJoin($join): string
|
||||
{
|
||||
if (!empty($join)) {
|
||||
return ' ' . implode(' ', $join);
|
||||
|
||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
namespace Database\Orm;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Abstracts\BaseObject;
|
||||
use Database\ActiveQuery;
|
||||
use Database\Sql;
|
||||
@@ -79,7 +79,7 @@ class Select extends BaseObject
|
||||
* @param bool $isCount
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] private function builderSelect($select = NULL, $isCount = false): string
|
||||
private function builderSelect($select = NULL, $isCount = false): string
|
||||
{
|
||||
if ($isCount === true) {
|
||||
return 'SELECT COUNT(*)';
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ use Database\Connection;
|
||||
use Database\Db;
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\ArrayShape;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Abstracts\Input;
|
||||
use Snowflake\Exception\ComponentException;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
@@ -304,7 +304,7 @@ class Gii
|
||||
* @return string
|
||||
* 暂时不知道干嘛用的
|
||||
*/
|
||||
#[Pure] private function createSetFunc($field, $comment): string
|
||||
private function createSetFunc($field, $comment): string
|
||||
{
|
||||
return '
|
||||
' . str_pad('\'' . $field . '\'', 20, ' ', STR_PAD_RIGHT) . '=> \'' . (empty($comment) ? ucfirst($field) : $comment) . '\',';
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ namespace Gii;
|
||||
|
||||
use Database\Connection;
|
||||
use JetBrains\PhpStorm\ArrayShape;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use ReflectionClass;
|
||||
use Snowflake\Abstracts\Input;
|
||||
|
||||
@@ -219,7 +219,7 @@ abstract class GiiBase
|
||||
* @param $val
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] protected function checkIsRequired($val): string
|
||||
protected function checkIsRequired($val): string
|
||||
{
|
||||
return strtolower($val['Null']) == 'no' && $val['Default'] === NULL ? 'true' : 'false';
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace HttpServer;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Abstracts\Input;
|
||||
use Snowflake\Exception\ComponentException;
|
||||
use Snowflake\Snowflake;
|
||||
@@ -111,7 +111,7 @@ trait Action
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] private function getWorkerPath(): string
|
||||
private function getWorkerPath(): string
|
||||
{
|
||||
return "glob://" . ltrim(APP_PATH, '/') . '/storage/worker/*.sock';
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ declare(strict_types=1);
|
||||
namespace HttpServer\Client;
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Swoole\Coroutine\Http\Client as SClient;
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ class Client extends ClientAbstracts
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[Pure] private function settings(): array
|
||||
private function settings(): array
|
||||
{
|
||||
$sslCert = $this->getSslCertFile();
|
||||
$sslKey = $this->getSslKeyFile();
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace HttpServer\Client;
|
||||
|
||||
use Closure;
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Core\Help;
|
||||
use Snowflake\Core\JSON;
|
||||
@@ -58,7 +58,7 @@ abstract class ClientAbstracts extends Component implements IClient
|
||||
/**
|
||||
* @return static
|
||||
*/
|
||||
#[Pure] public static function NewRequest(): static
|
||||
public static function NewRequest(): static
|
||||
{
|
||||
return new static();
|
||||
}
|
||||
@@ -415,7 +415,7 @@ abstract class ClientAbstracts extends Component implements IClient
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
#[Pure] public function getPort(): int
|
||||
public function getPort(): int
|
||||
{
|
||||
if ($this->isSSL()) {
|
||||
return 443;
|
||||
@@ -512,7 +512,7 @@ abstract class ClientAbstracts extends Component implements IClient
|
||||
* @param $url
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] protected function isHttp($url): bool
|
||||
protected function isHttp($url): bool
|
||||
{
|
||||
return str_starts_with($url, 'http://');
|
||||
}
|
||||
@@ -521,7 +521,7 @@ abstract class ClientAbstracts extends Component implements IClient
|
||||
* @param $url
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] protected function isHttps($url): bool
|
||||
protected function isHttps($url): bool
|
||||
{
|
||||
return str_starts_with($url, 'https://');
|
||||
}
|
||||
@@ -673,7 +673,7 @@ abstract class ClientAbstracts extends Component implements IClient
|
||||
* @return bool
|
||||
* check isPost Request
|
||||
*/
|
||||
#[Pure] public function isPost(): bool
|
||||
public function isPost(): bool
|
||||
{
|
||||
return strtolower($this->method) === self::POST;
|
||||
}
|
||||
@@ -684,7 +684,7 @@ abstract class ClientAbstracts extends Component implements IClient
|
||||
*
|
||||
* check isGet Request
|
||||
*/
|
||||
#[Pure] public function isGet(): bool
|
||||
public function isGet(): bool
|
||||
{
|
||||
return strtolower($this->method) === self::GET;
|
||||
}
|
||||
@@ -695,7 +695,7 @@ abstract class ClientAbstracts extends Component implements IClient
|
||||
* @return array|string
|
||||
* 将请求参数进行编码
|
||||
*/
|
||||
#[Pure] protected function paramEncode($arr): array|string
|
||||
protected function paramEncode($arr): array|string
|
||||
{
|
||||
if (!is_array($arr)) {
|
||||
return $arr;
|
||||
@@ -761,7 +761,7 @@ abstract class ClientAbstracts extends Component implements IClient
|
||||
* @param $params
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] protected function joinGetParams($path, $params): string
|
||||
protected function joinGetParams($path, $params): string
|
||||
{
|
||||
if (empty($params)) {
|
||||
return $path;
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace HttpServer\Client;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
|
||||
/**
|
||||
* Class Curl
|
||||
@@ -209,7 +209,7 @@ class Curl extends ClientAbstracts
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[Pure] private function parseHeaderMat(): array
|
||||
private function parseHeaderMat(): array
|
||||
{
|
||||
$headers = [];
|
||||
foreach ($this->getHeader() as $key => $val) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
namespace HttpServer\Client;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Snowflake;
|
||||
use Swoole\Coroutine;
|
||||
@@ -29,7 +29,7 @@ class HttpClient extends Component
|
||||
/**
|
||||
* @return Http2
|
||||
*/
|
||||
#[Pure] public static function http2(): Http2
|
||||
public static function http2(): Http2
|
||||
{
|
||||
return Snowflake::app()->http2;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
namespace HttpServer\Client;
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
|
||||
/**
|
||||
* Class Result
|
||||
@@ -143,7 +143,7 @@ class Result
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public function httpIsOk(): bool
|
||||
public function httpIsOk(): bool
|
||||
{
|
||||
return in_array($this->httpStatus, [100, 101, 200, 201, 202, 203, 204, 205, 206]);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ declare(strict_types=1);
|
||||
namespace HttpServer\Exception;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ class AuthException extends \Exception
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
#[Pure] public function __construct($message = "", $code = 0, Throwable $previous = NULL)
|
||||
public function __construct($message = "", $code = 0, Throwable $previous = NULL)
|
||||
{
|
||||
parent::__construct($message, 7000, $previous);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
namespace HttpServer\Exception;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
@@ -20,7 +20,7 @@ class ExitException extends \Exception
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
#[Pure] public function __construct($message = "", $code = 0, Throwable $previous = null)
|
||||
public function __construct($message = "", $code = 0, Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace HttpServer\Http;
|
||||
use Exception;
|
||||
use HttpServer\Application;
|
||||
use HttpServer\IInterface\AuthIdentity;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use ReflectionException;
|
||||
use Snowflake\Core\JSON;
|
||||
use Snowflake\Exception\ComponentException;
|
||||
@@ -186,7 +186,7 @@ class Request extends Application
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public function getCurrent(): string
|
||||
public function getCurrent(): string
|
||||
{
|
||||
return current($this->explode);
|
||||
}
|
||||
@@ -360,7 +360,7 @@ class Request extends Application
|
||||
/**
|
||||
* @return mixed|null
|
||||
*/
|
||||
#[Pure] public function getIp()
|
||||
public function getIp()
|
||||
{
|
||||
$headers = $this->headers->getHeaders();
|
||||
if (!empty($headers['x-forwarded-for'])) return $headers['x-forwarded-for'];
|
||||
@@ -372,7 +372,7 @@ class Request extends Application
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public function getRuntime(): string
|
||||
public function getRuntime(): string
|
||||
{
|
||||
return sprintf('%.5f', microtime(TRUE) - $this->startTime);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace HttpServer\Route\Filter;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Throwable;
|
||||
|
||||
class FilterException extends \Exception
|
||||
@@ -18,7 +18,7 @@ class FilterException extends \Exception
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
#[Pure] public function __construct($message = "", $code = 0, Throwable $previous = null)
|
||||
public function __construct($message = "", $code = 0, Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ use Closure;
|
||||
use HttpServer\Http\Request;
|
||||
use Exception;
|
||||
use HttpServer\Application;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use ReflectionException;
|
||||
use Snowflake\Core\JSON;
|
||||
use Snowflake\Exception\NotFindClassException;
|
||||
@@ -81,7 +81,7 @@ class Node extends Application
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public function hasInterceptor(): bool
|
||||
public function hasInterceptor(): bool
|
||||
{
|
||||
return count($this->_interceptors) > 0;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ class Node extends Application
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public function hasLimits(): bool
|
||||
public function hasLimits(): bool
|
||||
{
|
||||
return count($this->_limits) > 0;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ class Node extends Application
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public function hasAfter(): bool
|
||||
public function hasAfter(): bool
|
||||
{
|
||||
return count($this->_after) > 0;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ use Exception;
|
||||
use HttpServer\Http\Request;
|
||||
use HttpServer\IInterface\RouterInterface;
|
||||
use HttpServer\Application;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Abstracts\Config;
|
||||
use Snowflake\Exception\ComponentException;
|
||||
use Snowflake\Exception\ConfigException;
|
||||
@@ -109,7 +109,7 @@ class Router extends Application implements RouterInterface
|
||||
* @param $path
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] private function resolve($path): string
|
||||
private function resolve($path): string
|
||||
{
|
||||
$paths = array_column($this->groupTacks, 'prefix');
|
||||
if (empty($paths)) {
|
||||
|
||||
@@ -16,7 +16,7 @@ use HttpServer\Http\Request;
|
||||
use HttpServer\Http\Response;
|
||||
use HttpServer\Route\Router;
|
||||
use HttpServer\Server;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Kafka\Producer;
|
||||
use Annotation\Annotation as SAnnotation;
|
||||
use Snowflake\Cache\Redis;
|
||||
@@ -139,7 +139,7 @@ abstract class BaseApplication extends Service
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] protected function looksLikeSetter(string $line): bool
|
||||
protected function looksLikeSetter(string $line): bool
|
||||
{
|
||||
return str_contains($line, '=');
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ declare(strict_types=1);
|
||||
namespace Snowflake\Abstracts;
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Error\Logger;
|
||||
use Snowflake\Snowflake;
|
||||
|
||||
@@ -45,7 +45,7 @@ class BaseObject implements Configure
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public static function className(): string
|
||||
public static function className(): string
|
||||
{
|
||||
return get_called_class();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Snowflake\Abstracts;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Snowflake;
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,7 @@ class Component extends BaseObject
|
||||
* @param null $callback
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public function hasEvent($name, $callback = null): bool
|
||||
public function hasEvent($name, $callback = null): bool
|
||||
{
|
||||
if (!isset($this->_events[$name])) {
|
||||
return false;
|
||||
|
||||
@@ -9,7 +9,7 @@ declare(strict_types=1);
|
||||
namespace Snowflake\Abstracts;
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Exception\ConfigException;
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Snowflake\Snowflake;
|
||||
@@ -94,7 +94,7 @@ class Config extends Component
|
||||
* @param bool $must_not_null
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public static function has($key, $must_not_null = false): bool
|
||||
public static function has($key, $must_not_null = false): bool
|
||||
{
|
||||
$config = Snowflake::app()->config;
|
||||
if (!isset($config->data[$key])) {
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Snowflake\Abstracts;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Swoole\Coroutine;
|
||||
use Swoole\Coroutine\Channel;
|
||||
|
||||
@@ -57,7 +57,7 @@ abstract class Pool extends Component
|
||||
* @param false $isMaster
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public function name($cds, $isMaster = false): string
|
||||
public function name($cds, $isMaster = false): string
|
||||
{
|
||||
if ($isMaster === true) {
|
||||
return hash('sha256', $cds . 'master');
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Snowflake\Cache;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Abstracts\Component;
|
||||
use Swoole\Coroutine\System;
|
||||
|
||||
@@ -119,7 +119,7 @@ class File extends Component implements ICache
|
||||
* @param $key
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public function exists($key): bool
|
||||
public function exists($key): bool
|
||||
{
|
||||
return file_exists($key);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Snowflake\Core;
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
|
||||
/**
|
||||
* Class DateFormat
|
||||
@@ -96,7 +96,7 @@ class DateFormat
|
||||
* @param null $endTime
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public static function mtime($startTime, $endTime = null)
|
||||
public static function mtime($startTime, $endTime = null)
|
||||
{
|
||||
if ($endTime === null) {
|
||||
$endTime = microtime(true);
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Snowflake\Core;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
|
||||
/**
|
||||
* Class Help
|
||||
@@ -19,7 +19,7 @@ class Help
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public static function toXml(array $data)
|
||||
public static function toXml(array $data)
|
||||
{
|
||||
$xml = "<xml>";
|
||||
foreach ($data as $key => $val) {
|
||||
|
||||
+6
-6
@@ -5,7 +5,7 @@ namespace Snowflake\Core;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
|
||||
/**
|
||||
* Class Str
|
||||
@@ -24,7 +24,7 @@ class Str
|
||||
* @return string
|
||||
* 获取随机字符串
|
||||
*/
|
||||
#[Pure] public static function rand(int $length = 20): string
|
||||
public static function rand(int $length = 20): string
|
||||
{
|
||||
$string = '';
|
||||
if ($length < 1) $length = 20;
|
||||
@@ -42,7 +42,7 @@ class Str
|
||||
* @return int|string 获取随机数字
|
||||
* 获取随机数字
|
||||
*/
|
||||
#[Pure] public static function random(int $length = 20): int|string
|
||||
public static function random(int $length = 20): int|string
|
||||
{
|
||||
$number = '';
|
||||
$default = str_split(self::NUMBER);
|
||||
@@ -119,7 +119,7 @@ class Str
|
||||
* @param string $append
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public static function cut($string, int $length = 20, $append = '...'): string
|
||||
public static function cut($string, int $length = 20, $append = '...'): string
|
||||
{
|
||||
if (empty($string)) {
|
||||
return '';
|
||||
@@ -167,7 +167,7 @@ class Str
|
||||
* @param $type
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public static function filename($file, $type): string
|
||||
public static function filename($file, $type): string
|
||||
{
|
||||
switch ($type) {
|
||||
case 'image/png':
|
||||
@@ -218,7 +218,7 @@ class Str
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public static function encode(string $string): string
|
||||
public static function encode(string $string): string
|
||||
{
|
||||
return addslashes($string);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace Snowflake\Exception;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
@@ -21,7 +21,7 @@ class AuthException extends \Exception
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
#[Pure] public function __construct($message = "", $code = 0, Throwable $previous = null)
|
||||
public function __construct($message = "", $code = 0, Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, 401, $previous);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ declare(strict_types=1);
|
||||
namespace Snowflake\Exception;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ class ComponentException extends \Exception
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
#[Pure] public function __construct(string $message = "", int $code = 0, Throwable $previous = NULL)
|
||||
public function __construct(string $message = "", int $code = 0, Throwable $previous = NULL)
|
||||
{
|
||||
parent::__construct($message, 5000, $previous);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ declare(strict_types=1);
|
||||
namespace Snowflake\Exception;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ class NotFindClassException extends \Exception
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
#[Pure] public function __construct(string $message = "", int $code = 0, Throwable $previous = null)
|
||||
public function __construct(string $message = "", int $code = 0, Throwable $previous = null)
|
||||
{
|
||||
$message = "No class named `$message` was found, please check if the class name is correct";
|
||||
parent::__construct($message, 404, $previous);
|
||||
|
||||
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace Snowflake\Pool;
|
||||
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use Snowflake\Snowflake;
|
||||
|
||||
/**
|
||||
@@ -21,7 +21,7 @@ class Pool extends \Snowflake\Abstracts\Pool
|
||||
/**
|
||||
* @return Redis
|
||||
*/
|
||||
#[Pure] public function getRedis(): Redis
|
||||
public function getRedis(): Redis
|
||||
{
|
||||
return Snowflake::app()->redis_connections;
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class Pool extends \Snowflake\Abstracts\Pool
|
||||
/**
|
||||
* @return Connection
|
||||
*/
|
||||
#[Pure] public function getDb(): Connection
|
||||
public function getDb(): Connection
|
||||
{
|
||||
return Snowflake::app()->connections;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Snowflake;
|
||||
|
||||
use Exception;
|
||||
use HttpServer\IInterface\Task;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
use ReflectionException;
|
||||
use Snowflake\Abstracts\Config;
|
||||
use Snowflake\Core\JSON;
|
||||
@@ -222,7 +222,7 @@ class Snowflake
|
||||
* @return Server|null
|
||||
* @throws
|
||||
*/
|
||||
#[Pure] public static function getWebSocket(): ?Server
|
||||
public static function getWebSocket(): ?Server
|
||||
{
|
||||
$server = static::app()->server->getServer();
|
||||
if (!($server instanceof Server)) {
|
||||
@@ -319,7 +319,7 @@ class Snowflake
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public static function isMac(): bool
|
||||
public static function isMac(): bool
|
||||
{
|
||||
$output = strtolower(PHP_OS | PHP_OS_FAMILY);
|
||||
if (str_contains('mac', $output)) {
|
||||
@@ -334,7 +334,7 @@ class Snowflake
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
#[Pure] public static function isLinux(): bool
|
||||
public static function isLinux(): bool
|
||||
{
|
||||
if (!static::isMac()) {
|
||||
return true;
|
||||
|
||||
@@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace validator;
|
||||
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
|
||||
|
||||
/**
|
||||
* Class EnumValidator
|
||||
@@ -42,7 +42,7 @@ class EnumValidator extends BaseValidator
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] private function i(): string
|
||||
private function i(): string
|
||||
{
|
||||
return 'The param :attribute value only in ' . implode(',', $this->value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user