includes/ApiVisualEditorEdit.php
File ApiVisualEditorEdit.php
has 470 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
/**
* Parsoid/RESTBase+MediaWiki API wrapper.
*
* @file
Function execute
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
Open
public function execute() {
$user = $this->getUser();
$params = $this->extractRequestParams();
$result = [];
- 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 execute
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute() {
$user = $this->getUser();
$params = $this->extractRequestParams();
$result = [];
Method getAllowedParams
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getAllowedParams() {
return [
'paction' => [
ParamValidator::PARAM_REQUIRED => true,
ParamValidator::PARAM_TYPE => [
Method parseWikitext
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function parseWikitext( $newRevId, array $params ) {
$apiParams = [
'action' => 'parse',
'oldid' => $newRevId,
'prop' => 'text|revid|categorieshtml|sections|displaytitle|subtitle|modules|jsconfigvars',
Method diffWikitext
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function diffWikitext( Title $title, ?int $fromId, $wikitext, $section = null ) {
$apiParams = [
'action' => 'compare',
'prop' => 'diff',
// Because we're just providing wikitext, we only care about the main slot
Method saveWikitext
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function saveWikitext( Title $title, $wikitext, $params ) {
$apiParams = [
'action' => 'edit',
'title' => $title->getPrefixedDBkey(),
'text' => $wikitext,
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ApiMain $main,
string $name,
HookContainer $hookContainer,
IBufferingStatsdDataFactory $statsdDataFactory,
PageEditStash $pageEditStash,