Showing 1,049 of 1,049 total issues
Method generateParentListQuery
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateParentListQuery($uri, $lang, $fallback, $props)
{
$fcl = $this->generateFromClause();
$propertyClause = implode('|', $props);
$query = <<<EOQ
Method generateAlphabeticalListQuery
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateAlphabeticalListQuery($letter, $lang, $limit, $offset, $classes, $showDeprecated = false, $qualifier = null)
{
$gcl = $this->graphClause;
$classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept');
$values = $this->formatValues('?type', $classes, 'uri');
Method searchConcepts
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function searchConcepts($params)
{
// don't even try to search for empty prefix if no other search criteria (group or parent concept) has been set
if (($params->getSearchTerm() === "" || !preg_match('/[^*]/', $params->getSearchTerm())) && !$params->getGroupLimit() && !$params->getParentLimit()) {
return array();
Function transformNarrowerResults
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function transformNarrowerResults($result, $lang)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->child)) {
- 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 searchConceptsAndInfo
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function searchConceptsAndInfo($params)
{
$params->setUnique(true);
$allhits = $this->searchConcepts($params);
$count = sizeof($allhits);
- 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 transformSearchResults
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function transformSearchResults($request, $results, $parameters)
{
// before serializing to JSON, get rid of the Vocabulary object that came with each resource
foreach ($results as &$res) {
unset($res['voc']);
- 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 getTypes
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getTypes($vocid = null, $lang = null)
{
$sparql = (isset($vocid)) ? $this->getVocabulary($vocid)->getSparql() : $this->getDefaultSparql();
$result = $sparql->queryTypes($lang);
foreach ($result as $uri => $values) {
- 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 invokeGlobalSearch
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function invokeGlobalSearch($request)
{
$lang = $request->getLang();
$template = $this->twig->load('global-search.twig');
$this->model->setLocale($request->getLang());
- 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 getPluginArray
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getPluginArray(): array
{
$this->setParameterizedPlugins();
$pluginArray = array();
$vocabularyPlugins = $this->resource->getResource('skosmos:vocabularyPlugins');
- 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 labelStatistics
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function labelStatistics($request)
{
if ($this->notModified($request->getVocab())) {
return null;
}
Method transformSearchResults
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function transformSearchResults($request, $results, $parameters)
{
// before serializing to JSON, get rid of the Vocabulary object that came with each resource
foreach ($results as &$res) {
unset($res['voc']);
Avoid excessively long variable names like $DEFAULT_EXT_PROPERTIES. Keep variable name length under 20. Open
private $DEFAULT_EXT_PROPERTIES = array(
"dc11:title",
"dcterms:title",
"skos:prefLabel",
"skos:exactMatch",
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $globalPluginsResource. Keep variable name length under 20. Open
$globalPluginsResource = $this->getResource()->getResource("skosmos:globalPlugins");
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $defaultConceptSchemeURI. Keep variable name length under 20. Open
public function getConceptScheme(string $defaultConceptSchemeURI)
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Method queryTopConcepts
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function queryTopConcepts($conceptSchemes, $lang, $fallback)
{
if (!is_array($conceptSchemes)) {
$conceptSchemes = array($conceptSchemes);
}
Method vocabularyInformation
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function vocabularyInformation($request)
{
$vocab = $request->getVocab();
if ($this->notModified($vocab)) {
return null;
Method searchConceptsAndInfo
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function searchConceptsAndInfo($params)
{
$params->setUnique(true);
$allhits = $this->searchConcepts($params);
$count = sizeof($allhits);
Function renderResults
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderResults () {
// TODO: get the results list form cache if it is implemented
const renderedSearchTerm = this.searchTerm // save the search term in case it changes while rendering
this.renderedResultsList.forEach(result => {
Method dumpJsonLd
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dumpJsonLd()
{
$context = array(
'skos' => EasyRdf\RdfNamespace::get("skos"),
'isothes' => EasyRdf\RdfNamespace::get("isothes"),
Method getMappingProperties
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getMappingProperties(array $whitelist = null)
{
$ret = array();
$longUris = $this->resource->propertyUris();