Method sendWithCurl
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sendWithCurl($url, $payload)
{
$response = new \stdClass;
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, true);
Method send
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function send(Entity\JsonFile $json)
{
$response = new \stdClass;
$payload = (string)$json;
$options = array(
Remove error control operator '@' on line 50. Open
public function send(Entity\JsonFile $json)
{
$response = new \stdClass;
$payload = (string)$json;
$options = array(
- Read upRead up
- Exclude checks
ErrorControlOperator
Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.
Example
function foo($filePath) {
$file = @fopen($filPath); // hides exceptions
$key = @$array[$notExistingKey]; // assigns null to $key
}
Source http://phpmd.org/rules/cleancode.html#errorcontroloperator
Missing class import via use statement (line '32', column '25'). Open
$response = new \stdClass;
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '76', column '25'). Open
$response = new \stdClass;
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid assigning values to variables in if clauses and the like (line '50', column '13'). Open
public function send(Entity\JsonFile $json)
{
$response = new \stdClass;
$payload = (string)$json;
$options = array(
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}