Showing 38 of 40 total issues
Method connect
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function connect($ipAddress, $portNumber, $timeout) {
$this->ipAddress = $ipAddress;
$this->portNumber = $portNumber;
if($this->socketsEnabled) {
Method create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function create($appId, $steamId, $fetchNow = true, $bypassCache = false) {
if (is_numeric($steamId)) {
$steamId64 = $steamId;
} else {
$steamId64 = SteamId::resolveVanityUrl($steamId);
Function __construct
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(GameInventory $inventory, $itemData) {
$this->inventory = $inventory;
$this->defindex = $itemData->defindex;
$this->backpackPosition = $itemData->inventory & 0xffff;
- 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 getReply
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getReply() {
$bytesRead = $this->receivePacket(1400);
if($this->buffer->getLong() == -2) {
do {
- 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"
Further reading
Function create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function create($appId, $steamId, $fetchNow = true, $bypassCache = false) {
if (is_numeric($steamId)) {
$steamId64 = $steamId;
} else {
$steamId64 = SteamId::resolveVanityUrl($steamId);
- 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 rconExec
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function rconExec($password, $command) {
if($this->rconChallenge == -1 || $this->isHLTV) {
$this->rconGetChallenge();
}
- 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 connect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function connect($ipAddress, $portNumber, $timeout) {
$this->ipAddress = $ipAddress;
$this->portNumber = $portNumber;
if($this->socketsEnabled) {
- 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 _load
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function _load($format, $interface, $method, $version = 1, $params = null) {
Method load
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function load($format, $interface, $method, $version = 1, $params = null) {
Function addInformation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addInformation($playerData) {
if($playerData['name'] != $this->name) {
throw new SteamCondenserException('Information to add belongs to a different player.');
}
- 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 addLanguage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function addLanguage($language) {
$schema = $this->fetchLanguage($language);
$initial = false;
if (empty($this->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 internalFetch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function internalFetch() {
$params = ['SteamID' => $this->steamId64];
$result = WebApi::getJSONData("IEconItems_{$this->getAppId()}", 'GetPlayerItems', 1, $params);
$this->items = [];
- 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
Avoid too many return
statements within this method. Open
return new M2ASERVERBATCHPacket($data);
Avoid too many return
statements within this method. Open
return new RCONGoldSrcResponse($data);
Avoid too many return
statements within this method. Open
return new S2CCHALLENGEPacket($data);
Function create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function create() {
$args = func_get_args();
$className = empty(self::$className) ? get_class() : self::$className;
$class = new \ReflectionClass($className);
$constructor = $class->getConstructor();
- 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 send
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function send($data) {
if($this->socketsEnabled) {
$sendResult = socket_send($this->socket, $data, strlen($data), 0);
if ($sendResult === false) {
throw new SocketException(socket_last_error($this->socket));
- 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"