File LogFormatter.php
has 592 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Contains a class for formatting log entries
*
* This program is free software; you can redistribute it and/or modify
Function getIRCActionText
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
public function getIRCActionText() {
$this->plaintext = true;
$this->irctext = true;
$entry = $this->entry;
- 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 getIRCActionText
has 182 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getIRCActionText() {
$this->plaintext = true;
$this->irctext = true;
$entry = $this->entry;
LogFormatter
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
class LogFormatter {
// Audience options for viewing usernames, comments, and actions
public const FOR_PUBLIC = 1;
public const FOR_THIS_USER = 2;
Method formatParameterValueForApi
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function formatParameterValueForApi( $name, $type, $value ) {
$type = strtolower( trim( $type ) );
switch ( $type ) {
case 'bool':
$value = (bool)$value;
Function extractParameters
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function extractParameters() {
$entry = $this->entry;
$params = [];
if ( $entry->isLegacy() ) {
- 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 formatParameterValueForApi
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function formatParameterValueForApi( $name, $type, $value ) {
$type = strtolower( trim( $type ) );
switch ( $type ) {
case 'bool':
$value = (bool)$value;
- 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 formatParameterValue
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function formatParameterValue( $type, $value ) {
$saveLinkFlood = $this->linkFlood;
switch ( strtolower( trim( $type ) ) ) {
case 'raw':
Function formatParameterValue
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function formatParameterValue( $type, $value ) {
$saveLinkFlood = $this->linkFlood;
switch ( strtolower( trim( $type ) ) ) {
case 'raw':
- 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 formatParametersForApi
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function formatParametersForApi() {
$logParams = [];
foreach ( $this->getParametersForApi() as $key => $value ) {
$vals = explode( ':', $key, 3 );
if ( count( $vals ) !== 3 ) {
- 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 getActionText
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getActionText() {
if ( $this->canView( LogPage::DELETED_ACTION ) ) {
$element = $this->getActionMessage();
if ( $element instanceof Message ) {
$element = $this->plaintext ? $element->text() : $element->escaped();
- 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 makePageLink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function makePageLink( Title $title = null, $parameters = [], $html = null ) {
if ( !$title instanceof Title ) {
$msg = $this->msg( 'invalidtitle' )->text();
if ( $this->plaintext ) {
return $msg;
- 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"