whiteCube/lingua

View on GitHub

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
Severity: Major
Found in languages.php - About 6 days to fix

    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;
    Severity: Minor
    Found in src/Lingua/LanguagesRepository.php - About 1 hr to fix

    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;
    Severity: Minor
    Found in src/Lingua/Service.php - About 45 mins to fix

    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
    Severity
    Category
    Status
    Source
    Language