mirovit/ionic-platform-sdk

View on GitHub
src/Response/Responder.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace Mirovit\IonicPlatformSDK\Response;

abstract class Responder
{
    /**
     * @var array
     */
    protected $response = [];

    public function __construct(array $response)
    {
        $this->response = $response;
    }

    public function has($key)
    {
        return array_key_exists($key, $this->response);
    }

    public function get($key, $default = null)
    {
        if($this->has($key)){
            return $this->response[$key];
        }

        return $default;
    }

    public function toArray()
    {
        return $this->response;
    }

    public function __get($key)
    {
        return $this->get($key);
    }
}