MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

Method __call has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __call($name, $args)
    {
        static $_prefixes = array('set' => true, 'get' => true);
        static $_resolved_property_name = array();
        static $_resolved_property_source = array();
Severity: Minor
Found in include/smarty/libs/sysplugins/smarty_internal_templatebase.php - About 1 hr to fix

    Method yylex3 has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function yylex3()
        {
            $tokenMap = array (
                  1 => 0,
                );
    Severity: Minor
    Found in include/smarty/libs/sysplugins/smarty_internal_configfilelexer.php - About 1 hr to fix

      Method smarty_outputfilter_trimwhitespace has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function smarty_outputfilter_trimwhitespace($source, Smarty_Internal_Template $smarty)
      {
          $store = array();
          $_store = 0;
          $_offset = 0;
      Severity: Minor
      Found in include/smarty/libs/plugins/outputfilter.trimwhitespace.php - About 1 hr to fix

        Method to_smarty_php has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function to_smarty_php()
            {
                $code = '';
                for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key++) {
                    if ($key + 2 < $cnt) {
        Severity: Minor
        Found in include/smarty/libs/sysplugins/smarty_internal_parsetree.php - About 1 hr to fix

          Method sendMail has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public function sendMail($template, $aData, $throttle=false) {
              // Prepare SMTP transport and mailer
              $transport_type = $this->config['swiftmailer']['type'];
              if ($transport_type == 'sendmail') {
                $transport = Swift_SendmailTransport::newInstance($this->config['swiftmailer'][$transport_type]['path'] . ' ' . $this->config['swiftmailer'][$transport_type]['options']);
          Severity: Minor
          Found in include/classes/mail.class.php - About 1 hr to fix

            Method _canonicalizeBody has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function _canonicalizeBody($string)
                {
                    $len = strlen($string);
                    $canon = '';
                    $nofws = ($this->_canon == "nofws");
            Severity: Minor
            Found in include/lib/swiftmailer/classes/Swift/Signers/DomainKeySigner.php - About 1 hr to fix

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  protected function decode($string)
                  {
                      // decode if specified
                      if (($pos = strpos($string, ':')) !== false) {
                          if (!strncmp($string, 'base64', 6)) {
              include/smarty/libs/sysplugins/smarty_internal_resource_eval.php on lines 55..67

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 116.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                  protected function decode($string)
                  {
                      // decode if specified
                      if (($pos = strpos($string, ':')) !== false) {
                          if (!strncmp($string, 'base64', 6)) {
              include/smarty/libs/sysplugins/smarty_internal_resource_string.php on lines 55..67

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 116.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Function compileTemplateSource has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function compileTemplateSource()
                  {
                      if (!$this->source->recompiled) {
                          $this->properties['file_dependency'] = array();
                          if ($this->source->components) {
              Severity: Minor
              Found in include/smarty/libs/sysplugins/smarty_internal_template.php - About 1 hr 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 updatePassword has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                public function updatePassword($userID, $current, $new1, $new2, $strToken) {
                  $this->debug->append("STA " . __METHOD__, 4);
                  if ($new1 !== $new2) {
                    $this->setErrorMessage( 'New passwords do not match' );
                    return false;
              Severity: Minor
              Found in include/classes/user.class.php - About 1 hr 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 resetPassword has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                public function resetPassword($token, $new1, $new2) {
                  $this->debug->append("STA " . __METHOD__, 4);
                  if ($aToken = $this->token->getToken($token, 'password_reset')) {
                    if ($new1 !== $new2) {
                      $this->setErrorMessage( 'New passwords do not match' );
              Severity: Minor
              Found in include/classes/user.class.php - About 1 hr 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 sendNotification has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                      public function sendNotification($account_id, $template, $aData){
                          $settings = $this->getNotificationSettings($account_id);
                          if ($settings['class']){
                              $instance = $this->getNotificatorInstance(array($settings['class'], $settings['file']), $settings['params']);
                              if ($instance){
              Severity: Minor
              Found in include/classes/pushnotification.class.php - About 1 hr 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 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function read($length)
                  {
                      if ($this->_currentPos>=$this->_charCount) {
                        return false;
                      }

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

                  protected function doExtraAttributes($tag_name, $attr) {
                  #
                  # Parse attributes caught by the $this->id_class_attr_catch_re expression
                  # and return the HTML-formatted list of attributes.
                  #
              Severity: Minor
              Found in include/lib/Michelf/Markdown.php - About 1 hr 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 appendFootnotes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function appendFootnotes($text) {
                  #
                  # Append footnote list to text.
                  #
                      $text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}', 
              Severity: Minor
              Found in include/lib/Michelf/Markdown.php - About 1 hr 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 addSignature has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function addSignature(Swift_Mime_HeaderSet $headers)
                  {
                      // Prepare the DKIM-Signature
                      $params = array('v' => '1', 'a' => $this->_hashAlgorithm, 'bh' => base64_encode($this->_bodyHash), 'd' => $this->_domainName, 'h' => implode(': ', $this->_signedHeaders), 'i' => $this->_signerIdentity, 's' => $this->_selector);
                      if ($this->_bodyCanon != 'simple') {
              Severity: Minor
              Found in include/lib/swiftmailer/classes/Swift/Signers/DKIMSigner.php - About 1 hr 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 send has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function send(Swift_Mime_Message $message, &$failedRecipients = null)
                  {
                      $failedRecipients = (array) $failedRecipients;
              
                      if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) {
              Severity: Minor
              Found in include/lib/swiftmailer/classes/Swift/Transport/MailTransport.php - About 1 hr 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 compileAllConfig has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function compileAllConfig($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
                  {
                      // switch off time limit
                      if (function_exists('set_time_limit')) {
                          @set_time_limit($time_limit);
              Severity: Minor
              Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 1 hr to fix

                Method loadPlugin has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function loadPlugin($plugin_name, $check = true)
                    {
                        // if function or class exists, exit silently (already loaded)
                        if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false))) {
                            return true;
                Severity: Minor
                Found in include/smarty/libs/Smarty.class.php - About 1 hr to fix

                  Method compile has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function compile($args, $compiler, $parameter)
                      {
                          $_attr = $this->getAttributes($compiler, $args);
                          $saved_data = $this->closeTag($compiler, array('function'));
                          $_name = trim($saved_data[0]['name'], "'\"");
                  Severity: Minor
                  Found in include/smarty/libs/sysplugins/smarty_internal_compile_function.php - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language