Showing 54 of 54 total issues
Method runValidate
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function runValidate(array $rules = null)
{
// skip validation on empty rules
if ($rules === null) {
return true;
Method validate
has 28 lines of code (exceeds 25 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!'));
Method saveFromUrl
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function saveFromUrl($url, $path)
{
if (!filter_var($url, FILTER_VALIDATE_URL) || !function_exists('curl_init')) {
return false;
}
Function get
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function get(?string $index, string $text, ?array $params = null)
{
if (App::$Request->getLanguage() !== App::$Properties->get('baseLanguage')) {
if ($index && !Arr::in($index, $this->indexes)) {
$this->cached = Arr::merge($this->cached, $this->load($index));
- 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 makeUp
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function makeUp($file)
{
// check if argument is array of files and run recursion
if (Any::isArray($file)) {
$success = 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 makeUp
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function makeUp($file)
{
// check if argument is array of files and run recursion
if (Any::isArray($file)) {
$success = true;
Method get
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get(string $configKey, string $configFile = 'default', ?string $parseType = null)
{
$this->load($configFile);
// check if configs for this file is loaded
if (!isset($this->data[$configFile])) {
Function run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function run()
{
// check if cron instances is defined
if (!isset($this->configs['instances']) || !Any::isArray($this->configs['instances'])) {
return 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
Function makeDown
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function makeDown($file)
{
if (Any::isArray($file)) {
$success = true;
foreach ($file as $item) {
- 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 setLanguageFromBrowser
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function setLanguageFromBrowser(): void
{
$userLang = App::$Properties->get('singleLanguage');
$browserAccept = $this->getLanguages();
if (Any::isArray($browserAccept) && count($browserAccept) > 0) {
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)
Method initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)
Function isFile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function isFile($object, $value): bool
{
// allow empty fields, "required" option filter that
if ($object === 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
Function widget
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function widget(?array $params = null): ?string
{
self::$class = get_called_class();
self::$view = App::$View;
self::$request = App::$Request;
- 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 humanize
has a Cognitive Complexity of 8 (exceeds 5 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
- 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 recursiveChmod
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function recursiveChmod($path, $mod = 0777)
{
$path = Normalize::diskFullPath($path);
if (!self::exist($path)) {
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
Function snippet
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function snippet(string $text, int $length = 200)
{
$breakerPos = mb_strpos($text, self::WYSIWYG_BREAK_HTML, null, 'UTF-8');
// offset is founded, try to split preview from full text
if ($breakerPos !== 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 exportVar
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function exportVar($var, $indent = null, $guessTypes = false)
{
switch (gettype($var)) {
case 'string':
// guess boolean type for "1" and "0"
- 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 __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __construct()
{
// make alias for view pathway
$this->currentViewPath = App::$View->getCurrentPath();
- 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 runRouteBinding
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function runRouteBinding(): void
{
// calculated depend of language
$pathway = $this->getPathInfo();
/** @var array $routing */
- 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"