Автор: Christer Edvartsen (cogo@starzinger.net)
Наследование: implements Imbo\Model\ModelInterface
Пример #1
0
 /**
  * @covers Imbo\Model\ListModel::setEntry
  * @covers Imbo\Model\ListModel::getEntry
  */
 public function testCanSetAndGetAnEntryValue()
 {
     $this->assertNull($this->model->getEntry());
     $entry = 'entry';
     $this->assertSame($this->model, $this->model->setEntry($entry));
     $this->assertSame($entry, $this->model->getEntry());
 }
Пример #2
0
 /**
  * @covers Imbo\Model\ListModel::getData
  */
 public function testGetData()
 {
     $list = [1, 2, 3];
     $container = 'container';
     $entry = 'entry';
     $this->model->setList($list)->setContainer($container)->setEntry($entry);
     $this->assertSame(['list' => $list, 'container' => $container, 'entry' => $entry], $this->model->getData());
 }
Пример #3
0
 public function get(EventInterface $event)
 {
     $model = new ListModel();
     $model->setContainer('foo');
     $model->setEntry('bar');
     $model->setList([1, 2, 3]);
     $event->getResponse()->setModel($model);
 }
Пример #4
0
Файл: XML.php Проект: ASP96/imbo
    /**
     * {@inheritdoc}
     */
    public function formatListModel(Model\ListModel $model)
    {
        $data = '';
        $entries = '';
        $container = $model->getContainer();
        $entry = $model->getEntry();
        $list = $model->getList();
        foreach ($list as $element) {
            $entries .= '<' . $entry . '>' . $element . '</' . $entry . '>';
        }
        $data = '<' . $container . '>' . $entries . '</' . $container . '>';
        return <<<DATA
<?xml version="1.0" encoding="UTF-8"?>
<imbo>{$data}</imbo>
DATA;
    }
Пример #5
0
 /**
  * {@inheritdoc}
  */
 public function formatListModel(Model\ListModel $model)
 {
     return $this->encode(array($model->getContainer() => $model->getList()));
 }