File languages.php
has 2216 lines of code (exceeds 250 allowed). Consider refactoring.
<?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.
public static function find($format, $value)
{
$instance = self::getInstance();
foreach ($instance->languages as $language) {
if(!isset($language[$format])) continue;
Function guess
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
protected function guess(string $format)
{
$matches = [];
foreach (self::$converters as $key => $converter) {
if(!call_user_func_array($converter . '::check', [$format])) continue;
Function format
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
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');
}