Showing 10 of 24 total issues
Function setNamespaces
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function setNamespaces()
{
foreach ($this->data[self::TOPICS] as $topic) {
if (!isset($topic[self::EXISTS])) {
$this->vars[self::MISSING][] = $topic[self::ASTERISK]; // page does not exist
- Read upRead up
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 setNamespaces
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function setNamespaces()
{
foreach ($this->data[self::TOPICS] as $topic) {
if (!isset($topic[self::EXISTS])) {
$this->vars[self::MISSING][] = $topic[self::ASTERISK]; // page does not exist
File Topic.php
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Just Refs - https://github.com/attogram/justrefs
* Topic Class
*/
Function listify
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function listify($index)
{
if (in_array($index, [self::EXISTS, self::MISSING]) // skip internal-usage vars
|| empty($this->vars[$index]) // Error - index not found, or index empty
) {
- Read upRead up
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 removeTemplateTopics
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function removeTemplateTopics()
{
if (empty($this->vars[self::MAIN])
|| (empty($this->vars[self::TEMPLATE]) && $this->vars[self::TEMPLATE_SECONDARY])
) {
- Read upRead up
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 setTemplates
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function setTemplates()
{
foreach ($this->data[self::TEMPLATES] as $item) {
switch ($item[self::NS]) {
case '0': // Main
- Read upRead up
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 links
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function links($query)
{
$data = $this->getApi($this->api . $this->apiLinks . urlencode($query));
if (!$data || !is_array($data)) {
$this->error('links: decode failed: ' . $query);
Function match
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function match($match)
{
switch ($match) {
case self::TOPIC:
(new Topic($this->verbose, $this->router, $this->template))->get();
- Read upRead up
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 get
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function get()
{
if (!$this->setTopicFromUrl()) { // build topic from URL
$this->error404(self::ERROR_NOT_FOUND);
}
- Read upRead up
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 search
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function search($query)
{
$data = $this->getApi($this->api . $this->apiSearch . urlencode($query));
if (!$data || !is_array($data) || empty($data[self::QUERY])
|| empty($data[self::QUERY][self::SEARCH]) || !is_array($data[self::QUERY][self::SEARCH])
- Read upRead up
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"