Showing 59 of 59 total issues
RepositoryReadOnly
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class RepositoryReadOnly implements RepositoryReadOnlyInterface
{
protected array $tableToObjectFields = [];
protected array $objectToTableFields = [];
protected array $objectTypes = [];
Method preprocessWhere
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function preprocessWhere(array $whereOptions, array $objectToTableFields): array
{
// List of finished WHERE expressions, to be imploded with ANDs
$whereProcessed = [];
Method __invoke
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __invoke(): array
{
/** @var list<string> $logRepositories */
$logRepositories = [];
/** @var list<string> $logConflicts */
Method buildSelectQueryStructured
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildSelectQueryStructured(array $query): array
{
// Process options and make sure all values are valid
[
$sanitizedOptions,
Method preprocessGroup
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function preprocessGroup(array $groupByOptions, array $objectToTableFields): array
{
// List of finished WHERE expressions, to be imploded with ANDs
$groupByProcessed = [];
Method process
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function process(object|string $class): ?RepositoryConfigInterface
{
// Get class reflection data
$reflectionClass = new \ReflectionClass($class);
Function preprocessWhere
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function preprocessWhere(array $where): array
{
// SQL restrictions as an array
$whereProcessed = [];
- 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 castOneTableVariable
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function castOneTableVariable(mixed $value, ?string $fieldName = null, bool $isChange = false): int|float|string|LargeObject|null
{
// Only scalar values and null are allowed
if (!\is_null($value) && !\is_scalar($value)) {
throw Debug::createException(
- 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 preprocessChanges
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function preprocessChanges(array $changes): array
{
// Separate field SQL and field values
$changesProcessed = [];
- 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 preprocessOrder
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function preprocessOrder(array $orderOptions, array $objectToTableFields): array
{
// List of finished WHERE expressions, to be imploded with ANDs
$orderProcessed = [];
Method processSelectResult
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function processSelectResult(
array $entry,
array $selectTypes,
array $selectTypesNullable,
): array {
Function prepareSelectQueryForLowerLayer
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function prepareSelectQueryForLowerLayer(array $query): array
{
// Set the table variable for SQL component
$query['table'] = $this->config->getTableName();
- 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 preprocessOrder
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function preprocessOrder(array $orderOptions): array
{
// Order SQL parts
$orderProcessed = [];
Method insertOrUpdate
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function insertOrUpdate(array $fields, array $indexFields = [], ?array $updateFields = null): void
{
// Fields after conversion to table notation
$actualIndexFields = [];
Method prepareSelectQueryForLowerLayer
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function prepareSelectQueryForLowerLayer(array $query): array
{
// Set the table variable for SQL component
$query['table'] = $this->config->getTableName();
Method preprocessChanges
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function preprocessChanges(array $changes): array
{
// Separate field SQL and field values
$changesProcessed = [];
Method preprocessWhere
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function preprocessWhere(array $where): array
{
// SQL restrictions as an array
$whereProcessed = [];
Method insert
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function insert(array $fields, bool $returnInsertId = false): ?string
{
// Make sure we have an autoincrement field if one is requested
if ($returnInsertId === true && \strlen($this->config->getAutoincrementField()) === 0) {
throw Debug::createException(
Method validateQueryOptions
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function validateQueryOptions(array $validOptions, array $options): array
{
// One field shortcut - convert to fields array
if (isset($validOptions['fields']) && isset($options['field']) && !isset($options['fields'])) {
$options['fields'] = [$options['field']];
Function validateQueryOptions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function validateQueryOptions(array $validOptions, array $options): array
{
// One field shortcut - convert to fields array
if (isset($validOptions['fields']) && isset($options['field']) && !isset($options['fields'])) {
$options['fields'] = [$options['field']];
- 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"