Showing 4,652 of 306,333 total issues
Function loadFromBase
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function loadFromBase(string $contents, array $param = []): ?self
{
$result = explode(',', $contents, 2);
$contentType = $isBase64 = false;
if (2 === \count($result)) {
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function validate(?string $type = null): bool
{
$return = true;
try {
if ($type && $this->getShortMimeType(0) !== $type) {
- 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 getInstance
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function getInstance($moduleName = false, $currentUser = false)
{
if ($currentUser && $currentUser instanceof \Users) {
$currentUser = \App\User::getUserModel($currentUser->id);
} elseif (false === $currentUser) {
- 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 getAccessibleUsers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getAccessibleUsers($private = '', $fieldType = false)
{
$cacheKey = $private . $this->moduleName . $fieldType . $this->currentUser->getRole();
if (!\App\Cache::has('getAccessibleUsers', $cacheKey)) {
$currentUserRoleModel = \Settings_Roles_Record_Model::getInstanceById($this->currentUser->getRole());
- 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 truncateZeros
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function truncateZeros(string $value)
{
$seperator = \App\User::getCurrentUserModel()->getDetail('currency_decimal_separator');
if (false === strpos($value, $seperator)) {
return $value;
- 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 getDiff
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function getDiff($start, $end, $format = '%a')
{
$interval = (new \DateTime($start))->diff(new \DateTime($end));
switch ($format) {
case 'years':
- 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 addAdditionalInvData
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addAdditionalInvData(): array
{
$additionalData = [];
$additionalAmount = $this->data['grand_total'] - $this->data['subtotal_incl_tax'] - $this->data['discount_amount'] - $this->data['shipping_incl_tax'];
if (!empty($additionalAmount)) {
- 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 loadFromDav
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function loadFromDav(string $calendar)
{
$instance = new self();
$instance->record = \Vtiger_Record_Model::getCleanInstance('Calendar');
$instance->vcalendar = VObject\Reader::read($calendar, \Sabre\VObject\Reader::OPTION_FORGIVING);
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
private function getDataFromApi(string $cnpj): void
{
try {
$this->setApiKey();
if ($this->apiKey) {
- 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 cron
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function cron($crons): array
{
if (!$crons) {
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 merge
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function merge(array $array1, array $array2): array
{
foreach ($array2 as $key => $value) {
if (isset($array1[$key])) {
if (\is_array($array1[$key]) && \is_array($value)) {
- 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 save
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function save()
{
$entityInstance = $this->getModule()->getEntityInstance();
$entityInstance->column_fields['user_name'] = $this->get('user_name');
if (!$this->isNew() && empty($this->getPreviousValue())) {
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function process($auth, $password)
{
\App\Log::trace('Start LDAP authentication', 'UserAuthentication');
if (!empty($password) && ('PLL_LDAP' === $this->userRecordModel->get('login_method') || 'PLL_LDAP_2FA' === $this->userRecordModel->get('login_method'))) {
$port = '' == $auth['port'] ? 389 : $auth['port'];
- 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 setSharedOwner
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function setSharedOwner($userIds, $record)
{
$saveFull = true;
$db = \App\Db::getInstance();
if ('SaveAjax' == \App\Request::_get('action') && \App\Request::_has('field') && 'shownerid' != \App\Request::_get('field')) {
- 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 setDataFromRequest
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function setDataFromRequest(App\Request $request)
{
$searchParams = \App\Condition::validSearchParams($this->moduelName, $request->getArray('search_params'));
$operator = $request->isEmpty('operator') ? '' : $request->getByType('operator');
if ($operator && $searchValue = \App\Condition::validSearchValue($request->getByType('search_value', \App\Purifier::TEXT), $this->moduelName, $request->getByType('search_key', \App\Purifier::ALNUM), $operator)) {
- 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 save
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function save(App\Request $request)
{
if ($request->isEmpty('record')) {
//get instance from currency name, Aleady deleted and adding again same currency case
$recordModel = Settings_Currency_Record_Model::getInstance($request->getByType('currency_name', 'Text'));
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function process(App\Request $request)
{
$response = new Vtiger_Response();
$qualifiedModuleName = $request->getModule(false);
$type = $request->has('type') ? $request->getByType('type', \App\Purifier::STANDARD) : 'Main';
- 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 getTableName
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getTableName($type)
{
if (\is_int($type)) {
$focus = CRMEntity::getInstance($this->getSourceModule()->getName());
if (0 == $type) {
- 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 step1
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function step1(App\Request $request)
{
$qualifiedModuleName = $request->getModule(false);
$params = $request->getByType('param', 'Text');
- 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 checkPermission
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function checkPermission(App\Request $request)
{
$moduleName = $request->getModule();
$currentUserModel = Users_Record_Model::getCurrentUserModel();
if (!App\Config::security('SHOW_MY_PREFERENCES')) {
- 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"