Showing 200 of 200 total issues
The parameter $alert_to is not named in camelCase. Open
public function setAlertToAttribute($alert_to)
{
$this->attributes['alert_to'] = trim($alert_to) ?: null;
}
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $HTTPUsername is not named in camelCase. Open
public function newMonitor($friendlyName, $URL, $type, $subType = null, $port = null, $keywordType = null, $keywordValue = null, $HTTPUsername = null, $HTTPPassword = null, $alertContacts = null, $monitorInterval = 5)
{
if (empty($friendlyName) || empty($URL) || empty($type)) {
throw new \Exception('Required key "name", "uri" or "type" not specified', 3);
}
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
Avoid variables with short names like $ch. Configured minimum length is 3. Open
$ch = curl_init();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The parameter $URL is not named in camelCase. Open
public function editMonitor($monitorId, $monitorStatus = null, $friendlyName = null, $URL = null, $subType = null, $port = null, $keywordType = null, $keywordValue = null, $HTTPUsername = null, $HTTPPassword = null, $alertContacts = null)
{
$url = $this->base_uri.'/editMonitor?monitorID='.$monitorId;
if (isset($monitorStatus)) {
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $HTTPPassword is not named in camelCase. Open
public function editMonitor($monitorId, $monitorStatus = null, $friendlyName = null, $URL = null, $subType = null, $port = null, $keywordType = null, $keywordValue = null, $HTTPUsername = null, $HTTPPassword = null, $alertContacts = null)
{
$url = $this->base_uri.'/editMonitor?monitorID='.$monitorId;
if (isset($monitorStatus)) {
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The parameter $URL is not named in camelCase. Open
public function newMonitor($friendlyName, $URL, $type, $subType = null, $port = null, $keywordType = null, $keywordValue = null, $HTTPUsername = null, $HTTPPassword = null, $alertContacts = null, $monitorInterval = 5)
{
if (empty($friendlyName) || empty($URL) || empty($type)) {
throw new \Exception('Required key "name", "uri" or "type" not specified', 3);
}
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 3 and the first side effect is on line 17. Open
<?php
- Exclude checks
The parameter $HTTPPassword is not named in camelCase. Open
public function newMonitor($friendlyName, $URL, $type, $subType = null, $port = null, $keywordType = null, $keywordValue = null, $HTTPUsername = null, $HTTPPassword = null, $alertContacts = null, $monitorInterval = 5)
{
if (empty($friendlyName) || empty($URL) || empty($type)) {
throw new \Exception('Required key "name", "uri" or "type" not specified', 3);
}
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The property $base_uri is not named in camelCase. Open
class UptimeRobot
{
private $base_uri = 'https://api.uptimerobot.com';
private $apiKey;
private $noJsonCallback;
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Function __fetch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function __fetch($url)
{
if (empty($url)) {
throw new \Exception('Value not specified: url', 1);
}
- 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
Visibility must be declared on property "$newUserId" Open
static $newUserId;
- Exclude checks
Method name "UptimeRobotTest::testSetFormat_err" is not in camel caps format Open
public function testSetFormat_err()
- Exclude checks
Method name "UptimeRobotTest::testDeleteMonitor_1" is not in camel caps format Open
public function testDeleteMonitor_1()
- Exclude checks
Method name "UptimeRobotTest::testGetMonitors_created" is not in camel caps format Open
public function testGetMonitors_created()
- Exclude checks
Method name "UptimeRobotTest::testDeleteMonitor_whitout_params" is not in camel caps format Open
public function testDeleteMonitor_whitout_params()
- Exclude checks
Method name "UptimeRobotTest::testGetAlertContacts_all" is not in camel caps format Open
public function testGetAlertContacts_all()
- Exclude checks
Function closing brace must go on the next line following the body; found 1 blank lines before brace Open
}
- Exclude checks
Method name "UptimeRobotTest::testGetAlertContacts_created" is not in camel caps format Open
public function testGetAlertContacts_created()
- Exclude checks
Method name "UptimeRobotTest::testGetApiKey_whitoutConf" is not in camel caps format Open
public function testGetApiKey_whitoutConf()
- Exclude checks
The closing brace for the class must go on the next line after the body Open
}
- Exclude checks