whiteCube/lingua

View on GitHub
src/Lingua/NameConverter.php

Summary

Maintainability
A
35 mins
Test Coverage

Showing 5 of 5 total issues

Function format has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

public static function format(ConverterInterface $converter)
{
if(!$converter->repository) {
throw new \Exception('Language "' . $converter . '" could not be converted to its english name since it is not registered in the Lingua repository');
}
Severity: Minor
Found in src/Lingua/NameConverter.php - About 35 mins to fix

Missing class import via use statement (line '16', column '23').
Open

throw new \Exception('Unable to find language named "' . $this->original . '"');
Severity: Minor
Found in src/Lingua/NameConverter.php by phpmd

Missing class import via use statement (line '33', column '23').
Open

throw new \Exception('Language "' . $converter . '" could not be converted to its english name since it is not registered in the Lingua repository');
Severity: Minor
Found in src/Lingua/NameConverter.php by phpmd

Avoid using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'check'.
Open

if(LanguagesRepository::find('name', self::prepare($format))) return true;
Severity: Minor
Found in src/Lingua/NameConverter.php by phpmd

Avoid using static access to class 'WhiteCube\Lingua\LanguagesRepository' in method 'parse'.
Open

$this->repository = LanguagesRepository::find('name', $this->original);
Severity: Minor
Found in src/Lingua/NameConverter.php by phpmd
Category
Status