File ParseValue.php
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace Wikibase\Repo\Api;
Method getParser
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getParser(): ValueParser {
$params = $this->extractRequestParams();
$options = $this->getOptionsObject( $params['options'] );
Method factory
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
ApiMain $mainModule,
string $moduleName,
IBufferingStatsdDataFactory $stats,
ApiHelperFactory $apiHelperFactory,
DataTypeFactory $dataTypeFactory,
Method __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
ApiMain $mainModule,
string $moduleName,
DataTypeFactory $dataTypeFactory,
ValueParserFactory $valueParserFactory,
DataTypeValidatorFactory $dataTypeValidatorFactory,
Method getAllowedParams
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAllowedParams(): array {
return [
'datatype' => [
ParamValidator::PARAM_TYPE => $this->dataTypeFactory->getTypeIds(),
ParamValidator::PARAM_REQUIRED => false,
Method parseStringValue
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function parseStringValue( ValueParser $parser, string $value, ?ValueValidator $validator ): array {
$result = [
'raw' => $value,
];
Function getParser
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function getParser(): ValueParser {
$params = $this->extractRequestParams();
$options = $this->getOptionsObject( $params['options'] );
- 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 parseStringValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function parseStringValue( ValueParser $parser, string $value, ?ValueValidator $validator ): array {
$result = [
'raw' => $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
Function getOptionsObject
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getOptionsObject( ?string $optionsParam ): ParserOptions {
$parserOptions = new ParserOptions();
$parserOptions->setOption( ValueParser::OPT_LANG, $this->getLanguage()->getCode() );
if ( is_string( $optionsParam ) && $optionsParam !== '' ) {
- 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"