Showing 54 of 54 total issues
Function validateRecursive
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function validateRecursive($propertyName, $filterName, $filterArgs = null)
{
// check if we got it from form defined request method
if (App::$Request->getMethod() !== $this->_sendMethod) {
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
ModelFilters
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class ModelFilters
{
/**
* Filter ['object', 'length_min', 'length']
Function runValidate
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function runValidate(array $rules = null)
{
// skip validation on empty rules
if ($rules === null) {
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
Str
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Str
{
/**
* Check if string is empty (check null, false and '' values)
* @param string|null $string
Method validateRecursive
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateRecursive($propertyName, $filterName, $filterArgs = null)
{
// check if we got it from form defined request method
if (App::$Request->getMethod() !== $this->_sendMethod) {
return false;
Function listFiles
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function listFiles($path, array $ext = null, $returnRelative = false, &$files = [])
{
$path = Normalize::diskFullPath($path);
if (!Directory::exist($path)) {
- 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 compileBootableClasses
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function compileBootableClasses(): void
{
// list app root's
foreach ($this->appRoots as $app) {
$app .= '/Apps/Controller/' . env_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 getRequest
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function getRequest($param, $method = null)
{
if ($method === null) {
$method = $this->_sendMethod;
}
- 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 getValidationRule
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
final public function getValidationRule($field): array
{
$rules = $this->rules();
$response = [];
- 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 loadAverage
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function loadAverage()
{
$load = 0;
if (stristr(PHP_OS, 'win')) {
// its not a better solution, but no other way to do this
- 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
final public function validate(): bool
{
// validate csrf token if required
if ($this->_tokenRequired && !$this->_tokenOk) {
App::$Session->getFlashBag()->add('warning', __('Hack attention: security token is wrong!'));
- 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 parseComposerLoader
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function parseComposerLoader(): void
{
// get composer autoload map
$map = $this->loader->getPrefixes();
if (Any::isArray($map)) {
- 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 search
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function search(?string $query = null, bool $exist = false)
{
// initialize db migration record
$records = new Migration();
if ($this->connection !== 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 getRequest
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getRequest($param, $method = null)
{
if ($method === null) {
$method = $this->_sendMethod;
}
Function diskPath
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function diskPath($path)
{
// its full-based path? Lets return real path
if (Str::startsWith(root, $path)) {
// fix path collisions if is not exist
- 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 run
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run(): void
{
try {
/** @var \Ffcms\Core\Arch\Controller $callClass */
$callClass = $this->getCallbackClass();
Function loadDynamicServices
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function loadDynamicServices(): void
{
$this->startMeasure(__METHOD__);
/** @var array $objects */
- 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 runMultiLanguage
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function runMultiLanguage(): void
{
// check if multi-language is enabled
if (!App::$Properties->get('multiLanguage')) {
$this->language = App::$Properties->get('singleLanguage');
- 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 run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function run(): void
{
try {
/** @var \Ffcms\Core\Arch\Controller $callClass */
$callClass = $this->getCallbackClass();
- 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 humanize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function humanize($raw)
{
// convert to timestamp
$timestamp = $raw;
// raw can be instance of eloquent active record object, convert to str