Showing 94 of 1,083 total issues
Form
has 52 functions (exceeds 20 allowed). Consider refactoring. Open
class Form
{
/**
* Render label tag
*
File Form.php
has 401 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php /** MicroForm */
namespace Micro\Form;
use Micro\Web\Html\Html;
Function run
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function run($model, $client = false)
{
$elements = explode(',', str_replace(' ', '', array_shift($this->rule)));
$name = array_shift($this->rule);
- 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 validate
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function validate(IFormModel $model)
{
foreach ($this->elements AS $element) {
if (!$model->checkAttributeExists($element)) {
/** @var UploadedFileInterface[] $files */
- 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 loadInjection
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function loadInjection($name)
{
$options = self::$CONFIG['components'][$name];
if (empty($options['class']) || !class_exists($options['class'])) {
- 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 publish
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function publish()
{
foreach ($this->required AS $require) {
if (!in_array($require, $this->published, true) && class_exists($require)) {
$this->published[] = $require;
- 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
Model
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Model extends FormModel implements IModel
{
/** @var string $primaryKey Primary key on table */
public static $primaryKey = 'id';
/** @var string $tableName Table name */
Function recurseCopyIfEdited
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function recurseCopyIfEdited($src = '', $dst = '', array $excludes = ['php'])
{
if (!is_dir($dst) && (!mkdir($dst) && !is_dir($dst))) {
throw new Exception('Copy dir error, access denied for path: '.$dst);
}
- 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 __get
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function __get($name)
{
/** @var array $relation */
if ($relation = $this->relations()->get($name)) {
if (empty($this->cacheRelations[$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 parse
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function parse($uri, $method = 'GET')
{
// default path
if ($uri === '/' || $uri === '' || $uri === '/default') {
return '/default';
- 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
Threads
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Threads
{
/** @var string $name thread name */
private $name;
/** @var integer $pid process ID */
Function update
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
final public function update($where = null)
{
if ($this->isNewRecord()) {
return false;
}
- 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 dirSize
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function dirSize($dirName)
{
$totalSize = 0;
if ($dirStream = opendir($dirName)) {
while (false !== ($fileName = readdir($dirStream))) {
- 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 __construct
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(array $args = [])
{
parent::__construct($args);
if (empty($args['data'])) {
Function applyFilters
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function applyFilters($action, $isPre = true, array $filters = [], $data = null)
{
if (!$filters) {
return $data;
}
- 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 validate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function validate(IFormModel $model)
{
foreach ($this->elements AS $element) {
if (!$model->checkAttributeExists($element)) {
$this->errors[] = 'Parameter '.$element.' not defined in class '.get_class($model);
- 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 __construct
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(array $args = [])
{
parent::__construct($args);
if (!array_key_exists('data', $args)) {
Function matchUser
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function matchUser($rule)
{
if (empty($rule['users'])) {
return true;
}
- 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 action
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function action($name = 'index')
{
// Set widgetStack for widgets
if (empty($GLOBALS['widgetStack'])) {
$GLOBALS['widgetStack'] = [];
Method run
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run($model, $client = false)
{
$elements = explode(',', str_replace(' ', '', array_shift($this->rule)));
$name = array_shift($this->rule);