1 | <?php |
||||||||||
2 | |||||||||||
3 | use Lagdo\DbAdmin\Admin; |
||||||||||
4 | use Lagdo\DbAdmin\Config; |
||||||||||
5 | use Lagdo\DbAdmin\Db; |
||||||||||
6 | use Lagdo\DbAdmin\Driver; |
||||||||||
7 | use Lagdo\DbAdmin\Service; |
||||||||||
8 | use Lagdo\DbAdmin\Ui; |
||||||||||
9 | |||||||||||
10 | use function Jaxon\jaxon; |
||||||||||
11 | |||||||||||
12 | function getAuth(): Config\AuthInterface |
||||||||||
13 | { |
||||||||||
14 | return new class implements Config\AuthInterface { |
||||||||||
15 | public function user(): string |
||||||||||
16 | { |
||||||||||
17 | return ''; |
||||||||||
18 | } |
||||||||||
19 | public function role(): string |
||||||||||
20 | { |
||||||||||
21 | return ''; |
||||||||||
22 | } |
||||||||||
23 | }; |
||||||||||
24 | } |
||||||||||
25 | |||||||||||
26 | return [ |
||||||||||
27 | 'metadata' => 'annotations', |
||||||||||
28 | 'directories' => [ |
||||||||||
29 | [ |
||||||||||
30 | 'path' => __DIR__ . '/../app/ajax/Log', |
||||||||||
31 | 'namespace' => 'Lagdo\\DbAdmin\\Ajax\\Log', |
||||||||||
32 | 'autoload' => false, |
||||||||||
33 | ], |
||||||||||
34 | ], |
||||||||||
35 | 'views' => [ |
||||||||||
36 | 'dbadmin::codes' => [ |
||||||||||
37 | 'directory' => __DIR__ . '/../templates/codes', |
||||||||||
38 | 'extension' => '', |
||||||||||
39 | 'renderer' => 'jaxon', |
||||||||||
40 | ], |
||||||||||
41 | 'dbadmin::views' => [ |
||||||||||
42 | 'directory' => __DIR__ . '/../templates/views', |
||||||||||
43 | 'extension' => '.php', |
||||||||||
44 | 'renderer' => 'jaxon', |
||||||||||
45 | ], |
||||||||||
46 | 'dbadmin::templates' => [ |
||||||||||
47 | 'directory' => __DIR__ . '/../templates/views', |
||||||||||
48 | 'extension' => '.php', |
||||||||||
49 | 'renderer' => 'jaxon', |
||||||||||
50 | ], |
||||||||||
51 | 'pagination' => [ |
||||||||||
52 | 'directory' => __DIR__ . '/../templates/pagination', |
||||||||||
53 | 'extension' => '.php', |
||||||||||
54 | 'renderer' => 'jaxon', |
||||||||||
55 | ], |
||||||||||
56 | ], |
||||||||||
57 | 'container' => [ |
||||||||||
58 | 'set' => [ |
||||||||||
59 | // Selected database driver |
||||||||||
60 | Driver\DriverInterface::class => function($di) { |
||||||||||
61 | // Register a driver for each database server. |
||||||||||
62 | $package = $di->g(Lagdo\DbAdmin\DbAdminPackage::class); |
||||||||||
63 | foreach($package->getServers() as $server => $options) { |
||||||||||
64 | $di->set("dbadmin_driver_$server", fn() => |
||||||||||
65 | Driver\Driver::createDriver($options)); |
||||||||||
66 | } |
||||||||||
67 | |||||||||||
68 | $server = $di->g('dbadmin_config_server'); |
||||||||||
69 | return $di->g("dbadmin_driver_$server"); |
||||||||||
70 | }, |
||||||||||
71 | // Facades to the DB driver features |
||||||||||
72 | Db\Facades\CommandFacade::class => function($di) { |
||||||||||
73 | $dbFacade = $di->g(Db\DbFacade::class); |
||||||||||
74 | $timer = $di->g(Service\TimerService::class); |
||||||||||
75 | $logger = $di->g(Service\LogWriter::class); |
||||||||||
0 ignored issues
–
show
|
|||||||||||
76 | return new Db\Facades\CommandFacade($dbFacade, $timer, $logger); |
||||||||||
77 | }, |
||||||||||
78 | Db\Facades\DatabaseFacade::class => function($di) { |
||||||||||
79 | $dbFacade = $di->g(Db\DbFacade::class); |
||||||||||
80 | $server = $di->g('dbadmin_config_server'); |
||||||||||
81 | $package = $di->g(Lagdo\DbAdmin\DbAdminPackage::class); |
||||||||||
82 | $options = $package->getServerOptions($server); |
||||||||||
83 | return new Db\Facades\DatabaseFacade($dbFacade, $options); |
||||||||||
84 | }, |
||||||||||
85 | Db\Facades\ExportFacade::class => function($di) { |
||||||||||
86 | $dbFacade = $di->g(Db\DbFacade::class); |
||||||||||
87 | return new Db\Facades\ExportFacade($dbFacade); |
||||||||||
88 | }, |
||||||||||
89 | Db\Facades\ImportFacade::class => function($di) { |
||||||||||
90 | $dbFacade = $di->g(Db\DbFacade::class); |
||||||||||
91 | $timer = $di->g(Service\TimerService::class); |
||||||||||
92 | $logger = $di->g(Service\LogWriter::class); |
||||||||||
93 | return new Db\Facades\ImportFacade($dbFacade, $timer, $logger); |
||||||||||
94 | }, |
||||||||||
95 | Db\Facades\QueryFacade::class => function($di) { |
||||||||||
96 | $dbFacade = $di->g(Db\DbFacade::class); |
||||||||||
97 | return new Db\Facades\QueryFacade($dbFacade); |
||||||||||
98 | }, |
||||||||||
99 | Db\Facades\SelectFacade::class => function($di) { |
||||||||||
100 | $dbFacade = $di->g(Db\DbFacade::class); |
||||||||||
101 | $timer = $di->g(Service\TimerService::class); |
||||||||||
102 | return new Db\Facades\SelectFacade($dbFacade, $timer); |
||||||||||
103 | }, |
||||||||||
104 | Db\Facades\ServerFacade::class => function($di) { |
||||||||||
105 | $dbFacade = $di->g(Db\DbFacade::class); |
||||||||||
106 | $server = $di->g('dbadmin_config_server'); |
||||||||||
107 | $package = $di->g(Lagdo\DbAdmin\DbAdminPackage::class); |
||||||||||
108 | $options = $package->getServerOptions($server); |
||||||||||
109 | return new Db\Facades\ServerFacade($dbFacade, $options); |
||||||||||
110 | }, |
||||||||||
111 | Db\Facades\TableFacade::class => function($di) { |
||||||||||
112 | $dbFacade = $di->g(Db\DbFacade::class); |
||||||||||
113 | return new Db\Facades\TableFacade($dbFacade); |
||||||||||
114 | }, |
||||||||||
115 | Db\Facades\UserFacade::class => function($di) { |
||||||||||
116 | $dbFacade = $di->g(Db\DbFacade::class); |
||||||||||
117 | return new Db\Facades\UserFacade($dbFacade); |
||||||||||
118 | }, |
||||||||||
119 | Db\Facades\ViewFacade::class => function($di) { |
||||||||||
120 | $dbFacade = $di->g(Db\DbFacade::class); |
||||||||||
121 | return new Db\Facades\ViewFacade($dbFacade); |
||||||||||
122 | }, |
||||||||||
123 | Config\UserFileReader::class => function() { |
||||||||||
124 | return new Config\UserFileReader(getAuth()); |
||||||||||
0 ignored issues
–
show
The call to
getAuth() has too few arguments starting with di .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||||||||
125 | }, |
||||||||||
126 | // Query logging |
||||||||||
127 | Service\Logging\QueryLogger::class => function($di) { |
||||||||||
128 | $package = $di->g(Lagdo\DbAdmin\LoggingPackage::class); |
||||||||||
129 | $database = $package->getOption('database'); |
||||||||||
130 | $options = $package->getOption('options', []); |
||||||||||
131 | if (!is_array($database) || !is_array($options)) { |
||||||||||
132 | return null; |
||||||||||
133 | } |
||||||||||
134 | |||||||||||
135 | $driver = Driver\Driver::createDriver($database); |
||||||||||
136 | $reader = $di->g(Config\UserFileReader::class); |
||||||||||
137 | $db = $di->g(Db\DbFacade::class); |
||||||||||
138 | return new Service\Logging\QueryLogger($db, $driver, |
||||||||||
0 ignored issues
–
show
It seems like
$driver can also be of type null ; however, parameter $driver of Lagdo\DbAdmin\Service\Lo...ryLogger::__construct() does only seem to accept Lagdo\DbAdmin\Driver\DriverInterface , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||||||
139 | $reader->getServerOptions($database), $options); |
||||||||||
140 | }, |
||||||||||
141 | ], |
||||||||||
142 | 'auto' => [ |
||||||||||
143 | // The translator |
||||||||||
144 | Lagdo\DbAdmin\Translator::class, |
||||||||||
145 | // The string manipulation class |
||||||||||
146 | Driver\Utils\Str::class, |
||||||||||
147 | // The user input |
||||||||||
148 | Driver\Utils\Input::class, |
||||||||||
149 | // The utils class |
||||||||||
150 | Driver\Utils\Utils::class, |
||||||||||
151 | // The facade to the database features |
||||||||||
152 | Db\DbFacade::class, |
||||||||||
153 | // The Timer service |
||||||||||
154 | Service\TimerService::class, |
||||||||||
155 | // The db classes |
||||||||||
156 | Admin\Admin::class, |
||||||||||
157 | // The UI builders |
||||||||||
158 | Ui\UiBuilder::class, |
||||||||||
159 | Ui\InputBuilder::class, |
||||||||||
160 | Ui\MenuBuilder::class, |
||||||||||
161 | Ui\Logging\LogUiBuilder::class, |
||||||||||
162 | ], |
||||||||||
163 | 'alias' => [ |
||||||||||
164 | // The translator |
||||||||||
165 | Driver\Utils\TranslatorInterface::class => Lagdo\DbAdmin\Translator::class, |
||||||||||
166 | ], |
||||||||||
167 | ], |
||||||||||
168 | 'exceptions' => [ |
||||||||||
169 | Db\Exception\DbException::class => function(Db\Exception\DbException $dbException) { |
||||||||||
170 | $response = jaxon()->getResponse(); |
||||||||||
171 | $response->dialog->warning($dbException->getMessage()); |
||||||||||
0 ignored issues
–
show
The method
warning() does not exist on Jaxon\Plugin\ResponsePluginInterface . It seems like you code against a sub-type of Jaxon\Plugin\ResponsePluginInterface such as Jaxon\Plugin\Response\Dialog\DialogPlugin .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() The method
warning() does not exist on null .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||||||
172 | return $response; |
||||||||||
173 | }, |
||||||||||
174 | ], |
||||||||||
175 | ]; |
||||||||||
176 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths