atelierspierrot/internationalization

View on GitHub

Showing 33 of 50 total issues

Method init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function init(LoaderInterface $loader, $lang = null, $timezone = null)
    {
        $this->setLoader($loader);
        if (is_null($lang)) {
            $lang = substr(Locale::getDefault(), 0, 2);
Severity: Minor
Found in src/I18n/I18n.php - About 1 hr to fix

    Function _getOrigin has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _getOrigin()
        {
            $ch = curl_init(self::IANA_LANGUAGE_SUBTAG_REGISTRY);
            if ($ch) {
                $tmpfname = tempnam("/tmp", "ianadb.txt");
    Severity: Minor
    Found in src/I18n/Iana.php - About 55 mins to fix

    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 findLanguageDBFile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function findLanguageDBFile($db_filename = null, $db_directory = null)
        {
            if (empty($db_filename)) {
                $db_filename = $this->buildLanguageDBFileName();
            }
    Severity: Minor
    Found in src/I18n/Loader.php - About 55 mins to fix

    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

    Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            Twig_Node_Expression_Array $choices,
            Twig_Node_Expression_Constant $counter,
            Twig_Node_Expression_Array $params,
            Twig_Node_Expression_Constant $lang,
            $lineno, $tag = null
    Severity: Minor
    Found in src/I18n/Twig/PluralizeNode.php - About 45 mins to fix

      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              Twig_NodeInterface $body,
              Twig_Node_Expression_Array $params,
              Twig_Node_Expression_Constant $lang,
              $lineno, $tag = null
      Severity: Minor
      Found in src/I18n/Twig/TranslateNode.php - About 35 mins to fix

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

            public function loadClass($className)
            {
                if ($filePath = $this->resolveFileName($className)) {
                    if ($this->getFailureFlag() & self::FAIL_GRACEFULLY) {
                        if ($this->classFileExists($filePath)) {
        Severity: Minor
        Found in src/SplClassLoader.php - About 35 mins to fix

        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 init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function init(LoaderInterface $loader, $lang = null, $timezone = null)
            {
                $this->setLoader($loader);
                if (is_null($lang)) {
                    $lang = substr(Locale::getDefault(), 0, 2);
        Severity: Minor
        Found in src/I18n/I18n.php - About 35 mins to fix

        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 parseStringMetadata has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function parseStringMetadata($str)
            {
                $info = array();
                if (0!==preg_match('~^\[([^\]]+)\]~i', $str, $matches)) {
                    $str = str_replace($matches[0], '', $str);
        Severity: Minor
        Found in src/I18n/I18n.php - About 35 mins to fix

        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 translate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function translate($index, array $args = null, $lang = null)
            {
                $_this = self::getInstance();
                if (!is_null($lang)) {
                    $original_lang = $_this->getLanguage();
        Severity: Minor
        Found in src/I18n/I18n.php - About 35 mins to fix

        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

        Avoid too many return statements within this method.
        Open

                return $this;
        Severity: Major
        Found in src/I18n/I18n.php - About 30 mins to fix

          Function getGitHubCommits has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function getGitHubCommits( github, callback ) {
              $.ajax(github+'commits', {
                  method: 'GET',
                  crossDomain: true,
                  data: { page: 1, per_page: 5 },
          Severity: Minor
          Found in demo/assets/scripts.js - About 25 mins to fix

          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 getGitHubBugs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function getGitHubBugs( github, callback ) {
              $.ajax(github+'issues', {
                  method: 'GET',
                  crossDomain: true,
                  data: { page: 1, per_page: 5 },
          Severity: Minor
          Found in demo/assets/scripts.js - About 25 mins to fix

          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 getParsedOption has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getParsedOption($name, $lang = null, $default = null)
              {
                  $val = $this->getOption($name, $default);
                  if (false!==strpos($val, '%s')) {
                      if (is_null($lang)) {
          Severity: Minor
          Found in src/I18n/Loader.php - About 25 mins to fix

          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

          Severity
          Category
          Status
          Source
          Language