MPOS/php-mpos

View on GitHub

Showing 1,089 of 1,089 total issues

Swift_Mime_Headers_AbstractHeader has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
{
    /**
     * The name of this Header.
     *
Severity: Minor
Found in include/lib/swiftmailer/classes/Swift/Mime/Headers/AbstractHeader.php - About 3 hrs to fix

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

            if (!isset($compiler->smarty->security_policy) && file_exists($_file)) {
                $_filepath = $_file;
            } else {
                if (isset($compiler->smarty->security_policy)) {
                    $_dir = $compiler->smarty->security_policy->trusted_dir;
    include/smarty/libs/sysplugins/smarty_internal_compile_insert.php on lines 76..93

    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 141.

    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

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

                if (!isset($compiler->smarty->security_policy) && file_exists($_script)) {
                    $_filepath = $_script;
                } else {
                    if (isset($compiler->smarty->security_policy)) {
                        $_dir = $compiler->smarty->security_policy->trusted_dir;
    include/smarty/libs/sysplugins/smarty_internal_compile_include_php.php on lines 62..79

    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 141.

    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

    Method clearCompiledTemplate has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function clearCompiledTemplate($resource_name, $compile_id, $exp_time, Smarty $smarty)
        {
            $_compile_dir = $smarty->getCompileDir();
            $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
            $_dir_sep = $smarty->use_sub_dirs ? DS : '^';
    Severity: Major
    Found in include/smarty/libs/sysplugins/smarty_internal_utility.php - About 2 hrs to fix

      Method compileChildBlock has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          static function compileChildBlock($compiler, $_name = null)
          {
              if ($compiler->inheritance_child) {
                  $name1 = Smarty_Internal_Compile_Block::$nested_block_names[0];
                  if (isset($compiler->template->block_data[$name1])) {
      Severity: Major
      Found in include/smarty/libs/sysplugins/smarty_internal_compile_block.php - About 2 hrs to fix

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

            public function compile($args, $compiler)
            {
                // check and get attributes
                $_attr = $this->getAttributes($compiler, $args);
                // never compile as nocache code
        Severity: Major
        Found in include/smarty/libs/sysplugins/smarty_internal_compile_insert.php - About 2 hrs to fix

          Method checkLogin has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public function checkLogin($username, $password) {
              $this->debug->append("STA " . __METHOD__, 4);
              $this->debug->append("Checking login for $username with password $password", 2);
              if (empty($username) || empty($password)) {
                $this->setErrorMessage("Invalid username or password.");
          Severity: Major
          Found in include/classes/user.class.php - About 2 hrs to fix

            Function getPluginFromDefaultHandler has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getPluginFromDefaultHandler($tag, $plugin_type)
                {
                    $callback = null;
                    $script = null;
                    $cacheable = true;

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

                private function _restoreMessage(Swift_Mime_Message $message)
                {
                    if ($this->_lastMessage === $message) {
                        if (isset($this->_originalBody)) {
                            $message->setBody($this->_originalBody);
            Severity: Minor
            Found in include/lib/swiftmailer/classes/Swift/Plugins/DecoratorPlugin.php - About 2 hrs 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 write has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                public function write($chars)
                {
                    if (!isset($this->_charReader)) {
                        $this->_charReader = $this->_charReaderFactory->getReaderFor(
                            $this->_charset);

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

                public function setHeaders(Swift_Mime_HeaderSet $headers)
                {
                    $bodyLen = $this->_bodyLen;
                    if (is_bool($bodyLen)) {
                        $bodyLen = - 1;
            Severity: Minor
            Found in include/lib/swiftmailer/classes/Swift/Signers/OpenDKIMSigner.php - About 2 hrs 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 21 (exceeds 5 allowed). Consider refactoring.
            Open

                public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
                {
                    if ($maxLineLength > 76 || $maxLineLength <= 0) {
                        $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 __construct has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                public function __construct($search, $replace)
                {
                    $this->_search = $search;
                    $this->_index = array();
                    $this->_tree = array();

            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 smarty_modifiercompiler_escape has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function smarty_modifiercompiler_escape($params, $compiler)
            {
                static $_double_encode = null;
                if ($_double_encode === null) {
                    $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
            Severity: Major
            Found in include/smarty/libs/plugins/modifiercompiler.escape.php - About 2 hrs to fix

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

                  public function compile($args, $compiler)
                  {
                      $compiler->has_code = true;
                      // check and get attributes
                      $_attr = $this->getAttributes($compiler, $args);
              Severity: Major
              Found in include/smarty/libs/sysplugins/smarty_internal_compile_block.php - About 2 hrs to fix

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

                        } else {
                            if (isset($this->template->required_plugins['compiled'][$plugin_name][$plugin_type])) {
                                $function = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'];
                            } elseif (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {
                                $this->template->required_plugins['compiled'][$plugin_name][$plugin_type] = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type];
                include/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on lines 583..597

                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 139.

                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

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

                        if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
                            if (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {
                                $function = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'];
                            } elseif (isset($this->template->required_plugins['compiled'][$plugin_name][$plugin_type])) {
                                $this->template->required_plugins['nocache'][$plugin_name][$plugin_type] = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type];
                include/smarty/libs/sysplugins/smarty_internal_templatecompilerbase.php on lines 590..597

                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 139.

                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

                File function.html_select_time.php has 285 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * Smarty plugin
                 *
                 * @package Smarty
                Severity: Minor
                Found in include/smarty/libs/plugins/function.html_select_time.php - About 2 hrs to fix

                  Method compileTemplate has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function compileTemplate(Smarty_Internal_Template $template, $nocache = false)
                      {
                          if (empty($template->properties['nocache_hash'])) {
                              $template->properties['nocache_hash'] = $this->nocache_hash;
                          } else {

                    Swift_Signers_DomainKeySigner has 25 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
                    {
                        /**
                         * PrivateKey
                         *
                    Severity: Minor
                    Found in include/lib/swiftmailer/classes/Swift/Signers/DomainKeySigner.php - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language