Showing 30 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$name = $input->getArgument('name');
if ($name) {
$this->generateEntityService($output, $name);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 110.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$name = $input->getArgument('name');
if ($name) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 110.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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"