forked from exorg/php-data-coder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAbstractEncoder.php
41 lines (38 loc) · 978 Bytes
/
AbstractEncoder.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
<?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;
/**
* AbstractDataEncoder.
* Abstract class for Data Encoder
* for concrete 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
*/
abstract class AbstractEncoder
{
/**
* Validate data.
*
* @param string $data
* @throws \InvalidArgumentException
*/
protected function validateData($data)
{
if (!is_array($data)) {
throw new \InvalidArgumentException(
'Data must be an array.'
);
}
}
}