Function activateSession
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
private function activateSession(): ?CData
{
if (isset($this->context)) {
$context = stream_context_get_options($this->context);
- 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 activateSession
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function activateSession(): ?CData
{
if (isset($this->context)) {
$context = stream_context_get_options($this->context);
Function stream_open
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function stream_open(string $path, string $mode, ?int $options, ?string &$opened_path): bool
{
if (extension_loaded('sockets')) {
$raw = @\socket_create(AF_INET, SOCK_RAW, SOL_TCP);
- 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 stream_open
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function stream_open(string $path, string $mode, ?int $options, ?string &$opened_path): bool
{
if (extension_loaded('sockets')) {
$raw = @\socket_create(AF_INET, SOCK_RAW, SOL_TCP);
Method stream_cast
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function stream_cast(int $cast_as)
{
if (is_null($this->pcap) && (($this->pcap = $this->activateSession()) === null)) {
return false;
}
Function stream_read
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function stream_read(int $count): string
{
if (is_null($this->pcap) && (($this->pcap = $this->activateSession()) === null)) {
return '';
}
- 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 stream_cast
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function stream_cast(int $cast_as)
{
if (is_null($this->pcap) && (($this->pcap = $this->activateSession()) === null)) {
return 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
Avoid too many return
statements within this method. Open
return $this->fp;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;