Passed
Push — main ( 40dc38...b0a2e6 )
by Dimitri
11:06
created

BaseEntity   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 10
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolveConnection() 0 3 1
1
<?php
2
3
/**
4
 * This file is part of Blitz PHP framework.
5
 *
6
 * (c) 2022 Dimitri Sitchet Tomkeu <[email protected]>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace BlitzPHP\Models;
13
14
use BlitzPHP\Config\Database;
15
use BlitzPHP\Database\Connection\BaseConnection;
0 ignored issues
show
Bug introduced by
The type BlitzPHP\Database\Connection\BaseConnection was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use BlitzPHP\Wolke\Model;
0 ignored issues
show
Bug introduced by
The type BlitzPHP\Wolke\Model was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
18
abstract class BaseEntity extends Model
19
{
20
    /**
21
     * {@inheritDoc}
22
     * 
23
     * @internal Permet l'initialisation de la base de donnees pour l'ORM Wolke
24
     */
25
    public static function resolveConnection(?string $connection = null): BaseConnection
26
    {
27
        return static::$resolver = Database::connect($connection);
0 ignored issues
show
Bug Best Practice introduced by
The property resolver does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
Bug Best Practice introduced by
The expression return static::resolver ...e::connect($connection) returns the type BlitzPHP\Contracts\Database\ConnectionInterface which is incompatible with the type-hinted return BlitzPHP\Database\Connection\BaseConnection.
Loading history...
28
    }
29
}
30