Completed
Push — master ( f2d606...ed3e7f )
by Oleg
02:59
created

Plan   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
ccs 8
cts 8
cp 1
wmc 2
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 9 1
1
<?php
2
/**
3
 * @author Oleg Krivtsov <[email protected]>
4
 * @date 16 July 2019
5
 * @copyright (c) 2019, Web Marketing ROI
6
 */
7
namespace WebMarketingROI\OptimizelyPHP\Service\v2;
8
9
use WebMarketingROI\OptimizelyPHP\Exception;
10
use WebMarketingROI\OptimizelyPHP\Resource\v2\Plan as PlanResource;
11
12
/**
13
 * Provides methods for working with Optimizely plans.
14
 */
15
class Plan
16
{
17
    /**
18
     * Optimizely API Client.
19
     * @var WebMarketingROI\OptimizelyPHP\OptimizelyApiClient
20
     */
21
    private $client;
22
    
23
    /**
24
     * Constructor.
25
     */
26 1
    public function __construct($client)
27
    {
28 1
        $this->client = $client;
29 1
    }
30
    
31
    /**
32
     * e information for all products, only accessible for Administrators on the account
33
     * @return Result
34
     * @throws Exception
35
     */
36 1
    public function get()
37
    {
38 1
        $result = $this->client->sendApiRequest("/plan");
39
        
40 1
        $plan = new PlanResource($result->getDecodedJsonData());
41 1
        $result->setPayload($plan);
42
        
43 1
        return $result;
44
    }
45
}
46
47