Showing 4 of 36 total issues
File languages.php
has 2216 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This file should always return an array containing
* the languages data. Please follow the structure
Function find
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function find($format, $value)
{
$instance = self::getInstance();
foreach ($instance->languages as $language) {
if(!isset($language[$format])) continue;
- 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 guess
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function guess(string $format)
{
$matches = [];
foreach (self::$converters as $key => $converter) {
if(!call_user_func_array($converter . '::check', [$format])) continue;
- 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 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');
}
- 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"