Passed
Push — master ( 302558...609380 )
by Jared
51s
created

Ping   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A ping() 0 9 2
1
<?php
2
namespace CultureKings\Afterpay\Service;
3
4
use CultureKings\Afterpay\Traits\ClientTrait;
5
use Exception;
6
use GuzzleHttp\Client;
7
8
/**
9
 * Class Ping
10
 * @package CultureKings\Afterpay\Service\InStore
11
 */
12
class Ping
13
{
14
    use ClientTrait;
15
16
    /**
17
     * Ping constructor.
18
     *
19
     * @param Client $client
20
     */
21
    public function __construct(Client $client)
22
    {
23
        $this->setClient($client);
24
    }
25
26
    /**
27
     * Attempt to access the ping endpoint and will return true on success.
28
     * @return bool
29
     */
30
    public function ping()
31
    {
32
        try {
33
            $this->getClient()->get('ping');
34
            return true;
35
        } catch (Exception $e) {
36
            return false;
37
        }
38
    }
39
40
}
41