MPOS/php-mpos

View on GitHub

Showing 889 of 1,089 total issues

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

    public function setUserAgent($userAgent = null)
    {
        if (!empty($userAgent)) {
            return $this->userAgent = $userAgent;
        } else {
Severity: Minor
Found in include/lib/Mobile_Detect.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 scryptBlockMix has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function scryptBlockMix($b, $r)
    {
        $x = substr($b, -64);
        $even = '';
        $odd = '';
Severity: Minor
Found in include/lib/scrypt.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 deleteAccountedShares has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public function deleteAccountedShares($current_upstream, $previous_upstream=0) {
    // Fallbacks if unset
    if (!isset($this->config['purge']['shares'])) $this->config['purge']['shares'] = 25000;
    if (!isset($this->config['purge']['sleep'])) $this->config['purge']['sleep'] = 1;

Severity: Minor
Found in include/classes/share.class.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 toSMimeByteStream has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function toSMimeByteStream(Swift_InputByteStream $inputStream, Swift_Message $message)
    {
        $mimeEntity = $this->createMessage($message);
        $messageStream = new Swift_ByteStream_TemporaryFileByteStream();

Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Signers/SMimeSigner.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 readLine has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function readLine($sequence)
    {
        if (isset($this->_out) && !feof($this->_out)) {
            $line = fgets($this->_out);
            if (strlen($line)==0) {
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Transport/StreamBuffer.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 _canonicalizeBody has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _canonicalizeBody($string)
    {
        if (! $this->_peclLoaded) {
            return parent::_canonicalizeBody($string);
        }
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Signers/OpenDKIMSigner.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 _tokensToString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function _tokensToString(array $tokens)
    {
        $lineCount = 0;
        $headerLines = array();
        $headerLines[] = $this->_name . ': ';
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.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 _doAnchors_reference_callback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _doAnchors_reference_callback($matches) {
        $whole_match =  $matches[1];
        $link_text   =  $matches[2];
        $link_id     =& $matches[3];

Severity: Minor
Found in include/lib/Michelf/Markdown.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 encodeByteStream has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
    {
        if (0 >= $maxLineLength || 76 < $maxLineLength) {
            $maxLineLength = 76;
        }

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

    public function send(Swift_Mime_Message $message, &$failedRecipients = null)
    {
        $maxTransports = count($this->_transports);
        $sent = 0;

Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Transport/FailoverTransport.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 parseSpan has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function parseSpan($str) {
    #
    # Take the string $str and parse it into tokens, hashing embeded HTML,
    # escaped characters and handling code spans.
    #
Severity: Minor
Found in include/lib/Michelf/Markdown.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 setParam has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function setParam($param, $value)
    {
        if (isset($this->_stream)) {
            switch ($param) {
                case 'timeout':
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Transport/StreamBuffer.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 read has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function read($length)
    {
        if (isset($this->_out) && !feof($this->_out)) {
            $ret = fread($this->_out, $length);
            if (strlen($ret)==0) {
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Transport/StreamBuffer.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 _doImages_reference_callback has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _doImages_reference_callback($matches) {
        $whole_match = $matches[1];
        $alt_text    = $matches[2];
        $link_id     = strtolower($matches[3]);

Severity: Minor
Found in include/lib/Michelf/Markdown.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 $return;
Severity: Major
Found in include/smarty/libs/plugins/modifier.escape.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return;
    Severity: Major
    Found in include/smarty/libs/plugins/function.fetch.php - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return "Extremely weak";
      Severity: Major
      Found in public/site_assets/bootstrap/js/pwcheck.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          return "#999";
        Severity: Major
        Found in public/site_assets/bootstrap/js/pwcheck.js - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return $return;
          Severity: Major
          Found in include/smarty/libs/plugins/modifier.escape.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return "1 month ago"; 
            Severity: Major
            Found in include/smarty/libs/plugins/modifier.relative_date.php - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language