forked from exorg/php-data-coder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDecoder.php
48 lines (41 loc) · 1.17 KB
/
Decoder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/*
* This file is part of the DataCoder package.
*
* (c) Katarzyna Krasińska <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ExOrg\DataCoder\Coder\Data;
use ExOrg\DataCoder\Coder\Data\DecodingStrategyInterface;
use ExOrg\DataCoder\CoderBuilder\CoderBuildingTrait;
use ExOrg\DataCoder\DataFormat\DataFormatConfigurableTrait;
/**
* DataDecoder.
* Allows to decode data
* accordingly the chosen data format.
*
* @package DataCoder
* @author Katarzyna Krasińska <[email protected]>
* @copyright Copyright (c) 2015-2023 Katarzyna Krasińska
* @license http://opensource.org/licenses/MIT MIT License
* @link https://github.com/ExOrg/php-data-coder
*/
class Decoder implements DecodingStrategyInterface
{
use DataFormatConfigurableTrait;
use CoderBuildingTrait;
/**
* Decode data.
*
* @param array $data
* @return array
*/
public function decodeData($data)
{
$dataDecodingStrategy = $this->buildCoder();
$decodedData = $dataDecodingStrategy->decodeData($data);
return $decodedData;
}
}