File GenericSparql.php
has 1655 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Generates SPARQL queries and provides access to the SPARQL endpoint.
*/
GenericSparql
has 80 functions (exceeds 20 allowed). Consider refactoring. Open
class GenericSparql
{
/**
* A SPARQL Client eg. an EasyRDF instance.
* @property EasyRdf\Sparql\Client $client
Function transformParentListResults
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
private function transformParentListResults($result, $lang)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->broad)) {
- 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 transformConceptSearchResult
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
private function transformConceptSearchResult($row, $vocabs, $fields)
{
$hit = array();
$hit['uri'] = $row->s->getUri();
- 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 generateConceptInfoQuery
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateConceptInfoQuery($uris, $arrayClass, $vocabs)
{
$gcl = $this->graphClause;
$fcl = empty($vocabs) ? '' : $this->generateFromClause($vocabs);
$values = $this->formatValues('?uri', $uris, 'uri');
Function transformTransitivePropertyResults
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private function transformTransitivePropertyResults($result, $lang, $fallbacklang)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->object)) {
- 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
The class GenericSparql has an overall complexity of 325 which is very high. The configured complexity threshold is 50. Open
class GenericSparql
{
/**
* A SPARQL Client eg. an EasyRDF instance.
* @property EasyRdf\Sparql\Client $client
- Exclude checks
The class GenericSparql has 23 public methods. Consider refactoring GenericSparql to keep number of public methods under 10. Open
class GenericSparql
{
/**
* A SPARQL Client eg. an EasyRDF instance.
* @property EasyRdf\Sparql\Client $client
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class GenericSparql has 77 non-getter- and setter-methods. Consider refactoring GenericSparql to keep number of methods under 25. Open
class GenericSparql
{
/**
* A SPARQL Client eg. an EasyRDF instance.
* @property EasyRdf\Sparql\Client $client
- Read upRead up
- Exclude checks
TooManyMethods
Since: 0.1
A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
The default was changed from 10 to 25 in PHPMD 2.3.
Example
Source https://phpmd.org/rules/codesize.html#toomanymethods
Method generateConceptSearchQuery
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateConceptSearchQuery($fields, $unique, $params, $showDeprecated = false)
{
$vocabs = $params->getVocabs();
$gcl = $this->graphClause;
$fcl = empty($vocabs) ? '' : $this->generateFromClause($vocabs);
Method transformConceptSearchResult
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function transformConceptSearchResult($row, $vocabs, $fields)
{
$hit = array();
$hit['uri'] = $row->s->getUri();
Method transformParentListResults
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function transformParentListResults($result, $lang)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->broad)) {
Function transformConceptGroupContentsResults
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function transformConceptGroupContentsResults($result, $lang)
{
$ret = array();
$values = array();
foreach ($result as $row) {
- 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 generateConceptSearchQuery
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function generateConceptSearchQuery($fields, $unique, $params, $showDeprecated = false)
{
$vocabs = $params->getVocabs();
$gcl = $this->graphClause;
$fcl = empty($vocabs) ? '' : $this->generateFromClause($vocabs);
- 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 transformChangeListResults
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function transformChangeListResults($result)
{
$ret = array();
foreach ($result as $row) {
$concept = array('uri' => $row->concept->getURI());
- 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 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');
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
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 generateConceptSearchQueryInner
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $props, $unique, $filterGraph)
{
$valuesProp = $this->formatValues('?prop', $props);
$textcond = $this->generateConceptSearchQueryCondition($term, $searchLang);
Method transformTransitivePropertyResults
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function transformTransitivePropertyResults($result, $lang, $fallbacklang)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->object)) {
Method generateChangeListQuery
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateChangeListQuery($prop, $lang, $offset, $limit = 200, $showDeprecated = false)
{
$fcl = $this->generateFromClause();
$offset = ($offset) ? 'OFFSET ' . $offset : '';
Function transformConceptGroupsResults
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function transformConceptGroupsResults($result)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->group)) {
- 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 transformAlphabeticalListResults
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function transformAlphabeticalListResults($results)
{
$ret = array();
foreach ($results as $row) {
- 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 transformPropertyQueryResults
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function transformPropertyQueryResults($result, $lang)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->object)) {
- 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 queryTopConcepts
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function queryTopConcepts($conceptSchemes, $lang, $fallback)
{
if (!is_array($conceptSchemes)) {
$conceptSchemes = array($conceptSchemes);
}
- 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 generateQueryTypesQuery
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateQueryTypesQuery($lang)
{
$fcl = $this->generateFromClause();
$query = <<<EOQ
SELECT DISTINCT ?type ?label ?superclass $fcl
Method transformNarrowerResults
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function transformNarrowerResults($result, $lang)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->child)) {
Method transformConceptGroupContentsResults
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function transformConceptGroupContentsResults($result, $lang)
{
$ret = array();
$values = array();
foreach ($result as $row) {
Method generateQueryConceptSchemesQuery
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateQueryConceptSchemesQuery($lang)
{
$fcl = $this->generateFromClause();
$query = <<<EOQ
SELECT ?cs ?label ?preflabel ?title ?domain ?domainLabel $fcl
Function transformQueryConceptSchemesResults
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function transformQueryConceptSchemesResults($result)
{
$ret = array();
foreach ($result as $row) {
$conceptscheme = array();
- 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 transformChangeListResults
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function transformChangeListResults($result)
{
$ret = array();
foreach ($result as $row) {
$concept = array('uri' => $row->concept->getURI());
Method generateChildQuery
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateChildQuery($uri, $lang, $fallback, $props)
{
$uri = is_array($uri) ? $uri[0] : $uri;
$fcl = $this->generateFromClause();
$propertyClause = implode('|', $props);
Method generateTransitivePropertyQuery
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateTransitivePropertyQuery($uri, $props, $lang, $limit, $anylang)
{
$uri = is_array($uri) ? $uri[0] : $uri;
$fcl = $this->generateFromClause();
$propertyClause = implode('|', $props);
Function transformCountConceptsResults
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function transformCountConceptsResults($result, $lang)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->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
Method generateAlphabeticalListQuery
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function generateAlphabeticalListQuery($letter, $lang, $limit, $offset, $classes, $showDeprecated = false, $qualifier = null)
Method queryConceptsAlphabetical
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function queryConceptsAlphabetical($letter, $lang, $limit = null, $offset = null, $classes = null, $showDeprecated = false, $qualifier = null)
Method generateConceptSearchQueryInner
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function generateConceptSearchQueryInner($term, $lang, $searchLang, $props, $unique, $filterGraph)
Method queryTransitiveProperty
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function queryTransitiveProperty($uri, $props, $lang, $limit, $anylang = false, $fallbacklang = '')
Method generateChangeListQuery
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function generateChangeListQuery($prop, $lang, $offset, $limit = 200, $showDeprecated = false)
Method generateTransitivePropertyQuery
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private function generateTransitivePropertyQuery($uri, $props, $lang, $limit, $anylang)
Method queryConcepts
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function queryConcepts($vocabs, $fields, $unique, $params, $showDeprecated = false)
Method queryChangeList
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated = false)
Function transformCountLangConceptsResults
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function transformCountLangConceptsResults($result, $langs, $props)
{
$ret = array();
// set default count to zero; overridden below if query found labels
foreach ($langs as $lang) {
- 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 getVocabGraphs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getVocabGraphs($vocabs)
{
if ($vocabs === null || sizeof($vocabs) == 0) {
// searching from all vocabularies - limit to known graphs
$vocabs = $this->model->getVocabularies();
- 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
The method generateConceptInfoQuery() has 117 lines of code. Current threshold is set to 100. Avoid really long methods. Open
private function generateConceptInfoQuery($uris, $arrayClass, $vocabs)
{
$gcl = $this->graphClause;
$fcl = empty($vocabs) ? '' : $this->generateFromClause($vocabs);
$values = $this->formatValues('?uri', $uris, 'uri');
- Exclude checks
The method transformParentListResults() has an NPath complexity of 63362. The configured NPath complexity threshold is 200. Open
private function transformParentListResults($result, $lang)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->broad)) {
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method transformConceptSearchResult() has an NPath complexity of 13824. The configured NPath complexity threshold is 200. Open
private function transformConceptSearchResult($row, $vocabs, $fields)
{
$hit = array();
$hit['uri'] = $row->s->getUri();
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method generateConceptSearchQuery() has an NPath complexity of 16128. The configured NPath complexity threshold is 200. Open
protected function generateConceptSearchQuery($fields, $unique, $params, $showDeprecated = false)
{
$vocabs = $params->getVocabs();
$gcl = $this->graphClause;
$fcl = empty($vocabs) ? '' : $this->generateFromClause($vocabs);
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The class GenericSparql has 2420 lines of code. Current threshold is 1000. Avoid really long classes. Open
class GenericSparql
{
/**
* A SPARQL Client eg. an EasyRDF instance.
* @property EasyRdf\Sparql\Client $client
- Exclude checks
The method transformTransitivePropertyResults() has an NPath complexity of 1020. The configured NPath complexity threshold is 200. Open
private function transformTransitivePropertyResults($result, $lang, $fallbacklang)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->object)) {
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method transformParentListResults() has a Cyclomatic Complexity of 24. The configured cyclomatic complexity threshold is 10. Open
private function transformParentListResults($result, $lang)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->broad)) {
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method transformTransitivePropertyResults() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10. Open
private function transformTransitivePropertyResults($result, $lang, $fallbacklang)
{
$ret = array();
foreach ($result as $row) {
if (!isset($row->object)) {
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method generateConceptSearchQuery() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10. Open
protected function generateConceptSearchQuery($fields, $unique, $params, $showDeprecated = false)
{
$vocabs = $params->getVocabs();
$gcl = $this->graphClause;
$fcl = empty($vocabs) ? '' : $this->generateFromClause($vocabs);
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method transformConceptSearchResult() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10. Open
private function transformConceptSearchResult($row, $vocabs, $fields)
{
$hit = array();
$hit['uri'] = $row->s->getUri();
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method queryConcepts has a boolean flag argument $showDeprecated, which is a certain sign of a Single Responsibility Principle violation. Open
public function queryConcepts($vocabs, $fields, $unique, $params, $showDeprecated = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method queryProperty has a boolean flag argument $anylang, which is a certain sign of a Single Responsibility Principle violation. Open
public function queryProperty($uri, $prop, $lang, $anylang = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method queryChangeList has a boolean flag argument $showDeprecated, which is a certain sign of a Single Responsibility Principle violation. Open
public function queryChangeList($prop, $lang, $offset, $limit, $showDeprecated = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method generateAlphabeticalListQuery has a boolean flag argument $showDeprecated, which is a certain sign of a Single Responsibility Principle violation. Open
protected function generateAlphabeticalListQuery($letter, $lang, $limit, $offset, $classes, $showDeprecated = false, $qualifier = null)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method generateChangeListQuery has a boolean flag argument $showDeprecated, which is a certain sign of a Single Responsibility Principle violation. Open
private function generateChangeListQuery($prop, $lang, $offset, $limit = 200, $showDeprecated = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '49', column '29'). Open
$this->client = new EasyRdf\Sparql\Client($endpoint);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method queryTransitiveProperty has a boolean flag argument $anylang, which is a certain sign of a Single Responsibility Principle violation. Open
public function queryTransitiveProperty($uri, $props, $lang, $limit, $anylang = false, $fallbacklang = '')
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '512', column '35'). Open
$conceptArray[] = new Concept($this->model, $vocab, $conc, $result, $clang);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '172', column '24'). Open
$res = new EasyRdf\Resource($uri);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method generateConceptSearchQuery has a boolean flag argument $showDeprecated, which is a certain sign of a Single Responsibility Principle violation. Open
protected function generateConceptSearchQuery($fields, $unique, $params, $showDeprecated = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method queryConceptsAlphabetical has a boolean flag argument $showDeprecated, which is a certain sign of a Single Responsibility Principle violation. Open
public function queryConceptsAlphabetical($letter, $lang, $limit = null, $offset = null, $classes = null, $showDeprecated = false, $qualifier = null)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method generateConceptGroupContentsQuery has a boolean flag argument $showDeprecated, which is a certain sign of a Single Responsibility Principle violation. Open
private function generateConceptGroupContentsQuery($groupClass, $group, $lang, $showDeprecated = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method listConceptGroupContents has a boolean flag argument $showDeprecated, which is a certain sign of a Single Responsibility Principle violation. Open
public function listConceptGroupContents($groupClass, $group, $lang, $showDeprecated = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method transformConceptGroupContentsResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$values[$row->conc->getURI()]['type'][] = $row->type->shorten();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method querySuperProperties uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// no result, return null
return null;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method generateConceptInfoQuery uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// add information that can be used to format narrower concepts by
// the array they belong to ("milk by source animal" use case)
$construct = "\n ?x skos:member ?o . ?x skos:prefLabel ?xl . ?x a <$arrayClass> .";
$optional = "\n OPTIONAL {
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method transformConceptInfoResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$vocab = null;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method transformNarrowerResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$label = $row->label->getValue() . " (" . $row->label->getLang() . ")";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method transformConceptGroupContentsResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$values[$row->conc->getURI()]['prefLabel'] = $row->label->getValue() . " (" . $row->label->getLang() . ")";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method transformPropertyQueryResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$ret[$row->object->getUri()]['label'] = null;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'EasyRdf\Http' in method 'initializeHttpClient'. Open
$httpclient = EasyRdf\Http::getDefaultHttpClient();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else { // query the default graph
$this->graphClause = "";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'EasyRdf\RdfNamespace' in method 'generateQueryPrefixes'. Open
foreach (EasyRdf\RdfNamespace::namespaces() as $prefix => $uri) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'EasyRdf\RdfNamespace' in method 'formatTypes'. Open
$unprefixed = EasyRdf\RdfNamespace::expand($type);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'EasyRdf\Http' in method 'initializeHttpClient'. Open
EasyRdf\Http::setDefaultHttpClient($httpclient); // actually redundant..
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method generateConceptSearchQueryCondition uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else { // too complicated - have to use a regex
# make sure regex metacharacters are not passed through
$term = str_replace('\\', '\\\\', preg_quote($term));
$term = str_replace('\\\\*', '.*', $term); // convert asterisk to regex syntax
$term = str_replace('\'', '\\\'', $term); // ensure single quotes are quoted
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method transformPropertyQueryResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
return null;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method transformParentListResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// nonexistent concept
return null;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method formatFilterConditions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$filtercondLabel = $lang ? "strstarts(lcase(str(?label)), '$lcletter') && langMatches(lang(?label), '$lang')" : "strstarts(lcase(str(?label)), '$lcletter')";
$filtercondALabel = $lang ? "strstarts(lcase(str(?alabel)), '$lcletter') && langMatches(lang(?alabel), '$lang')" : "strstarts(lcase(str(?alabel)), '$lcletter')";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method transformAlphabeticalListResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$hit['qualifier'] = $row->qualifier->localName();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method transformTransitivePropertyResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
return null;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method query uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else { // graph result
$numTriples = $result->countTriples();
$logger->info("[qid $queryId] result: $numTriples triples returned in $elapsed ms");
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method transformTransitivePropertyResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$val = array('label' => null);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method transformNarrowerResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
else {
return null;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method queryLabel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
// nonexistent concept
return null;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method transformChangeListResults uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$concept['deprecated'] = false;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The variable $quote_string is not named in camelCase. Open
private function generateCountLangConceptsQuery($langs, $classes, $props)
{
$gcl = $this->graphClause;
$classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept');
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $quoted_values is not named in camelCase. Open
private function generateCountLangConceptsQuery($langs, $classes, $props)
{
$gcl = $this->graphClause;
$classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept');
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $quoted_values is not named in camelCase. Open
private function generateCountLangConceptsQuery($langs, $classes, $props)
{
$gcl = $this->graphClause;
$classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept');
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $quote_string is not named in camelCase. Open
private function generateCountLangConceptsQuery($langs, $classes, $props)
{
$gcl = $this->graphClause;
$classes = ($classes) ? $classes : array('http://www.w3.org/2004/02/skos/core#Concept');
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}