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);
Severity: Minor
Found in src/Model.php - About 1 hr to fix

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);
Severity: Minor
Found in src/Schema/Migrator.php - About 1 hr to fix

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
Severity: Minor
Found in src/Persistence/Sql.php - About 1 hr to fix

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);

Severity: Minor
Found in src/Reference/ContainsOne.php - About 1 hr to fix

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)()) {
Severity: Minor
Found in src/Persistence/Sql/Postgresql/ExpressionTrait.php - About 1 hr to fix

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) {
Severity: Minor
Found in src/Schema/Migrator.php - About 1 hr to fix

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':
Severity: Minor
Found in src/Model/AggregateModel.php - About 1 hr to fix

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;
        }
Severity: Minor
Found in src/Persistence/Sql/Query.php - About 1 hr to fix

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) {
Severity: Minor
Found in src/Schema/TestSqlPersistence.php - About 1 hr to fix

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');
        }
Severity: Minor
Found in src/Model/UserAction.php - About 1 hr to fix

Method init has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    #[\Override]
    protected function init(): void
    {
        parent::init();

Severity: Minor
Found in src/Reference/ContainsBase.php - About 1 hr to fix

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
Severity: Minor
Found in src/Model.php - About 1 hr to fix

Method fieldToWords has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function fieldToWords(Model $model): string
    {
        $words = [];

        $field = $this->field;
Severity: Minor
Found in src/Model/Scope/Condition.php - About 1 hr to fix

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
Severity: Minor
Found in src/Persistence.php - About 1 hr to fix

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)) {
Severity: Minor
Found in src/Persistence/Sql/Expression.php - About 1 hr to fix

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 {
Severity: Minor
Found in src/Persistence/Sql/Query.php - About 1 hr to fix

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;
Severity: Minor
Found in src/Persistence/Array_.php - About 1 hr to fix

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
Severity: Minor
Found in src/Persistence.php - About 1 hr to fix

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) {
Severity: Minor
Found in src/Model/Scope/Condition.php - About 1 hr to fix

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]
Severity: Minor
Found in src/Persistence/Sql/Oracle/InitializeSessionMiddleware.php - About 1 hr to fix
Severity
Category
Status
Source
Language