for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace CodeCloud\Bundle\ShopifyBundle\Api;
class GenericResource implements \ArrayAccess
{
/**
* @var array
*/
private $data = array();
* @param array $data
public function hydrate(array $data)
$this->data = $data;
}
* @param string $offset
* @param mixed $value
public function offsetSet($offset, $value)
$this->data[$offset] = $value;
* @return mixed
public function offsetGet($offset)
return $this->data[$offset];
* @return bool
public function offsetExists($offset)
return array_key_exists($offset, $this->data);
public function offsetUnset($offset)
if ($this->offsetExists($offset)) {
unset($this->data[$offset]);
* @return array
public function toArray()
return $this->data;
* @param string $param
* @param mixed $default
public function get($param, $default = null)
return $this->offsetExists($param) ? $this->offsetGet($param) : $default;
* @return GenericResource
public static function create(array $data = array())
$entity = new static();
$entity->hydrate($data);
return $entity;