Showing 36 of 36 total issues
Function insertSpans
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
private static function insertSpans($text, array $spans, $linkResolver = null, $htmlSerializer = null)
{
if (empty($spans)) {
return htmlentities($text, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, 'UTF-8');
}
- 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 asHtml
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
public static function asHtml($richText, $linkResolver = null, $htmlSerializer = null)
{
$groups = [];
foreach ($richText as $block) {
- 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 serialize
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function serialize($element, $content, $linkResolver, $htmlSerializer) : string
{
if ($htmlSerializer) {
$custom = $htmlSerializer($element, $content);
if ($custom) {
Api
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class Api
{
/**
* Kit version number
Predicates
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class Predicates
{
/**
* @param string $fragment
File Api.php
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Prismic;
Function submit
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function submit() : array
{
$numargs = func_num_args();
if ($numargs == 1 && is_array(func_get_arg(0))) {
$forms = func_get_arg(0);
- 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 insertSpans
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function insertSpans($text, array $spans, $linkResolver = null, $htmlSerializer = null)
{
if (empty($spans)) {
return htmlentities($text, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, 'UTF-8');
}
Function serialize
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private static function serialize($element, $content, $linkResolver, $htmlSerializer) : string
{
if ($htmlSerializer) {
$custom = $htmlSerializer($element, $content);
if ($custom) {
- 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
File RichText.php
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Prismic\Dom;
use Prismic\Dom\BlockGroup;
Method asHtml
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function asHtml($richText, $linkResolver = null, $htmlSerializer = null)
{
$groups = [];
foreach ($richText as $block) {
Consider simplifying this complex logical expression. Open
if ($block->type === 'heading1' ||
$block->type === 'heading2' ||
$block->type === 'heading3' ||
$block->type === 'heading4' ||
$block->type === 'heading5' ||
Method submit
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function submit() : array
{
$numargs = func_num_args();
if ($numargs == 1 && is_array(func_get_arg(0))) {
$forms = func_get_arg(0);
Method set
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function set(string $key, $value) : self
{
if (empty($key)) {
throw new Exception\InvalidArgumentException('Form parameter key must be a non-empty string');
}
Method submitRaw
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function submitRaw() : stdClass
{
if ($this->form->getMethod() !== 'GET' ||
$this->form->getEnctype() !== 'application/x-www-form-urlencoded' ||
! $this->form->getAction()
Method __construct
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
array $refs,
array $bookmarks,
array $types,
array $languages,
array $tags,
Function set
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function set(string $key, $value) : self
{
if (empty($key)) {
throw new Exception\InvalidArgumentException('Form parameter key must be a non-empty string');
}
- 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,
string $method,
?string $rel,
string $enctype,
string $action,
Function recentDocs
has a Cognitive Complexity of 8 (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
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
string $id,
string $ref,
string $label,
bool $isMasterRef,
?int $maybeScheduledAt = null