39 lines
801 B
PHP
39 lines
801 B
PHP
|
<?php
|
||
|
|
||
|
namespace Trinity\Bundle\NewsletterBundle\Configuration;
|
||
|
|
||
|
use Trinity\Bundle\ContentManagerBundle\Configuration\BlockConfiguration;
|
||
|
|
||
|
class ModelConfiguration
|
||
|
{
|
||
|
protected $blocks = array();
|
||
|
|
||
|
public function setBlock($name, $type)
|
||
|
{
|
||
|
if (empty($name)) {
|
||
|
throw new \InvalidArgumentException('You must define a valid block name. None given.');
|
||
|
}
|
||
|
|
||
|
$this->blocks[$name] = new BlockConfiguration($name, $type);
|
||
|
|
||
|
return $this;
|
||
|
}
|
||
|
|
||
|
public function getBlock($name)
|
||
|
{
|
||
|
return isset($this->blocks[$name]) ? $this->blocks[$name] : null;
|
||
|
}
|
||
|
|
||
|
public function setBlocks(array $blocks)
|
||
|
{
|
||
|
$this->blocks = $blocks;
|
||
|
|
||
|
return $this;
|
||
|
}
|
||
|
|
||
|
public function getBlocks()
|
||
|
{
|
||
|
return $this->blocks;
|
||
|
}
|
||
|
|
||
|
}
|