Function __toString
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function __toString() {
$returnString = '';
$returnString .= "Ping: {$this->ping}\n";
$returnString .= "Challenge number: {$this->challengeNumber}\n";
- 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 handleResponseForRequest
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function handleResponseForRequest($requestType, $repeatOnFailure = true) {
switch($requestType) {
case self::REQUEST_CHALLENGE:
$expectedResponse = '\SteamCondenser\Servers\Packets\S2CCHALLENGEPacket';
$requestPacket = new A2SPLAYERPacket();
- 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 handleResponseForRequest
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handleResponseForRequest($requestType, $repeatOnFailure = true) {
switch($requestType) {
case self::REQUEST_CHALLENGE:
$expectedResponse = '\SteamCondenser\Servers\Packets\S2CCHALLENGEPacket';
$requestPacket = new A2SPLAYERPacket();
Method __toString
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __toString() {
$returnString = '';
$returnString .= "Ping: {$this->ping}\n";
$returnString .= "Challenge number: {$this->challengeNumber}\n";
Method splitPlayerStatus
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function splitPlayerStatus($attributes, $playerStatus) {
if($attributes[0] != 'userid') {
$playerStatus = preg_replace('/^\d+ +/', '', $playerStatus);
}
Function updatePlayers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function updatePlayers($rconPassword = null) {
$this->handleResponseForRequest(self::REQUEST_PLAYER);
if(!$this->rconAuthenticated) {
if($rconPassword == null) {
- 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 getPlayerStatusAttributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function getPlayerStatusAttributes($statusHeader) {
$statusAttributes = [];
foreach(preg_split("/\s+/", $statusHeader) as $attribute) {
if($attribute == 'connected') {
$statusAttributes[] = 'time';
- 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"