Api::createCloudManager()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/*
4
 * This file is part of the XabbuhPandaClient package.
5
 *
6
 * (c) Christian Flothmann <[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 Xabbuh\PandaClient;
13
14
use Xabbuh\PandaClient\Api\Account;
15
use Xabbuh\PandaClient\Api\AccountManager;
16
use Xabbuh\PandaClient\Api\Cloud;
17
use Xabbuh\PandaClient\Api\CloudManager;
18
use Xabbuh\PandaClient\Api\HttplugClient;
19
use Xabbuh\PandaClient\Serializer\Symfony\Serializer;
20
use Xabbuh\PandaClient\Transformer\CloudTransformer;
21
use Xabbuh\PandaClient\Transformer\EncodingTransformer;
22
use Xabbuh\PandaClient\Transformer\NotificationsTransformer;
23
use Xabbuh\PandaClient\Transformer\ProfileTransformer;
24
use Xabbuh\PandaClient\Transformer\TransformerRegistry;
25
use Xabbuh\PandaClient\Transformer\VideoTransformer;
26
27
/**
28
 * Implementation of the algorithm described in {@link AbstractApi} to initialize
29
 * an Api object to access the Panda Encoding API.
30
 *
31
 * @author Christian Flothmann <[email protected]>
32
 */
33
class Api extends AbstractApi
34
{
35
    /**
36
     * {@inheritDoc}
37
     */
38 8
    protected function createAccountManager()
39
    {
40 8
        return new AccountManager();
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46 7
    protected function createCloudManager()
47
    {
48 7
        return new CloudManager();
49
    }
50
51
    /**
52
     * {@inheritDoc}
53
     */
54 5
    protected function createHttpClient(Account $account, $cloudId)
55
    {
56 5
        $httpClient = new HttplugClient();
57 5
        $httpClient->setAccount($account);
58 5
        $httpClient->setCloudId($cloudId);
59
60 5
        return $httpClient;
61
    }
62
63
    /**
64
     * {@inheritDoc}
65
     */
66 5
    protected function createCloud()
67
    {
68 5
        return new Cloud();
69
    }
70
71
    /**
72
     * {@inheritDoc}
73
     */
74 8
    protected function createTransformerRegistry()
75
    {
76 8
        return new TransformerRegistry();
77
    }
78
79
    /**
80
     * {@inheritDoc}
81
     */
82 8
    protected function createCloudTransformer()
83
    {
84 8
        $transformer = new CloudTransformer();
85 8
        $transformer->setSerializer(Serializer::getCloudSerializer());
86
87 8
        return $transformer;
88
    }
89
90
    /**
91
     * {@inheritDoc}
92
     */
93 8
    protected function createEncodingTransformer()
94
    {
95 8
        $transformer = new EncodingTransformer();
96 8
        $transformer->setSerializer(Serializer::getEncodingSerializer());
97
98 8
        return $transformer;
99
    }
100
101
    /**
102
     * {@inheritDoc}
103
     */
104 8
    protected function createNotificationsTransformer()
105
    {
106 8
        return new NotificationsTransformer();
107
    }
108
109
    /**
110
     * {@inheritDoc}
111
     */
112 8
    protected function createProfileTransformer()
113
    {
114 8
        $transformer = new ProfileTransformer();
115 8
        $transformer->setSerializer(Serializer::getProfileSerializer());
116
117 8
        return $transformer;
118
    }
119
120
    /**
121
     * {@inheritDoc}
122
     */
123 8
    protected function createVideoTransformer()
124
    {
125 8
        $transformer = new VideoTransformer();
126 8
        $transformer->setSerializer(Serializer::getVideoSerializer());
127
128 8
        return $transformer;
129
    }
130
}
131