0
0
mirror of https://github.com/salesagility/SuiteCRM.git synced 2024-11-24 00:29:35 +00:00
salesagility_SuiteCRM/Api/V8/JsonApi/Response/AttributeResponse.php
2018-05-25 17:50:33 +01:00

30 lines
830 B
PHP

<?php
namespace Api\V8\JsonApi\Response;
class AttributeResponse extends MetaResponse
{
/**
* @var array
*
* @see http://jsonapi.org/format/#document-resource-object-attributes
*/
private static $forbiddenKeys = ['relationships', 'links'];
/**
* @param array|\stdClass $properties
*
* @throws \InvalidArgumentException When attribute object includes forbidden keys.
*/
public function __construct($properties = [])
{
parent::__construct($properties);
$invalidKeys = array_intersect_key($properties, array_flip(self::$forbiddenKeys));
if ($invalidKeys) {
throw new \InvalidArgumentException(
'Attribute object must not contain these keys: ' . implode(', ', array_keys($invalidKeys))
);
}
}
}