Showing 51 of 53 total issues

Method updateDatabase has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function updateDatabase()
    {
        set_time_limit(0);
        $blog = $this->db->insert('blog', array('page', 'path', 'title', 'featured', 'published', 'updated', 'author_id', 'category_id', 'search', 'content'));
        $tagged = $this->db->insert('tagged', array('blog_id', 'tag_id'));
Severity: Minor
Found in src/Blog.php - About 1 hr to fix

    Method archives has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function archives($params, array $vars = array())
        {
            $page = Page::html();
            list($path, $Y, $m, $d) = array_pad(array_values($params), 4, '');
            if (!empty($d)) {
    Severity: Minor
    Found in src/Component.php - About 1 hr to fix

      Method listings has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function listings($params, array $vars = array())
          {
              $page = Page::html();
              extract($params); // 'path'?, 'category'? and 'search'?
              if (isset($category)) {
      Severity: Minor
      Found in src/Component.php - About 1 hr to fix

        Function listings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            private function listings($params, array $vars = array())
            {
                $page = Page::html();
                extract($params); // 'path'?, 'category'? and 'search'?
                if (isset($category)) {
        Severity: Minor
        Found in src/Component.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 renderTwig has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            public function renderTwig($file, array $vars = array())
            {
                $page = Page::html();
                if (is_array($file)) {
                    $vars = (isset($file['vars']) && is_array($file['vars'])) ? $file['vars'] : array();
        Severity: Minor
        Found in src/Twig/Theme.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 getFiles has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getFiles($name, $default = null)
            {
                $files = array();
                if (!empty($name)) {
                    $page = Page::html();
        Severity: Minor
        Found in src/Twig/Theme.php - About 1 hr to fix

          Method page has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function page()
              {
                  $page = Page::html();
                  $listings = $this->config('blog', 'listings');
                  if ($page->url['format'] != 'html') {
          Severity: Minor
          Found in src/Component.php - About 1 hr to fix

            Function page has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                public function page()
                {
                    $page = Page::html();
                    $listings = $this->config('blog', 'listings');
                    if ($page->url['format'] != 'html') {
            Severity: Minor
            Found in src/Component.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 parseArrayExpression has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                public function parseArrayExpression()
                {
                    $stream = $this->parser->getStream();
                    $stream->expect(Twig_Token::PUNCTUATION_TYPE, '[', 'An array element was expected');
            
            
            Severity: Minor
            Found in src/Twig/ExpressionParser.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 this has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                public function this(\Twig_Template $twig, $key = null, $value = null)
                {
                    $name = $twig->getTemplateName();
                    if (!isset($this->plugin[$name])) {
                        $this->plugin[$name] = array();
            Severity: Minor
            Found in src/Twig/Theme.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 wringer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                private static function wringer($data)
                {
                    if (is_object($data)) {
                        if ($data instanceof \BootPress\Blog\Twig\Object) {
                            $data = $data->properties + $data->methods;
            Severity: Minor
            Found in src/Twig/Theme.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 updateConfig has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                private function updateConfig()
                {
                    if ($this->getId('updated', 'anything') === false) {
                        return;
                    }
            Severity: Minor
            Found in src/Blog.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 blog has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                private function blog($params, array $vars = array())
                {
                    $page = Page::html();
                    extract($params); // 'id' and 'path'
                    $page->enforce($path);
            Severity: Minor
            Found in src/Component.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 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function __construct($folder = 'blog')
                {
                    $page = Page::html();
            
                    // $this->folder
            Severity: Minor
            Found in src/Blog.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 layout has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function layout($html)
                {
                    $page = Page::html();
                    $theme = $page->theme;
                    if ($theme === false) {
            Severity: Minor
            Found in src/Twig/Theme.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 asset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function asset($path, \Twig_Template $twig = null)
                {
                    if (is_string($path)) {
                        if ($this->asset && preg_match('/^'.implode('', array(
                            '(?!((f|ht)tps?:)?\/\/)',
            Severity: Minor
            Found in src/Twig/Theme.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 $posts;
            Severity: Major
            Found in src/Blog.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return array_values($posts);
              Severity: Major
              Found in src/Blog.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                        return $this->db->value(array(
                                            'SELECT COUNT(*) FROM tagged AS t',
                                            'INNER JOIN blog AS b ON t.blog_id = b.id',
                                            'INNER JOIN tags ON t.tag_id = tags.id',
                                            'WHERE b.featured <= 0 AND b.published < 0 AND tags.path = ?',
                Severity: Major
                Found in src/Blog.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return $posts;
                  Severity: Major
                  Found in src/Blog.php - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language