Showing 228 of 247 total issues
Function _renderTable
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function _renderTable($addAlias = true): ?string
{
$res = [];
foreach ($this->args['table'] ?? [] as $alias => $table) {
if ($addAlias === false && $table instanceof self) {
- Read upRead up
- Create a ticketCreate a ticket
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 restoreSequencesIfDecremented
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function restoreSequencesIfDecremented(array $beforeRollbackSequences): void
{
$afterRollbackSequences = $this->listSequences();
foreach ($beforeRollbackSequences as $schema => $beforeRollbackSequences2) {
- Read upRead up
- Create a ticketCreate a ticket
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 makeHashFromKey
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function makeHashFromKey($value, ?\HashContext $hashContext = null): ?int
{
if ($hashContext === null) {
$hashContext = hash_init('crc32c');
$return = true;
- Read upRead up
- Create a ticketCreate a ticket
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 tryLoad
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
#[\Override]
public function tryLoad(Model $model, $id): ?array
{
$model->assertIsModel();
- Read upRead up
- Create a ticketCreate a ticket
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 set
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function set(string $field, $value)
{
$this->getModel()->assertOnlyField($field);
$f = $this->getField($field);
- Create a ticketCreate a ticket
Method where
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function where($field, $operator = null, $value = null, $kind = 'where', $numArgs = null)
{
// number of passed arguments will be used to determine if arguments were specified or not
if ($numArgs === null) {
$numArgs = 'func_num_args'();
- Create a ticketCreate a ticket
Method wrap
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\Override]
public function wrap(Driver $driver): Driver
{
return new class($driver) extends AbstractDriverMiddleware {
#[\Override]
- Create a ticketCreate a ticket
Method _subrenderCondition
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\Override]
protected function _subrenderCondition(array $row): string
{
if (count($row) !== 1) {
[$field, $operator, $value] = $row;
- Create a ticketCreate a ticket
Method createForeignKey
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createForeignKey($relation): void
{
[$localField, $foreignField] = is_array($relation)
? $relation
: $this->resolveRelationDirection($relation);
- Create a ticketCreate a ticket
Method initQueryFields
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function initQueryFields(Model $model, Query $query, ?array $fields = null): void
{
// init fields
if ($fields !== null) {
// set of fields is strictly defined, so we will ignore even system fields
- Create a ticketCreate a ticket
Method escapeStringLiteral
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\Override]
protected function escapeStringLiteral(string $value): string
{
$dummyPersistence = (new \ReflectionClass(Persistence\Sql::class))->newInstanceWithoutConstructor();
if (\Closure::bind(static fn () => $dummyPersistence->explicitCastIsEncodedBinary($value), null, Persistence\Sql::class)()) {
- Create a ticketCreate a ticket
Method ref
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\Override]
public function ref(Model $ourModelOrEntity, array $defaults = []): Model
{
$this->assertOurModelOrEntity($ourModelOrEntity);
- Create a ticketCreate a ticket
Method action
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\Override]
public function action(string $mode, array $args = [])
{
switch ($mode) {
case 'select':
- Create a ticketCreate a ticket
Method _renderCase
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _renderCase(): ?string
{
if (!isset($this->args['case_when'])) {
return null;
}
- Create a ticketCreate a ticket
Method validateBeforeExecute
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function validateBeforeExecute(): void
{
if ($this->enabled === false || ($this->enabled instanceof \Closure && ($this->enabled)($this->_getOwner()) === false)) {
throw new Exception('User action is disabled');
}
- Create a ticketCreate a ticket
Method getConnection
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\Override]
public function getConnection(): Persistence\Sql\Connection
{
\Closure::bind(function () {
if (($this->_connection ?? null) === null) {
- Create a ticketCreate a ticket
Method init
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
#[\Override]
protected function init(): void
{
parent::init();
- Create a ticketCreate a ticket
Method setOrder
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setOrder($field, string $direction = 'asc')
{
$this->assertIsModel();
// fields passed as array
- Create a ticketCreate a ticket
Method fieldToWords
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fieldToWords(Model $model): string
{
$words = [];
$field = $this->field;
- Create a ticketCreate a ticket
Method _typecastLoadField
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _typecastLoadField(Field $field, $value)
{
$value = $this->_typecastPreField($field, $value, true);
// native DBAL DT types have no microseconds support
- Create a ticketCreate a ticket