Code Duplication    Length = 28-28 lines in 2 locations

src/Oci8PersistentConnection.php 1 location

@@ 10-37 (lines=28) @@
7
 * @package Jpina\Oci8
8
 * @see http://php.net/manual/en/book.oci8.php
9
 */
10
class Oci8PersistentConnection extends Oci8Connection
11
{
12
    /**
13
     * Connect to an Oracle database using a persistent connection
14
     *
15
     * New instances of this class will use the same connection across multiple requests.
16
     *
17
     * @param string $username
18
     * @param string $password
19
     * @param string $connectionString
20
     * @param string $characterSet
21
     * @param int $sessionMode
22
     * @return resource
23
     * @see http://php.net/manual/en/function.oci-pconnect.php
24
     */
25
    protected function connect(
26
        $username,
27
        $password,
28
        $connectionString = null,
29
        $characterSet = null,
30
        $sessionMode = null
31
    ) {
32
        set_error_handler($this->getErrorHandler());
33
        $connection = oci_pconnect($username, $password, $connectionString, $characterSet, $sessionMode);
34
        restore_error_handler();
35
        return $connection;
36
    }
37
}
38

src/Oci8SingletonConnection.php 1 location

@@ 10-37 (lines=28) @@
7
 * @package Jpina\Oci8
8
 * @see http://php.net/manual/en/book.oci8.php
9
 */
10
class Oci8SingletonConnection extends Oci8Connection
11
{
12
    /**
13
     * Connect to an Oracle database
14
     *
15
     * New instances of this class will use the same connection during the script life cycle.
16
     *
17
     * @param $username
18
     * @param string $password
19
     * @param string $connectionString
20
     * @param string $characterSet
21
     * @param int $sessionMode
22
     * @return resource
23
     * @see http://php.net/manual/en/function.oci-connect.php
24
     */
25
    protected function connect(
26
        $username,
27
        $password = null,
28
        $connectionString = null,
29
        $characterSet = null,
30
        $sessionMode = 0
31
    ) {
32
        set_error_handler($this->getErrorHandler());
33
        $connection = oci_connect($username, $password, $connectionString, $characterSet, $sessionMode);
34
        restore_error_handler();
35
        return $connection;
36
    }
37
}
38