Showing 28 of 30 total issues
Method register
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register(Container $app)
{
$app['db.default_options'] = array(
'driver' => 'pdo_mysql',
'dbname' => 'test',
File RouterService.php
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace TastPHP\Framework\Router;
use Psr\Http\Message\ServerRequestInterface;
Function match
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function match($requestUrl, $requestMethod = 'GET')
{
$isRegexp = false;
$this->bind();
- 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 dispatch
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function dispatch($container)
{
$action = explode('::', $this->config['_controller']);
if (count($action) != 2) {
- 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 dispatch
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dispatch($container)
{
$action = explode('::', $this->config['_controller']);
if (count($action) != 2) {
Function pregMatch
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function pregMatch($url, $requestUrl, $route)
{
$replace = [];
$search = [];
$requireKeyNames = [];
- 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 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function register()
{
$container = Kernel::getInstance();
//debug bar
Method pregMatch
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function pregMatch($url, $requestUrl, $route)
{
$replace = [];
$search = [];
$requireKeyNames = [];
Method match
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function match($requestUrl, $requestMethod = 'GET')
{
$isRegexp = false;
$this->bind();
Function register
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function register(Container $app)
{
$app['middlewareEvent'] = function ($app) {
return new MiddlewareEvent($app);
};
- 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 generateEntityService
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateEntityService($output, $name)
{
$tableName = $name;
$name = $this->getGenerateEntityServiceNameByTableName($tableName);
$filesystem = new Filesystem();
Method parseResource
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parseResource($resource, $isCustom)
{
$config = [];
if (true == $isCustom) {
$configResourceDir = self::$configCacheDir . "/" . substr($resource, 0, -11);
Function handleShutdown
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function handleShutdown()
{
if ($exception = error_get_last()) {
if ($this->isFatal($exception['type'])) {
$this->record($exception);
- 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 parseRoutesConfig
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function parseRoutesConfig($routesFile, $routeConfigAll)
{
$routesConfigs = YamlService::parse(file_get_contents($routesFile));
foreach ($routesConfigs as $routeConfig) {
$resources = ($routeConfig['resource']);
- 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 handleError
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function handleError($level, $message, $file = '', $line = 0)
{
if (error_reporting() & $level) {
$error = [
'message' => $message,
- 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 registerServices
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function registerServices()
{
$this['serviceProviders'] = $this->serviceProviders;
foreach ($this->serviceProviders as $providerArray) {
- 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 put
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function put($tube, $data, $priority = 1024, $delaytime = 0, $lifetime = 60)
Function parseResource
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function parseResource($resource, $isCustom)
{
$config = [];
if (true == $isCustom) {
$configResourceDir = self::$configCacheDir . "/" . substr($resource, 0, -11);
- 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 extend
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function extend($id, $callable)
{
if (!isset($this->keys[$id])) {
throw new UnknownIdentifierException($id);
}
- 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
Avoid too many return
statements within this method. Open
return $dbs[$app['dbs.default']];