• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

elie29 / oci-driver / 20226421753

15 Dec 2025 09:06AM UTC coverage: 66.304% (-0.6%) from 66.923%
20226421753

push

github

Elie NEHME
🤖 Enhanced OCI driver with error handling, parameter validation, environment management, and added unit tests.

10 of 20 new or added lines in 5 files covered. (50.0%)

1 existing line in 1 file now uncovered.

183 of 276 relevant lines covered (66.3%)

7.08 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/OCI/Helper/Factory.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Elie\OCI\Helper;
6

7
use Elie\OCI\Debugger\DebuggerDumb;
8
use Elie\OCI\Debugger\DebuggerDump;
9
use Elie\OCI\Driver\Driver;
10
use Elie\OCI\Driver\DriverInterface;
11

12
/**
13
 * Helper for creating new or one instance of an OCI Driver Service.
14
 * Useful in case we don't have a container.
15
 */
16
class Factory
17
{
18
    /** @var resource */
19
    private static $connection;
20

21
    private static string $env = 'dev';
22

23
    /**
24
     * <b>Initialize the factory with the main connection</b>
25
     *
26
     * @param resource $connection
27
     * @param string $env dev|prod for DebuggerInterface
28
     */
29
    public static function init($connection, string $env): void
30
    {
31
        self::$connection = $connection;
×
32
        self::$env = $env;
×
33
    }
34

35
    /**
36
     * @return DriverInterface A singleton OCI Driver service
37
     *  based on a previous call to self::init.
38
     */
39
    public static function get(): DriverInterface
40
    {
41
        static $driver = null;
×
42

43
        if ($driver === null) {
×
44
            $driver = self::create(self::$connection, self::$env);
×
45
        }
46

47
        return $driver;
×
48
    }
49

50
    /**
51
     * @param resource $connection
52
     * @param string $env dev|development|test|prod|production for DebuggerInterface
53
     * @return DriverInterface A new instance of OCI Driver service.
54
     */
55
    public static function create($connection, string $env): DriverInterface
56
    {
NEW
57
        $environment = Environment::fromString($env);
×
58

NEW
59
        $debugger = $environment->isDevelopment()
×
60
            ? new DebuggerDump()
×
61
            : new DebuggerDumb();
×
62

63
        $db = new Driver($connection, $debugger);
×
64

65
        // Init Oracle session
66
        $init = new SessionInit();
×
67
        $init->alterSession($db);
×
68

69
        return $db;
×
70
    }
71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc