Showing 9 of 17 total issues
Node
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Node implements NodeInterface, ElementsAwareInterface, ArrayableInterface
{
use ElementsAwareTrait;
protected ArrayIterator $categories;
Feed
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Feed extends Node implements FeedInterface, ArrayableInterface, \JsonSerializable
{
protected ArrayIterator $items;
protected ArrayIterator $ns;
Function toArray
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function toArray(): array
{
$properties = get_object_vars($this);
$properties['elements'] = iterator_to_array($this->getElementsGenerator());
$properties['categories'] = iterator_to_array($this->getCategoriesGenerator());
- 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 extractFeeds
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function extractFeeds(string $html, string $url = null): array
{
$dom = new DOMDocument();
$dom->loadHTML($html);
- 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 setHostInContent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function setHostInContent(string $host = null): void
{
if (property_exists($this, 'content')){
if (!is_null($host) && !is_null($this->content)) {
$this->content = preg_replace('!(<*\s*[^>]*)(href=)(.?)(\/[^\/])!','\1 href=\3'.$host.'\4', $this->content );
- 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
protected Document $document,
protected FeedInterface $feed,
protected DateTime $modifiedSince,
protected ResponseInterface $response,
protected string $url
Function filter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function filter(FeedInterface $feed): iterable
{
foreach ($feed as $item) {
foreach ($this->filters as $filter) {
if (!$filter->filter($item)) {
- 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 setProperty
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function setProperty(NodeInterface $node, \DOMElement $element): void
{
if ($node instanceof FeedInterface) {
for ($i = $element->childNodes->length; --$i >= 0;) {
$child = $element->childNodes->item($i);
- 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 addElementsFromNodeList
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function addElementsFromNodeList(ElementsAwareInterface $node, ElementInterface $element, DOMNodeList $childNodeList): void
{
foreach ($childNodeList as $childNode) {
if ($childNode instanceof DOMText) {
continue;
- 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"