Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace Doctrine\DBAL\Portability;
6
 
7
use Doctrine\DBAL\Platforms\AbstractPlatform;
8
use Doctrine\DBAL\Platforms\DB2Platform;
9
use Doctrine\DBAL\Platforms\OraclePlatform;
10
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
11
use Doctrine\DBAL\Platforms\SqlitePlatform;
12
use Doctrine\DBAL\Platforms\SQLServerPlatform;
13
 
14
final class OptimizeFlags
15
{
16
    /**
17
     * Platform-specific portability flags that need to be excluded from the user-provided mode
18
     * since the platform already operates in this mode to avoid unnecessary conversion overhead.
19
     *
20
     * @var array<string,int>
21
     */
22
    private static array $platforms = [
23
        DB2Platform::class        => 0,
24
        OraclePlatform::class     => Connection::PORTABILITY_EMPTY_TO_NULL,
25
        PostgreSQLPlatform::class => 0,
26
        SqlitePlatform::class     => 0,
27
        SQLServerPlatform::class  => 0,
28
    ];
29
 
30
    public function __invoke(AbstractPlatform $platform, int $flags): int
31
    {
32
        foreach (self::$platforms as $class => $mask) {
33
            if ($platform instanceof $class) {
34
                $flags &= ~$mask;
35
 
36
                break;
37
            }
38
        }
39
 
40
        return $flags;
41
    }
42
}