Showing 64 of 84 total issues
ContentSecurityPolicy
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
class ContentSecurityPolicy
{
public const SELF = "'self'";
public const UNSAFE_INLINE = "'unsafe-inline'";
public const UNSAFE_EVAL = "'unsafe-eval'";
Function localize
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
public function localize(string $key, array $args = []): string
{
$locale = $this->appLocale;
$segments = explode(".", $key);
$localizeIdentifier = $segments[0];
- 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
HttpRequester
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class HttpRequester
{
private string $url;
private string $method;
private bool $verifySsl = true;
Function convertFromJSCharCode
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private function convertFromJSCharCode(string $value): string
{
$matches = [];
// check if value matches typical charCode pattern
- 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
FileUpload
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class FileUpload
{
/**
* Original received data array for file upload. Should contain the following keys : ['error', 'tmp_name', 'type',
* 'name', 'size'].
Request
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Request
{
private ServerEnvironnement $environnement;
private Url $url;
private RequestBody $body;
File
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class File extends FileSystemNode
{
/**
* Creates a new file and returns an instance of the newly created file. Will throw an exception if the override
* argument is set to false and the file already exists.
CsrfGuard
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class CsrfGuard
{
public const HEADER_TOKEN = 'HTTP_X_CSRF_TOKEN';
public const REQUEST_TOKEN_VALUE = 'CSRFToken';
public const TOKEN_LENGTH = 48;
Localization
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Localization
{
private static ?Localization $instance = null;
/**
Form
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Form
{
private const SESSION_KEY = '__ZF_FORM_FIELDS';
/**
Function getallheaders
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function getallheaders(): array
{
$headers = [];
$copy_server = [
'CONTENT_TYPE' => 'Content-Type',
- 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
WhereCondition
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class WhereCondition
{
private array $queryParameters;
private string $resultSql;
RouteDefinition
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class RouteDefinition
{
private string $rawRouteRoot = "";
private string $routeRoot = "";
private string $route;
Directory
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Directory extends FileSystemNode
{
/**
* Creates a new directory and returns an instance of the newly created
* directory.
Function prepareMultipartFormData
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function prepareMultipartFormData(array $payload): array
{
$parameters = [];
foreach ($payload as $parameterName => $parameterValue) {
// Problem with cURL while sending array in multipart/form-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
Method convertFromControlChars
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function convertFromControlChars(string $value): string
{
// critical ctrl values
$search = [
chr(0), chr(1), chr(2), chr(3), chr(4), chr(5),
Method localize
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function localize(string $key, array $args = []): string
{
$locale = $this->appLocale;
$segments = explode(".", $key);
$localizeIdentifier = $segments[0];
Function initializeRoutesFromAttributes
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function initializeRoutesFromAttributes(RouteRepository $repository): void
{
$class = new ReflectionClass(static::class);
$baseRoute = self::initializeBaseRoute($class);
$result = self::initializeBaseAuthorizationRules($class);
- 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 verify
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function verify(array $fields = []): bool
{
if ($this->optional && $this->isEmpty()) {
return 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 convertFromJSCharCode
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function convertFromJSCharCode(string $value): string
{
$matches = [];
// check if value matches typical charCode pattern