Completed
Push — master ( 24c64a...df10ee )
by Hiraku
8s
created

Share   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 36.36%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 19
ccs 4
cts 11
cp 0.3636
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A setup() 0 16 3
1
<?php
2
namespace Hirak\Prestissimo;
3
4
class Share
5
{
6 1
    public static function setup($ch)
7
    {
8 1
        static $sh;
9
10 1
        if (!function_exists('curl_share_init')) {
11 1
            return;
12
        }
13
14
        if (!$sh) {
15
            $sh = curl_share_init();
16
            curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
17
            curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
18
        }
19
20
        curl_setopt($ch, CURLOPT_SHARE, $sh);
21
    }
22
}
23