| Conditions | 22 | 
| Paths | 43 | 
| Total Lines | 109 | 
| Code Lines | 76 | 
| Lines | 13 | 
| Ratio | 11.93 % | 
| Changes | 6 | ||
| Bugs | 0 | Features | 3 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 23 | private function loadAdditionalContent(&$views, $route, $routeIndex)  | 
            ||
| 24 |     { | 
            ||
| 25 |         foreach ($views as $id => $view) { | 
            ||
| 26 | $meta = isset($view["data"]["meta"])  | 
            ||
| 27 | ? $view["data"]["meta"]  | 
            ||
| 28 | : null;  | 
            ||
| 29 | |||
| 30 |             if (is_array($meta)) { | 
            ||
| 31 |                 switch ($meta["type"]) { | 
            ||
| 32 | case "article-toc":  | 
            ||
| 33 | $content = $views["main"]["data"]["content"];  | 
            ||
| 34 | $views[$id]["data"]["articleToc"] = $this->di->textFilter->createToc($content);  | 
            ||
| 35 | break;  | 
            ||
| 36 | |||
| 37 | case "breadcrumb":  | 
            ||
| 38 | $views[$id]["data"]["breadcrumb"] = $this->createBreadcrumb($route);  | 
            ||
| 39 | break;  | 
            ||
| 40 | |||
| 41 | View Code Duplication | case "next-previous":  | 
            |
| 42 | $baseRoute = dirname($routeIndex);  | 
            ||
| 43 | list($next, $previous) = $this->findNextAndPrevious($routeIndex);  | 
            ||
| 44 | $views[$id]["data"]["next"] = $next;  | 
            ||
| 45 | $views[$id]["data"]["previous"] = $previous;  | 
            ||
| 46 | break;  | 
            ||
| 47 | |||
| 48 | case "single": // OBSOLETE  | 
            ||
| 49 | case "content":  | 
            ||
| 50 | $route = $this->getActiveRoute($meta["route"], $routeIndex);  | 
            ||
| 51 | |||
| 52 | // Load and parse route as view. Load meta view  | 
            ||
| 53 | // if any.  | 
            ||
| 54 | // Current view details preceds the loaded once.  | 
            ||
| 55 | $view = $this->loadAndParseRoute($route);  | 
            ||
| 56 | $views[$id] = array_merge_recursive_distinct($view, $views[$id]);  | 
            ||
| 57 | break;  | 
            ||
| 58 | |||
| 59 | case "columns":  | 
            ||
| 60 | // Each column is an own view set with details  | 
            ||
| 61 | // Process as meta view and load additional content  | 
            ||
| 62 | $template = isset($meta["template"])  | 
            ||
| 63 | ? $meta["template"]  | 
            ||
| 64 | : null;  | 
            ||
| 65 | $columns = $meta["columns"];  | 
            ||
| 66 |                         foreach ($columns as $key => $view) { | 
            ||
| 67 | $views2 = [ "main" => $view ];  | 
            ||
| 68 | $this->loadAdditionalContent($views2, $route, $routeIndex);  | 
            ||
| 69 | $columns[$key] = $views2["main"];  | 
            ||
| 70 | |||
| 71 |                             if ($template) { | 
            ||
| 72 | $columns[$key]["template"] = $template;  | 
            ||
| 73 | }  | 
            ||
| 74 | }  | 
            ||
| 75 | $views[$id]["data"]["columns"] = $columns;  | 
            ||
| 76 | break;  | 
            ||
| 77 | |||
| 78 | case "toc-sort":  | 
            ||
| 79 | $baseRoute = dirname($routeIndex);  | 
            ||
| 80 | $this->orderToc($baseRoute, $meta);  | 
            ||
| 81 | break;  | 
            ||
| 82 | |||
| 83 | View Code Duplication | case "toc":  | 
            |
| 84 | $baseRoute = dirname($routeIndex);  | 
            ||
| 85 | $toc = $this->meta[$baseRoute]["__toc__"];  | 
            ||
| 86 | $this->limitToc($toc, $meta);  | 
            ||
| 87 | $views[$id]["data"]["toc"] = $toc;  | 
            ||
| 88 | $views[$id]["data"]["meta"] = $meta;  | 
            ||
| 89 | break;  | 
            ||
| 90 | |||
| 91 | case "toc-route":  | 
            ||
| 92 | // Get the toc for a specific route  | 
            ||
| 93 | $route = $this->getActiveRoute($meta["route"], $routeIndex);  | 
            ||
| 94 | $routeIndex2 = $this->mapRoute2IndexKey($route);  | 
            ||
| 95 | $baseRoute = dirname($routeIndex2);  | 
            ||
| 96 | |||
| 97 | // Include support for ordering  | 
            ||
| 98 | if (isset($meta["orderby"])  | 
            ||
| 99 |                             || isset($meta["orderorder"])) { | 
            ||
| 100 | $this->orderToc($baseRoute, $meta);  | 
            ||
| 101 | }  | 
            ||
| 102 | |||
| 103 | // Same as toc  | 
            ||
| 104 | $toc = $this->meta[$baseRoute]["__toc__"];  | 
            ||
| 105 | $this->limitToc($toc, $meta, $baseRoute);  | 
            ||
| 106 | $views[$id]["data"]["toc"] = $toc;  | 
            ||
| 107 | $views[$id]["data"]["meta"] = $meta;  | 
            ||
| 108 | break;  | 
            ||
| 109 | |||
| 110 | case "book-toc":  | 
            ||
| 111 | $toc = $this->meta[$baseRoute]["__toc__"];  | 
            ||
| 112 | $views[$id]["data"]["toc"] = $toc;  | 
            ||
| 113 | break;  | 
            ||
| 114 | |||
| 115 | case "author":  | 
            ||
| 116 |                         if (isset($views["main"]["data"]["author"])) { | 
            ||
| 117 | $views[$id]["data"]["author"] = $this->loadAuthorDetails($views["main"]["data"]["author"]);  | 
            ||
| 118 | }  | 
            ||
| 119 | break;  | 
            ||
| 120 | |||
| 121 | case "copy":  | 
            ||
| 122 | $viewToCopy = $views[$id]["data"]["meta"]["view"];  | 
            ||
| 123 | $views[$id]["data"] = $views[$viewToCopy]["data"];  | 
            ||
| 124 | break;  | 
            ||
| 125 | |||
| 126 | default:  | 
            ||
| 127 |                         throw new Exception(t("Unsupported data/meta/type '!TYPE' for additional content.", ["!TYPE" => $meta["type"]])); | 
            ||
| 128 | }  | 
            ||
| 129 | }  | 
            ||
| 130 | }  | 
            ||
| 131 | }  | 
            ||
| 132 | |||
| 281 | 
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.