File requestcore.class.php
has 483 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Handles all HTTP requests using cURL and manages the responses.
*
* @version 2011.06.07
Method prep_request
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function prep_request()
{
$curl_handle = curl_init();
// Set default options.
Function prep_request
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function prep_request()
{
$curl_handle = curl_init();
// Set default 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
RequestCore
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
class RequestCore
{
/**
* The URL being requested.
*/
Function send_multi_request
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function send_multi_request($handles, $opt = null)
{
set_time_limit(0);
// Skip everything if there are no handles to process.
- 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 send_multi_request
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function send_multi_request($handles, $opt = null)
{
set_time_limit(0);
// Skip everything if there are no handles to process.
Method process_response
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process_response($curl_handle = null, $response = null)
{
// Accept a custom one if it's passed.
if ($curl_handle && $response)
{
Function set_read_stream
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function set_read_stream($resource, $size = null)
{
if (!isset($size) || $size < 0)
{
$stats = fstat($resource);
- 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 process_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function process_response($curl_handle = null, $response = null)
{
// Accept a custom one if it's passed.
if ($curl_handle && $response)
{
- 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 streaming_read_callback
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function streaming_read_callback($curl_handle, $file_handle, $length)
{
// Once we've sent as much as we're supposed to send...
if ($this->read_stream_read >= $this->read_stream_size)
{
- 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"