Showing 13 of 21 total issues
File TeamspeakClient.php
has 329 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This file is part of SeAT Teamspeak Connector.
*
* Copyright (C) 2019 Warlof Tutsimo <loic.leuilliot@gmail.com>
Function getInstance
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function getInstance(): IClient
{
if (! isset(self::$instance)) {
try {
$settings = setting('seat-connector.drivers.teamspeak', true);
- 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 sendCall
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sendCall(string $method, string $endpoint, array $arguments = []): array
{
$uri = ltrim($endpoint, '/');
$method = strtoupper($method);
Method handleProviderCallback
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleProviderCallback()
{
// determine the expected nickname for that user
$searched_nickname = session('seat-connector.teamspeak.registration_uuid');
Method getUser
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getUser(string $id): ?IUser
{
if ($this->speakers->isEmpty()) {
try {
$this->seedSpeakers();
Function sendCall
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function sendCall(string $method, string $endpoint, array $arguments = []): array
{
$uri = ltrim($endpoint, '/');
$method = strtoupper($method);
- 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 findUserByName
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findUserByName(string $nickname)
{
try {
// scope: manage_scope
$response = $this->sendCall('GET', '/{instance}/clientdbfind', [
Function handleProviderCallback
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function handleProviderCallback()
{
// determine the expected nickname for that user
$searched_nickname = session('seat-connector.teamspeak.registration_uuid');
- 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 getInstance
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getInstance(): IClient
{
if (! isset(self::$instance)) {
try {
$settings = setting('seat-connector.drivers.teamspeak', true);
Function seedSpeakers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function seedSpeakers()
{
$from = 0;
while (true) {
- 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 getUser
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getUser(string $id): ?IUser
{
if ($this->speakers->isEmpty()) {
try {
$this->seedSpeakers();
- 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 seedServerGroups
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function seedServerGroups()
{
// scope: manage_scope
$response = $this->sendCall('GET', '/{instance}/serverinfo', [
'instance' => $this->instance_id,
- 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 redirectToProvider
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function redirectToProvider()
{
try {
$settings = setting('seat-connector.drivers.teamspeak', true);
- 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"