Hub::dailyLimitRelay()   A
last analyzed

Complexity

Conditions 4
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 0
cts 14
cp 0
rs 9.7666
c 0
b 0
f 0
cc 4
nc 1
nop 4
crap 20
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipbox/hubspot/blob/master/LICENSE.md
6
 * @link       https://github.com/flipbox/hubspot
7
 */
8
9
namespace Flipbox\HubSpot\Resources;
10
11
use Flipbox\HubSpot\Connections\ConnectionInterface;
12
use Flipbox\HubSpot\HubSpot;
13
use Flipbox\Relay\HubSpot\Builder\Resources\Limit\Daily\Read;
14
use Psr\Http\Message\ResponseInterface;
15
use Psr\Log\LoggerInterface;
16
use Psr\SimpleCache\CacheInterface;
17
18
/**
19
 * @author Flipbox Factory <[email protected]>
20
 * @since 2.0.0
21
 */
22
class Hub
23
{
24
    /*******************************************
25
     * DAILY LIMIT
26
     *******************************************/
27
28
    /**
29
     * @param ConnectionInterface $connection
30
     * @param CacheInterface $cache
31
     * @param LoggerInterface|null $logger
32
     * @param array $config
33
     * @return ResponseInterface
34
     */
35
    public static function dailyLimit(
36
        ConnectionInterface $connection = null,
37
        CacheInterface $cache = null,
38
        LoggerInterface $logger = null,
39
        array $config = []
40
    ): ResponseInterface {
41
        return static::dailyLimitRelay(
42
            $connection,
43
            $cache,
44
            $logger,
45
            $config
46
        )();
47
    }
48
49
    /**
50
     * @param ConnectionInterface $connection
51
     * @param CacheInterface $cache
52
     * @param LoggerInterface|null $logger
53
     * @param array $config
54
     * @return callable
55
     */
56
    public static function dailyLimitRelay(
57
        ConnectionInterface $connection = null,
58
        CacheInterface $cache = null,
59
        LoggerInterface $logger = null,
60
        array $config = []
61
    ): callable {
62
        $builder = new Read(
63
            $connection ?: HubSpot::getConnection(),
64
            $cache ?: HubSpot::getCache(),
65
            $logger ?: HubSpot::getLogger(),
66
            $config
67
        );
68
69
        return $builder->build();
70
    }
71
}
72