Showing 249 of 257 total issues
Method search
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function search($context, $user, $model, $collections, $paramsWithOperation, $sorting)
Function getUserProfile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getUserProfile($fieldName, $fieldValue, $params = array())
{
// Add followed and followme booleans
$fields = $this->userFields;
if (isset($params['from'])) {
- 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 getFeatureDescription
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function getFeatureDescription($context, $user, $featureId, $collection, $fields)
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($context, $user, $collections, $model, $query)
Method processSearchTerms
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function processSearchTerms($searchTerm, &$filters, $featureTableName, $filterName, $exclusion)
Function decodeJWT
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function decodeJWT($token, $acceptExpired = false)
{
try {
// Convert rJWT to JWT
if (count(explode('.', $token)) == 2) {
- 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 processTriplet
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function processTriplet()
{
$filter = array();
$not = 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 updateCatalog
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function updateCatalog($params, $body)
{
$facetId = $params['segments'][count($params['segments']) - 1 ];
$facets = (new FacetsFunctions($this->context->dbDriver))->getFacets(array('id' => $facetId));
- 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 storeBase64File
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function storeBase64File($data, $outputDir, $allowedTypes = array())
{
try {
if (preg_match('/^data:image\/(\w+);base64,/', $data, $type)) {
$data = substr($data, strpos($data, ',') + 1);
- 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 WKTPolygonToArray
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function WKTPolygonToArray($wktPolygon)
{
/*
* 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 setQuery
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function setQuery()
{
/*
* Aggregate input parameters
*
- 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 checkGeoJSONFeature
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function checkGeoJSONFeature($object)
{
// Default is nice
$error = 'Invalid GeoJSON feature';
- 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 hasRightsTo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function hasRightsTo($action, $params = array())
{
$rights = $this->getRights();
- 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 setCollectionLinks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function setCollectionLinks($links)
{
if (is_array($links)) {
for ($i = 0, $l = count($links); $i < $l; $i++) {
$this->startElement('link');
- 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 getIdFromBearer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getIdFromBearer($context, $token)
{
$payloadObject = $context->decodeJWT($token);
// Unvalid token => no auth
- 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 uploadFiles
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function uploadFiles($files)
{
$filePaths = [];
// All files will be uploaded within a dedicated directory with a random 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 storeUserProfile
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function storeUserProfile($profile, $storageInfo)
{
if (!is_array($profile) || !isset($profile['email'])) {
RestoLogUtil::httpError(400, 'Cannot save user profile - invalid user identifier');
}
- 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 setWhatFilters
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function setWhatFilters($what, $params)
{
$params['searchTerms'] = array();
foreach ($what as $key => $value) {
if ($key === 'searchTerms') {
- 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 processSearchTerms
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function processSearchTerms($searchTerm, &$filters, $featureTableName, $filterName, $exclusion)
{
/*
* The '|' character is understood as "OR"
* For performance reason it is better to use && operator instead of multiple @> with OR
- 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 getRightsForGroups
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getRightsForGroups($groupIds)
{
$groupRights = array();
$results = $this->dbDriver->fetch($this->dbDriver->query('SELECT rights FROM ' . $this->dbDriver->commonSchema . '.right WHERE groupid IN (' . pg_escape_string($this->dbDriver->getConnection(), join(',', $groupIds)) . ')'));
if ( isset($results) && count($results) >= 1 ) {
- 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"