Showing 4,652 of 306,333 total issues
Function parseConditions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function parseConditions(?array $conditions): array
{
if (empty($conditions)) {
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 getFieldsFromConditions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function getFieldsFromConditions(array $conditions): array
{
$fields = ['baseModule' => [], 'referenceModule' => []];
if (isset($conditions['rules'])) {
foreach ($conditions['rules'] as &$condition) {
- 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 getBaseGeneralVariable
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function getBaseGeneralVariable()
{
$variables = [];
foreach ((new \DirectoryIterator(__DIR__ . \DIRECTORY_SEPARATOR . 'TextParser')) as $fileInfo) {
$fileName = $fileInfo->getBasename('.php');
- 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 getLibraryValues
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function getLibraryValues($name, $dir): array
{
$library = ['name' => $name, 'version' => '', 'license' => '', 'homepage' => ''];
$existJsonFiles = true;
foreach (self::$jsonFiles as $file) {
- 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 getSourceVariable
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getSourceVariable()
{
if (empty(self::$sourceModules[$this->moduleName])) {
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 getModuleGeneralVariable
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function getModuleGeneralVariable()
{
$variables = [];
if ($this->moduleName && is_dir(("modules/{$this->moduleName}/textparsers/"))) {
foreach ((new \DirectoryIterator("modules/{$this->moduleName}/textparsers/")) as $fileInfo) {
- 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 process
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function process()
{
$html = '';
if (!$this->textParser->recordModel->getModule()->isInventory()) {
return $html;
- 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 getColorByIps
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function getColorByIps(array $ips): array
{
$return = $find = [];
foreach ($ips as $uid => $ip) {
if (\App\Cache::has('MailRblIpColor', $ip)) {
- 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 getConfirmResponse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getConfirmResponse(\App\Request $request): array
{
$queries = [
'base' => $this->getConfirmQuery($request, 'u'),
];
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
private static function parse(string $type)
{
$values = [];
foreach (static::${$type} as $key => $item) {
if ('cron' === static::$sapi && !$item['testCli']) {
- 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 getSlaPolicyRulesForModule
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function getSlaPolicyRulesForModule(\Vtiger_Record_Model $recordModel): array
{
$times = $businessHours = [];
foreach (self::getSlaPolicyForModule($recordModel->getModule()->getId()) as $row) {
$conditions = \App\Json::decode($row['conditions']);
- 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 parseBusinessHoursToDays
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static function parseBusinessHoursToDays(array $rows): array
{
$days = $holidays = [];
foreach ($rows as $row) {
foreach (explode(',', $row['working_days']) as $day) {
- 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 initStorageFileDirectory
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function initStorageFileDirectory($suffix = false)
{
if (!$filepath = \App\Config::module($suffix, 'storagePath')) {
$filepath = 'storage' . \DIRECTORY_SEPARATOR;
}
- 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 explode
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function explode($date, $format = false)
{
if (empty($format)) {
$format = 'yyyy-mm-dd';
}
- 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 deleteForRecord
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function deleteForRecord(\Vtiger_Record_Model $recordModel)
{
foreach ($recordModel->getModule()->getFieldsByType(['multiAttachment', 'multiImage', 'image']) as $fieldModel) {
if (!$recordModel->isEmpty($fieldModel->getName()) && !\App\Json::isEmpty($recordModel->get($fieldModel->getName()))) {
foreach (\App\Json::decode($recordModel->get($fieldModel->getName())) as $file) {
- 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 getIntervalPart
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function getIntervalPart(\DateInterval $dateInterval, string $formatOut = 'ahis')
{
$value = 0;
$parts = str_split($formatOut, 1);
foreach (['a', 'h', 'i', 's'] as $part) {
- 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 validateValue
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function validateValue(string $fieldName, $value)
{
switch ($fieldName) {
case 'name':
$itemPropertyModel = $this->getFieldInstanceByName($fieldName);
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
public function validate(string $key, $value)
{
if (!isset($this->template[$key])) {
throw new Exceptions\IllegalValue('ERR_NOT_ALLOWED_VALUE||' . $key, 406);
}
- 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 getDataFromApi
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function getDataFromApi(array $params): void
{
try {
$client = \App\RequestHttp::getClient(['headers' => ['Authorization' => 'Bearer ' . $this->bearerToken]]);
$response = $client->post($this->url . 'query', ['json' => $params]);
- 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 getDataFromApi
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function getDataFromApi(array $query): void
{
$query['limit'] = self::LIMIT;
try {
$response = \App\RequestHttp::getClient()->request('GET', $this->url . '?' . http_build_query($query), [
- 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"