Showing 16 of 21 total issues
File Client.php
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace RouterOS;
use DivineOmega\SSHConnection\SSHConnection;
Function readRAW
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function readRAW(array $options = [])
{
// By default response is empty
$response = [];
// We have to wait a !done or !fatal
- 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 decodeLength
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function decodeLength(StreamInterface $stream): int
{
// Read first byte
$firstByte = ord($stream->read(1));
Function parseResponse
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function parseResponse(array $response): array
{
$result = [];
$i = -1;
$lines = count($response);
- 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 readRAW
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function readRAW(array $options = [])
{
// By default response is empty
$response = [];
// We have to wait a !done or !fatal
Method openSocket
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function openSocket(): void
{
$options = [];
// Pass SSL options
Function query
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function query($endpoint, array $where = null, string $operations = null, string $tag = null): ClientInterface
{
// If endpoint is string then build Query object
$query = ($endpoint instanceof Query)
? $endpoint
- 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 world
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function world(string $key, $operator = null, $value = null): QueryInterface
{
if (null !== $operator && null === $value) {
// Client may set only two parameters, that mean what $operator is $value
- 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 qr
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function qr($endpoint, array $where = null, string $operations = null, string $tag = null, bool $parse = true, array $options = []): array
Method qri
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function qri($endpoint, array $where = null, string $operations = null, string $tag = null, array $options = []): ResponseIterator
Function rosario
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function rosario(array $raw): array
{
// This RAW should't be an error
$positions = array_keys($raw, '!re');
$count = count($raw);
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function connect(): bool
{
// By default we not connected
$connected = false;
- 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 decodeLength
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function decodeLength(StreamInterface $stream): int
{
// Read first byte
$firstByte = ord($stream->read(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
Function export
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function export(string $arguments = null): string
{
// Set params
$sshHost = $this->config('host');
$sshPort = $this->config('ssh_port');
- 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 BinaryStringHelper::IntegerToNBOBinaryString(0xF000000000 + $length);
Avoid too many return
statements within this method. Open
return $result;