Share   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A setup() 0 17 3
1
<?php
2
/*
3
 * hirak/prestissimo
4
 * @author Hiraku NAKANO
5
 * @license MIT https://github.com/hirak/prestissimo
6
 */
7
namespace Hirak\Prestissimo;
8
9
class Share
10
{
11
    /**
12
     * @codeCoverageIgnore
13
     */
14
    public static function setup($ch)
15
    {
16
        static $sh;
17
18
        if (!function_exists('curl_share_init')) {
19
            return;
20
        }
21
22
        if (!$sh) {
23
            $sh = curl_share_init();
24
            curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
25
            curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
26
            curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
27
        }
28
29
        curl_setopt($ch, CURLOPT_SHARE, $sh);
30
    }
31
}
32