SyncHandler   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 36
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A send() 0 25 2
1
<?php namespace Understand\UnderstandLaravel5\Handlers;
2
3
class SyncHandler extends BaseHandler
4
{
5
6
    /**
7
     * Send data to storage
8
     *
9
     * @param mixed $requestData
10
     * @return type
11
     */
12
    protected function send($requestData)
13
    {
14
        $endpoint = $this->getEndpoint();
15
16
        $ch = curl_init($endpoint);
17
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
18
        curl_setopt($ch, CURLOPT_POSTFIELDS, $requestData);
19
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
20
21
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
22
        curl_setopt($ch, CURLOPT_TIMEOUT, 5);
23
24
        if ($this->sslBundlePath)
25
        {
26
            curl_setopt($ch, CURLOPT_CAINFO, $this->sslBundlePath);
27
        }
28
29
        curl_setopt($ch, CURLOPT_USERAGENT, 'Laravel 5 service provider.');
30
31
        $response = curl_exec($ch);
32
33
        curl_close($ch);
34
35
        return $response;
36
    }
37
38
}
39