for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace MediaMonks\SonataMediaBundle\Handler;
use MediaMonks\SonataMediaBundle\Model\MediaInterface;
class ParameterBag implements ParameterBagInterface
{
/**
* @var int
*/
protected $width;
protected $height;
* @var array
protected $extra = [];
* @param int $width
* @param int $height
* @param array $extra
public function __construct($width, $height, array $extra = [])
$this->width = $width;
$this->height = $height;
$this->extra = $extra;
}
* @return int
public function getWidth()
return $this->width;
public function setWidth($width)
public function getHeight()
return $this->height;
public function setHeight($height)
* @return array
public function getExtra()
return $this->extra;
public function setExtra($extra)
* @param $key
* @param $value
public function addExtra($key, $value)
$this->extra[$key] = $value;
* @param array $defaults
public function setDefaults(array $defaults)
$this->extra = array_merge($defaults, $this->extra);
* @param MediaInterface $media
public function toArray(MediaInterface $media)
return array_merge($this->getExtra(), [
'id' => $media->getId(),
'width' => $this->getWidth(),
'height' => $this->getHeight(),
]);