Transporter::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of Laravel Meetups.
5
 *
6
 * (c) Nuno Maduro <[email protected]>
7
 *
8
 *  For the full copyright and license information, please view the LICENSE
9
 *  file that was distributed with this source code.
10
 */
11
12
namespace LaravelMeetups\Http\Client;
13
14
use LaravelMeetups\Contracts\Http\Client\Query as QueryContract;
15
use LaravelMeetups\Contracts\Http\Client\Transporter as Contract;
16
17
/**
18
 * Class Transporter.
19
 */
20
class Transporter implements Contract
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function execute(QueryContract $query)
26
    {
27
        $ch = curl_init();
28
        curl_setopt($ch, CURLOPT_URL, $query->toString());
29
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
30
        $response = curl_exec($ch);
31
        curl_close($ch);
32
33
        return $response;
34
    }
35
}
36