Showing 246 of 247 total issues
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 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 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 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 setModel
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setModel(Model $model): Model
{
$this->table($model->table);
foreach ($model->getFields() as $field) {
- 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 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 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 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
Function castGetValue
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function castGetValue($v): ?string
{
if (is_bool($v)) {
return $v ? '1' : '0';
} elseif (is_int($v)) {
- 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 _setArgs
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function _setArgs(string $kind, ?string $alias, $value): void
{
if ($alias === null) {
$this->args[$kind][] = $value;
} else {
- 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 seedData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function seedData(Model $model): void
{
$tableName = $model->table;
if (isset($this->data[$tableName])) {
return;
- 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 _typecastLoadField
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function _typecastLoadField(Field $field, $value)
{
$value = $this->_typecastPreField($field, $value, true);
// native DBAL DT types have no microseconds support
- 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 onChangeModel
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
#[\Override]
protected function onChangeModel(): void
{
$model = $this->getModel();
if ($model !== null) {
- 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 wrap
has 27 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