File Persistence.php
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Atk4\Data;
- Create a ticketCreate a ticket
Function _typecastPreField
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
private function _typecastPreField(Field $field, $value, bool $fromLoad)
{
if (is_string($value)) {
switch ($field->type) {
case 'boolean':
- 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 _typecastPreField
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function _typecastPreField(Field $field, $value, bool $fromLoad)
{
if (is_string($value)) {
switch ($field->type) {
case 'boolean':
- Create a ticketCreate a ticket
Persistence
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Persistence
{
use ContainerTrait {
add as private _add;
}
- 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 _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
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
Function typecastSaveField
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function typecastSaveField(Field $field, $value)
{
// SQL Expression cannot be converted
if ($value instanceof Persistence\Sql\Expressionable) {
return $value;
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
protected function _typecastSaveField(Field $field, $value)
{
$value = $this->_typecastPreField($field, $value, false);
// 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 insert
has a Cognitive Complexity of 6 (exceeds 5 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) {
- 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"