Showing 229 of 251 total issues
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 setGroupBy
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function setGroupBy(array $fields, array $aggregateExpressions = [])
{
$this->groupByFields = array_unique(array_merge($this->groupByFields, $fields));
foreach ($fields as $fieldName) {
- 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);
// TODO casting optionally to null should be handled by type itself solely
- 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 _renderConditionBinaryReuse
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _renderConditionBinaryReuse(
string $sqlLeft,
string $sqlRight,
\Closure $makeSqlFx,
bool $allowReuseLeft = true,
- Create a ticketCreate a ticket
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
Method field
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function field(string $fieldName, array $options = []): self
{
$type = $options['type'] ?? 'string';
unset($options['type']);
if ($type === 'time' && $this->getDatabasePlatform() instanceof OraclePlatform) {
- Create a ticketCreate a ticket
Method getFields
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFields($filter = null): array
{
if ($this->isEntity()) {
return $this->getModel()->getFields($filter);
}
- Create a ticketCreate a ticket
Method order
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function order($order, $direction = null)
{
if (is_string($order) && str_contains($order, ',')) {
throw new Exception('Comma-separated fields list is no longer accepted, use array instead');
}
- Create a ticketCreate a ticket
Method splitLongString
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function splitLongString(string $value, int $lengthBytes): array
{
$res = [];
$value = array_reverse(str_split($value, 2 * $lengthBytes));
$i = count($value) - 1;
- Create a ticketCreate a ticket
Method insert
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function insert(Model $model, array $data)
{
$model->assertIsModel();
if ($model->idField && array_key_exists($model->idField, $data) && $data[$model->idField] === null) {
- Create a ticketCreate a ticket
Method init
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function init(): void
{
$this->_init();
$idField = $this->getOwner()->idField;
- Create a ticketCreate a ticket
Method setModel
has 26 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
Function prepareIterator
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function prepareIterator(Model $model): \Traversable
{
if (!$this->mode) {
$this->mode = 'r';
} elseif ($this->mode === 'w') {
- 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 9 (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
Function add
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
#[\Override]
public function add(Model $model, array $defaults = []): void
{
if ($model->idField && !$model->hasField($model->idField)) {
// init model, but prevent array persistence data seeding, id field with correct type must be setup first
- 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 _execute
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
#[\Override]
protected function _execute(?object $connection, bool $fromExecuteStatement)
{
// fix exception throwing for MSSQL TRY/CATCH SQL (for Query::$templateInsert)
// https://github.com/microsoft/msphpsql/issues/1387
- 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 _typecastSaveField
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function _typecastSaveField(Field $field, $value)
{
$value = $this->_typecastPreField($field, $value, false);
if (in_array($field->type, ['json', 'object'], true) && $value === '') { // TODO remove later
- 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 initSaveBuffer
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function initSaveBuffer(Model $entity, bool $fromUpdate): void
{
foreach ($entity->get() as $name => $value) {
$field = $entity->getField($name);
if (!$field->hasJoin() || $field->getJoin()->shortName !== $this->shortName || $field->readOnly || $field->neverPersist || $field->neverSave) {
- 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 ref
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
#[\Override]
public function ref(Model $ourModelOrEntity, array $defaults = []): Model
{
$this->assertOurModelOrEntity($ourModelOrEntity);
- 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"