autowp/zf-components

View on GitHub

Showing 15 of 60 total issues

Method __invoke has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __invoke($time)
    {
        if (! $time instanceof DateTime) {
            $dateTime = new DateTime();
            $dateTime->setTimestamp($time);
Severity: Major
Found in src/View/Helper/HumanTime.php - About 2 hrs to fix

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

        public function __invoke($time)
        {
            if (! $time instanceof DateTime) {
                $dateTime = new DateTime();
                $dateTime->setTimestamp($time);
    Severity: Minor
    Found in src/View/Helper/HumanTime.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 __invoke has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): TransportInterface
        {
            $config     = $container->has('config') ? $container->get('config') : [];
            $mailConfig = $config['mail'] ?? [];
    
    
    Severity: Minor
    Found in src/Mail/Transport/TransportServiceFactory.php - About 1 hr to fix

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

          public function __invoke($attribs = [], $content = '', $escape = true)
          {
              if (! $content && ! $attribs) {
                  return $this;
              }
      Severity: Minor
      Found in src/View/Helper/HtmlA.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 __invoke has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __invoke(array $options = [], string $manifest = 'default'): self
          {
              if (isset($options['stylesheets']) && is_array($options['stylesheets'])) {
                  foreach ($options['stylesheets'] as $file) {
                      $this->addStylesheet($file, 'screen', $manifest);
      Severity: Minor
      Found in src/View/Helper/GulpRev.php - About 45 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 __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct(array $options)
          {
              $manifests = [];
              if (isset($options['manifests']) && is_array($options['manifests'])) {
                  $manifests = $options['manifests'];
      Severity: Minor
      Found in src/GulpRev.php - About 45 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 __invoke has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null): TransportInterface
          {
              $config     = $container->has('config') ? $container->get('config') : [];
              $mailConfig = $config['mail'] ?? [];
      
      
      Severity: Minor
      Found in src/Mail/Transport/TransportServiceFactory.php - About 45 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 sprintf(
                      $this->view->translatePlural('%1$s minutes ago', null, $minutes),
                      $minutes
                  );
      Severity: Major
      Found in src/View/Helper/HumanTime.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return $this->view->translate('an hour ago');
        Severity: Major
        Found in src/View/Helper/HumanTime.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return $this->view->translate('in few seconds');
          Severity: Major
          Found in src/View/Helper/HumanTime.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return $this->view->humanDate($time);
            Severity: Major
            Found in src/View/Helper/HumanTime.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return $this->view->translate('few seconds ago');
              Severity: Major
              Found in src/View/Helper/HumanTime.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $this->view->translate('a minute ago');
                Severity: Major
                Found in src/View/Helper/HumanTime.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return $this->view->translate('now');
                  Severity: Major
                  Found in src/View/Helper/HumanTime.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return sprintf(
                                    $this->view->translatePlural('%1$s hours ago', null, $hours),
                                    $hours
                                );
                    Severity: Major
                    Found in src/View/Helper/HumanTime.php - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language