Function fetch
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function fetch($url = null)
{
if (null !== $url) {
if (strpos($url, '://') === false) {
$url = $this->getAbsoluteUrl($url);
- 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 Client.php
has 342 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Yaoi\Http;
use Yaoi\Http\Client\Driver;
use Yaoi\Http\Client\Settings;
Method fetch
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fetch($url = null)
{
if (null !== $url) {
if (strpos($url, '://') === false) {
$url = $this->getAbsoluteUrl($url);
Function parseResponseCookies
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function parseResponseCookies()
{
$cookies = array();
$this->parsedHeaders = array();
foreach ($this->responseHeaders as $hdr) {
- 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 parseResponseCookies
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseResponseCookies()
{
$cookies = array();
$this->parsedHeaders = array();
foreach ($this->responseHeaders as $hdr) {
Function decodeContent
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function decodeContent($response)
{
if (!empty($this->parsedHeaders['content-encoding'])) {
if ($response && 'gzip' == strtolower($this->parsedHeaders['content-encoding']['value'])) {
if (!function_exists('gzdecode')) {
- 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 __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($settings = null)
{
parent::__construct($settings);
$this->reset();
if ($this->settings) {
- 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 $response;