Showing 8 of 13 total issues
Job
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Job extends Base
{
protected $objectType = 'job';
protected $units = array();
protected $judgments = array();
Function serializeAttributes
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function serializeAttributes($parameters)
{
$parametersStr = "";
$i = 0;
foreach ($parameters as $k => $v) {
- 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 setChannels
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function setChannels($data)
{
if ($this->getId() === null) { throw new Exception('job_id'); }
if (is_string($data)) {
$parametersStr = 'channels[]=' . urlencode($data);
- 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 sendRequest
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function sendRequest($method, $urlModifier, $data = null)
{
$result = $this->request->send($method, $urlModifier, $data);
$result = json_decode($result);
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($message, $code = 0, Exception $previous = null) {
// premade messages
switch ($message) {
case 'job_attributes':
Function create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function create($count = 0, $channels = Array("on_demand"))
{
if ($this->getJobId() === null) { throw new CrowdFlowerException('job_id'); }
$url = "jobs/" . $this->getJobId() . "/orders.json?";
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($message, $code = 0, Exception $previous = null) {
// premade messages
switch ($message) {
case 'job_attributes':
- 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
public function __construct(Request $request, $jobId, $unitId = null, $id = null, $attributes = array())