Oci8PersistentConnection   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 28
loc 28
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A connect() 12 12 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Jpina\Oci8;
4
5
/**
6
 * Class PersistentConnection
7
 * @package Jpina\Oci8
8
 * @see http://php.net/manual/en/book.oci8.php
9
 */
10 View Code Duplication
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 2
    protected function connect(
26
        $username,
27
        $password,
28
        $connectionString = null,
29
        $characterSet = null,
30
        $sessionMode = null
31
    ) {
32 2
        set_error_handler($this->getErrorHandler());
33 2
        $connection = oci_pconnect($username, $password, $connectionString, $characterSet, $sessionMode);
34 1
        restore_error_handler();
35 1
        return $connection;
36
    }
37
}
38