Passed
Push — main ( 68af6e...7a3b51 )
by Andreas
02:05
created

PDO::setAttribute()   C

Complexity

Conditions 16
Paths 15

Size

Total Lines 69
Code Lines 48

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 45
CRAP Score 16.0625

Importance

Changes 4
Bugs 1 Features 0
Metric Value
cc 16
eloc 48
c 4
b 1
f 0
nc 15
nop 2
dl 0
loc 69
ccs 45
cts 48
cp 0.9375
crap 16.0625
rs 5.5666

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * Licensed to CRATE Technology GmbH("Crate") under one or more contributor
4
 * license agreements.  See the NOTICE file distributed with this work for
5
 * additional information regarding copyright ownership.  Crate licenses
6
 * this file to you under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.  You may
8
 * obtain a copy of the License at
9
 *
10
 * http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
15
 * License for the specific language governing permissions and limitations
16
 * under the License.
17
 *
18
 * However, if you have executed another commercial license agreement
19
 * with Crate these terms will supersede the license and you may use the
20
 * software solely pursuant to the terms of the relevant commercial agreement.
21
 */
22
23
declare(strict_types=1);
24
25
namespace Crate\PDO;
26
27
/**
28
 * @deprecated The API interface `Crate\PDO\PDO` is deprecated and will be removed
29
 *             on one of the upcoming releases. Please use `Crate\PDO\PDOCrateDB` instead.
30
 */
31
class PDO extends PDOCrateDB implements PDOInterface
32
{
33
    use PDOImplementation;
34
35 4
    public function __construct($dsn, $username = null, $passwd = null, $options = [])
36
    {
37 4
        trigger_error(
38 4
            "The API interface `Crate\PDO\PDO` is deprecated and will be removed on one of the upcoming " .
39 4
            "releases. Please use `Crate\PDO\PDOCrateDB` instead.",
40 4
            E_USER_DEPRECATED
41 4
        );
42 4
        parent::__construct($dsn, $username, $passwd, $options);
43
    }
44
}
45