Файл: concrete5.7.5.6/concrete/vendor/imagine/imagine/lib/Imagine/Image/Metadata/MetadataBag.php
Строк: 51
<?php
/*
* This file is part of the Imagine package.
*
* (c) Bulat Shakirzyanov <mallluhuct@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ImagineImageMetadata;
/**
* An interface for Image Metadata
*/
class MetadataBag implements ArrayAccess, IteratorAggregate, Countable
{
/** @var array */
private $data;
public function __construct(array $data = array())
{
$this->data = $data;
}
/**
* {@inheritdoc}
*/
public function count()
{
return count($this->data);
}
/**
* {@inheritdoc}
*/
public function getIterator()
{
return new ArrayIterator($this->data);
}
/**
* {@inheritdoc}
*/
public function offsetExists($offset)
{
return array_key_exists($offset, $this->data);
}
/**
* {@inheritdoc}
*/
public function offsetSet($offset, $value)
{
$this->data[$offset] = $value;
}
/**
* {@inheritdoc}
*/
public function offsetUnset($offset)
{
unset($this->data[$offset]);
}
/**
* {@inheritdoc}
*/
public function offsetGet($offset)
{
return array_key_exists($offset, $this->data) ? $this->data[$offset] : null;
}
/**
* Returns metadata as an array
*
* @return array An associative array
*/
public function toArray()
{
return $this->data;
}
}