Source of file EmptyResponse.php

Size: 1,951 Bytes - Last Modified: 2019-08-09T18:27:54+00:00

/home/travis/build/zerospam/sdk-framework/src/Response/Api/EmptyResponse.php

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
<?php
/**
 * Created by PhpStorm.
 * User: aaflalo
 * Date: 18-07-16
 * Time: 09:55
 */

namespace ZEROSPAM\Framework\SDK\Response\Api;

use ZEROSPAM\Framework\SDK\Exception\Response\NoActionEmptyResponseException;
use ZEROSPAM\Framework\SDK\Response\Api\Helper\RateLimitedTrait;
use ZEROSPAM\Framework\SDK\Utils\Contracts\DataObject;

/**
 * Class EmptyResponse
 *
 * Response to represent the code 202
 *
 * @package ZEROSPAM\Framework\SDK\Response\Api
 */
final class EmptyResponse implements IRateLimitedResponse
{
    use RateLimitedTrait;

    public function __isset($name)
    {
        return false;
    }

    /**
     * @param $name
     *
     * @throws NoActionEmptyResponseException
     */
    public function __get($name)
    {
        throw new NoActionEmptyResponseException('Empty response has no data');
    }

    /**
     * @param $name
     * @param $value
     *
     * @throws NoActionEmptyResponseException
     */
    public function __set($name, $value)
    {
        throw new NoActionEmptyResponseException('Empty response has no data');
    }


    /**
     * Data contained in the response.
     *
     * @return array
     */
    public function data(): array
    {
        return [];
    }

    /**
     * Get a specific field.
     *
     * @param string $field
     *
     * @return mixed|null
     * @throws NoActionEmptyResponseException
     */
    public function get($field)
    {
        throw new NoActionEmptyResponseException('Empty response has no data');
    }

    /**
     * Return value in response array of the response.
     *
     * @param $key
     *
     * @return mixed
     * @throws NoActionEmptyResponseException
     */
    public function getRawValue($key)
    {
        throw new NoActionEmptyResponseException('Empty response has no data');
    }

    public function populateDataObject(DataObject &$dataObject): void
    {
        // TODO: Implement populateDataObject() method.
    }
}