Function toEquivUrisInTriples
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
function toEquivUrisInTriples( $triples, $propUrisFilter = null ) {
$equivUriCache = array();
foreach ( $triples as $tripleidx => $triple ) {
Method toEquivUrisInTriples
has 39 lines of code (exceeds 25 allowed). Consider refactoring.
function toEquivUrisInTriples( $triples, $propUrisFilter = null ) {
$equivUriCache = array();
foreach ( $triples as $tripleidx => $triple ) {
Function getURIForEquivURI
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
public function getURIForEquivURI( $equivUri, $isProperty = false ) {
$uri = '';
if ( $isProperty ) {
$equivUriUri = self::EQUIV_PROPERTY_URI;
} else {
Function getEquivURIsForURI
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
public function getEquivURIsForURI( $uri ) {
$equivUris = array();
$query = 'SELECT ?equivUri WHERE { { <' . $uri . '> <' . self::EQUIV_URI . '> ?equivUri } UNION { <' . $uri . '> <' . self::EQUIV_PROPERTY_URI . '> ?equivUri } }';
$results = $this->arc2store->query( $query );
The method toEquivUrisInTriples() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
function toEquivUrisInTriples( $triples, $propUrisFilter = null ) {
$equivUriCache = array();
foreach ( $triples as $tripleidx => $triple ) {
Missing class import via use statement (line '109', column '15').
throw new RDFIOARC2StoreWrapperException( $error );
Missing class import via use statement (line '148', column '15').
throw new RDFIOARC2StoreWrapperException( $error );
The method getWikiTitleByEquivalentURI has a boolean flag argument $isProperty, which is a certain sign of a Single Responsibility Principle violation.
public function getWikiTitleByEquivalentURI( $uri, $isProperty = false ) {
The method getURIForEquivURI has a boolean flag argument $isProperty, which is a certain sign of a Single Responsibility Principle violation.
public function getURIForEquivURI( $equivUri, $isProperty = false ) {
The method getURIForEquivURI uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
foreach ( $this->arc2store->getErrors() as $error ) {
throw new RDFIOARC2StoreWrapperException( $error );
}
}
The method toEquivUrisInTriples uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$propEquivUris = $this->getEquivURIsForURI( $triple['p'] );
if ( !is_null( $propUrisFilter ) ) {
$propEquivUris = array_intersect( $propEquivUris, $propUrisFilter );
The method getURIForEquivURI uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$equivUriUri = self::EQUIV_URI;
}
The method toEquivUrisInTriples uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$subjEquivUris = $this->getEquivURIsForURI( $subjUri );
if ( count( $subjEquivUris ) > 0 ) {
$triples[$tripleidx]['s'] = $subjEquivUris[0];
$equivUriCache[$subjUri] = $subjEquivUris[0];
Avoid using static access to class 'ARC2' in method '__construct'.
$this->arc2store = ARC2::getStore( $arc2StoreConfig );
The method toEquivUrisInTriples uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
} else {
$objEquivUris = $this->getEquivURIsForURI( $objUri );
if ( count( $objEquivUris ) > 0 ) {
$triples[$tripleidx]['o'] = $objEquivUris[0];
$equivUriCache[$objUri] = $objEquivUris[0];
Similar blocks of code found in 2 locations. Consider refactoring.
if ( array_key_exists( $subjUri, $equivUriCache ) ) {
$triples[$tripleidx]['s'] = $equivUriCache[$subjUri];
} else {
$subjEquivUris = $this->getEquivURIsForURI( $subjUri );
if ( count( $subjEquivUris ) > 0 ) {
Similar blocks of code found in 2 locations. Consider refactoring.
if ( array_key_exists( $objUri, $equivUriCache ) ) {
$triples[$tripleidx]['o'] = $equivUriCache[$objUri];
} else {
$objEquivUris = $this->getEquivURIsForURI( $objUri );
if ( count( $objEquivUris ) > 0 ) {
There are no issues that match your filters.