Skip to content

Commit c20d173

Browse files
committed
Apply mago formatting
1 parent aebe9cd commit c20d173

26 files changed

Lines changed: 579 additions & 555 deletions

‎src/AdapterPlatform.php‎

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
class AdapterPlatform extends AbstractPlatform
1515
{
16-
public final const PLATFORM_NAME = 'SQLite';
16+
final public const PLATFORM_NAME = 'SQLite';
17+
1718
/** @var string[] */
1819

1920
protected array $quoteIdentifier = ['"', '"'];
@@ -27,27 +28,25 @@ class AdapterPlatform extends AbstractPlatform
2728
protected string $quoteIdentifierTo = '\'';
2829

2930
public function __construct(
30-
protected readonly PdoDriverInterface|PDO|null $driver = null
31-
) {
32-
}
31+
protected readonly PdoDriverInterface|PDO|null $driver = null,
32+
) {}
3333

3434
/**
3535
* {@inheritDoc}
3636
*/
3737
#[Override]
38-
public function quoteValue(string $value): string
38+
public function getName(): string
3939
{
40-
$resource = $this->resource;
41-
42-
if ($resource instanceof PdoDriverInterface) {
43-
$resource = $resource->getConnection()->getResource();
44-
}
45-
46-
if ($resource instanceof PDO) {
47-
return $resource->quote($value);
48-
}
40+
return self::PLATFORM_NAME;
41+
}
4942

50-
return parent::quoteValue($value);
43+
/**
44+
* {@inheritDoc}
45+
*/
46+
#[Override]
47+
public function getSqlPlatformDecorator(): PlatformDecoratorInterface
48+
{
49+
return new Platform();
5150
}
5251

5352
/**
@@ -73,17 +72,18 @@ public function quoteTrustedValue(int|float|string|bool $value): ?string
7372
* {@inheritDoc}
7473
*/
7574
#[Override]
76-
public function getName(): string
75+
public function quoteValue(string $value): string
7776
{
78-
return self::PLATFORM_NAME;
79-
}
77+
$resource = $this->resource;
8078

81-
/**
82-
* {@inheritDoc}
83-
*/
84-
#[Override]
85-
public function getSqlPlatformDecorator(): PlatformDecoratorInterface
86-
{
87-
return new Platform();
79+
if ($resource instanceof PdoDriverInterface) {
80+
$resource = $resource->getConnection()->getResource();
81+
}
82+
83+
if ($resource instanceof PDO) {
84+
return $resource->quote($value);
85+
}
86+
87+
return parent::quoteValue($value);
8888
}
8989
}

‎src/ConfigProvider.php‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@
1515

1616
final class ConfigProvider
1717
{
18-
public function __invoke(): array
19-
{
20-
return [
21-
'dependencies' => $this->getDependencies(),
22-
//AdapterInterface::class => $this->getConfig(),
23-
];
24-
}
25-
2618
public function getConfig(): array
2719
{
2820
return [
@@ -61,4 +53,12 @@ public function getDependencies(): array
6153
],
6254
];
6355
}
56+
57+
public function __invoke(): array
58+
{
59+
return [
60+
'dependencies' => $this->getDependencies(),
61+
//AdapterInterface::class => $this->getConfig(),
62+
];
63+
}
6464
}

‎src/Container/MetadataInterfaceFactory.php‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
final class MetadataInterfaceFactory
1313
{
1414
public const ADAPTER_SERVICE_NAME = 'adapter_service_name';
15+
1516
public function __invoke(
1617
ContainerInterface $container,
1718
string $requestedName,
18-
?array $options = null
19+
?array $options = null,
1920
): MetadataInterface&Metadata\Source {
2021
$adapterServiceName = $options[self::ADAPTER_SERVICE_NAME] ?? AdapterInterface::class;
2122

‎src/Container/PdoConnectionFactory.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ final class PdoConnectionFactory
1616
public function __invoke(
1717
ContainerInterface $container,
1818
string $requestedName,
19-
?array $options = null
19+
?array $options = null,
2020
): PdoConnectionInterface&Connection {
2121
$conn = $options['connection'] ?? [];
2222
if (! is_array($conn) || $conn === []) {
2323
throw new InvalidConnectionParametersException(
2424
'Connection configuration must be an array of parameters passed via $options["connection"]',
25-
$conn
25+
$conn,
2626
);
2727
}
2828

‎src/Container/PdoDriverInterfaceFactory.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ final class PdoDriverInterfaceFactory
1717
public function __invoke(
1818
ContainerInterface&ServiceManager $container,
1919
string $requestedName,
20-
?array $options = null
20+
?array $options = null,
2121
): PdoDriverInterface&Pdo\Driver {
2222
/** @var Pdo\Connection $connectionInstance */
2323
$connectionInstance = $container->build(
2424
Pdo\Connection::class,
25-
$options
25+
$options,
2626
);
2727

2828
/** @var ResultInterface&Result $resultInstance */
@@ -31,7 +31,7 @@ public function __invoke(
3131
: new Result();
3232

3333
return new Pdo\Driver(
34-
connection:$connectionInstance,
34+
connection: $connectionInstance,
3535
statementPrototype: $container->build(Statement::class, $options['options'] ?? []),
3636
resultPrototype: $resultInstance,
3737
features: [new Pdo\Feature\SqliteRowCounter()],

‎src/Container/PdoStatementFactory.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final class PdoStatementFactory
1313
public function __invoke(
1414
ContainerInterface $container,
1515
string $requestedName,
16-
?array $options = null
16+
?array $options = null,
1717
): StatementInterface&Statement {
1818
return new Statement(options: $options);
1919
}

‎src/Container/PlatformInterfaceFactory.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ final class PlatformInterfaceFactory
1515
public function __invoke(
1616
ContainerInterface $container,
1717
string $requestedName,
18-
?array $options = null
18+
?array $options = null,
1919
): PlatformInterface&AdapterPlatform {
2020
$driverInstance = $options['driver'] ?? null;
2121
if (! $driverInstance instanceof Driver) {
2222
throw ContainerException::forService(
2323
AdapterPlatform::class,
2424
self::class,
25-
'Invalid or missing driver provided recieved: '
25+
'Invalid or missing driver provided recieved: ',
2626
);
2727
}
2828
return new AdapterPlatform($driverInstance);

0 commit comments

Comments
 (0)