Passed
Push — master ( 03395d...78c946 )
by WEBEWEB
10:38
created

CollectionRequest::serializeRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the pexels-library package.
5
 *
6
 * (c) 2021 WEBEWEB
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 WBW\Library\Pexels\Request;
13
14
use WBW\Library\Pexels\Response\AbstractResponse;
15
use WBW\Library\Pexels\Serializer\RequestSerializer;
16
use WBW\Library\Pexels\Serializer\ResponseDeserializer;
17
use WBW\Library\Traits\Strings\StringIdTrait;
18
use WBW\Library\Traits\Strings\StringTypeTrait;
19
20
/**
21
 * Collection request.
22
 *
23
 * @author webeweb <https://github.com/webeweb>
24
 * @package WBW\Library\Pexels\Request
25
 */
26
class CollectionRequest extends CollectionsRequest {
27
28
    use StringIdTrait;
29
    use StringTypeTrait;
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function deserializeResponse(string $rawResponse): AbstractResponse {
35
        return ResponseDeserializer::deserializeCollectionResponse($rawResponse);
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function getResourcePath(): string {
42
43
        return implode("/", [
44
            parent::getResourcePath(),
45
            $this->getId(),
46
        ]);
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function serializeRequest(): array {
53
        return RequestSerializer::serializeCollectionRequest($this);
54
    }
55
}
56