atelierspierrot/library

View on GitHub

Showing 148 of 159 total issues

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

    public static function getopt(array $options)
    {
        $short_options = implode('', array_keys($options['argv_options']));
        $long_options = array_keys($options['argv_long_options']);
        if (!empty($options['commands'])) {
Severity: Minor
Found in src/Library/CommandLine/Helper.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 getOptionHelp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getOptionHelp($arg, $caller)
    {
        if (!is_object($caller) || !($caller instanceof CommandLineControllerInterface)) {
            throw new InvalidArgumentException(
                sprintf('Argument 2 for method "%s::getOptionHelp" must be an object and implement the "CommandLineControllerInterface" interface!', __CLASS__)
Severity: Minor
Found in src/Library/CommandLine/Helper.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 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 prepareContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepareContent($content)
    {
        if (is_array($content)) {
            $ctt = '';
            foreach ($content as $key=>$ctt) {
Severity: Minor
Found in src/Library/HttpFundamental/ContentType/PlainText.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 _getPartColumn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _getPartColumn($column_index, $part)
    {
        if (property_exists($this, $part)) {
            if (is_null($column_index)) {
                $column_index = $this->getColumnSize();
Severity: Minor
Found in src/Library/Tool/Table.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 romanToInt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function romanToInt($str = null)
    {
        if (is_null($str)) {
            return null;
        }
Severity: Minor
Found in src/Library/Helper/RomanNumber.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 isUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function isUrl($url = null, $protocols = array('http','https','ftp'), $localhost = false)
    { 
        if (is_null($url) || !$url || !is_string($url)) {
            return false;
        }
Severity: Minor
Found in src/Library/Helper/Url.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 getOptionDescription has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getOptionDescription($arg, $caller)
    {
        if (!is_object($caller) || !($caller instanceof CommandLineControllerInterface)) {
            throw new InvalidArgumentException(
                sprintf('Argument 2 for method "%s::getOptionDescription" must be an object and implement the "CommandLineControllerInterface" interface!', __CLASS__)
Severity: Minor
Found in src/Library/CommandLine/Helper.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 isPrime has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function isPrime($val = null)
    {
        if (is_null($val)) {
            return null;
        }
Severity: Minor
Found in src/Library/Helper/Number.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 _organizeCookieFuncArguments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _organizeCookieFuncArguments()
    {
        $original_args = $this->_arguments;
        $this->_arguments = array();
        $missing_var = $missing_index = null;
Severity: Minor
Found in src/Library/HttpFundamental/Cookie.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 null;
Severity: Major
Found in src/Library/Factory.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return $ok;
    Severity: Major
    Found in src/Library/Helper/Directory.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                          return true;
      Severity: Major
      Found in src/Library/Helper/Directory.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return false;
        Severity: Major
        Found in src/Library/Helper/Directory.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return null;
          Severity: Major
          Found in src/Library/Helper/Number.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return null;
            Severity: Major
            Found in src/Library/Factory.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return $_cls;
              Severity: Major
              Found in src/Library/Factory.php - About 30 mins to fix

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

                    public static function getUniqFilename($filename = '', $dir = null, $force_file = true, $extension = 'txt')
                    {
                        if (empty($filename)) {
                            return '';
                        }
                Severity: Minor
                Found in src/Library/Helper/File.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

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

                    public function fetch($display = true, $exit = false, $last_nl = true)
                    {
                        $str='';
                        if (!empty($this->messages)) {
                            foreach($this->messages as $i=>$_message) {
                Severity: Minor
                Found in src/Library/CommandLine/Formater.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

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

                    public static function touch($file_path = null, array &$logs = array())
                    {
                        if (is_null($file_path)) {
                            return null;
                        }
                Severity: Minor
                Found in src/Library/Helper/File.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