Showing 41 of 316 total issues
Function previewSession
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function previewSession(string $token, string $defaultUrl) : string
{
try {
// $token is untrusted input, possibly from a GET request and will be retrieved by the http client
$token = $this->validatePreviewToken($token);
- 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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
?string $name = null,
string $method,
?string $rel = null,
string $enctype,
string $action,
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $id,
string $ref,
string $label,
bool $isMasterRef,
?int $maybeScheduledAt = null
Function recentDocs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function recentDocs(int $count = 10) : array
{
/** @var SearchForm $form */
$form = $this->api->forms()->everything;
$form = $form->ref($this->api->ref());
- 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 factory
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function factory($value, LinkResolver $linkResolver) : self
{
$image = new static();
$value = isset($value->value) ? $value->value : $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 submit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function submit() : Response
{
if ($this->form->getMethod() !== 'GET' ||
$this->form->getEnctype() !== 'application/x-www-form-urlencoded' ||
! $this->form->getAction()
- 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 refFromCookie
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function refFromCookie(?string $cookie) :? string
{
if (empty($cookie)) {
return null;
}
- 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
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return;
Function isEmptyObject
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function isEmptyObject($value) : bool
{
if (is_object($value)) {
/** @var object $value */
$properties = get_object_vars($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 factory
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function factory($value, LinkResolver $linkResolver) : self
{
if (! is_object($value)) {
throw new InvalidArgumentException(sprintf(
'Expected an object as the collection value, received %s',
- 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 defaultData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function defaultData() : array
{
/**
* @var string $key
* @var FieldForm $field
- 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"