Showing 27 of 27 total issues
Connection
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Connection
{
/**
* @var null|PDO
Function booted
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function booted()
{
$config = $this->getConfig();
$globalConfig = $this->container->get('server.config');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getControllerResponse
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function getControllerResponse(array $attributes, Request $request, Cookies $cookies)
{
if (is_callable($attributes['_controller'])) {
$callback = $attributes['_controller'];
} else {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Server
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Server
{
/**
* @var null|SwooleServer
*/
Method onKernelRequest
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onKernelRequest(GetResponseEvent $event)
{
$request = $event->getRequest();
$pathInfo = $request->server['path_info'];
if (false !== $pos = strpos($pathInfo, '?')) {
Function message
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function message(SwooleWebSocketServer $server, Frame $frame)
{
if (empty($frame->data)) {
return $server->push($frame->fd, json_encode([
'code' => 500, 'message' => 'data parse failed', 'body' => []
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function handle
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function handle(int $fd, string $data, int $workerId = 0)
{
$this->protocol->unpack($fd, $data);
if ($this->protocol->finish($fd)) {
$protocol = $this->protocol->protocol($fd);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function pop
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function pop(string $name)
{
if (!isset($this->pool[$name])) {
throw new NotFoundPoolException("Pool not found name to '$name'");
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function makeUnpack
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function makeUnpack(int $fd, string $package)
{
if (!$this->isUnpack($fd)) {
$this->package['is_unpack'][$fd] = true;
$unPackage = unpack($this->unpackFormat, $package);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getControllerResponse
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getControllerResponse(array $attributes, Request $request, Cookies $cookies)
{
if (is_callable($attributes['_controller'])) {
$callback = $attributes['_controller'];
} else {
Method message
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function message(SwooleWebSocketServer $server, Frame $frame)
{
if (empty($frame->data)) {
return $server->push($frame->fd, json_encode([
'code' => 500, 'message' => 'data parse failed', 'body' => []
Function onWorkerStart
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function onWorkerStart(\Swoole\Server $server, int $workerId)
{
if ($workerId === 0) {
/**
* @var $pool PoolManager|null
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method handle
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handle(int $fd, string $data, int $workerId = 0)
{
$this->protocol->unpack($fd, $data);
if ($this->protocol->finish($fd)) {
$protocol = $this->protocol->protocol($fd);
Method factory
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function factory($poolName)
{
list($namespace, $name) = explode('.', $poolName);
$connection = null;
if (in_array($namespace, ['database', 'cache'])) {
Function onKernelRequest
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function onKernelRequest(GetResponseEvent $event)
{
$request = $event->getRequest();
$pathInfo = $request->server['path_info'];
if (false !== $pos = strpos($pathInfo, '?')) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method register
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(Container $pimple)
{
// TODO: Implement register() method.
$pimple['session'] = $pimple->protect(function ($pimple, $sessionId = null) {
Function execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function execute(): bool
{
$content = $this->content;
if (is_array($this->content)) {
$from = $this->content['from'] ?? [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function tickCallback
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function tickCallback()
{
$count = count($this->pool);
if ($count < 1) {
return ;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method createConnection
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
string $driver,
callable $pdo,
string $database,
array $config,
string $prefix = '',
Function onFinish
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function onFinish(SwooleServer $server, int $taskId, $data)
{
if (is_bool($data) && $data == true) {
if ($this->container->has('redis')) {
/**
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"