getGroups() public method

Get the groups
public getGroups ( ) : array
return array
示例#1
0
文件: GroupsTest.php 项目: imbo/imbo
 /**
  * @covers Imbo\Model\Groups::getGroups
  * @covers Imbo\Model\Groups::setGroups
  */
 public function testSetAndGetGroups()
 {
     $this->assertSame([], $this->model->getGroups());
     $this->assertSame($this->model, $this->model->setGroups(['group' => [], 'group2' => []]));
     $this->assertSame(['group' => [], 'group2' => []], $this->model->getGroups());
 }
示例#2
0
文件: XML.php 项目: imbo/imbo
    /**
     * {@inheritdoc}
     */
    public function formatGroups(Model\Groups $model)
    {
        $data = $model->getGroups();
        $entries = '';
        foreach ($data as $group) {
            $resources = array_map(array($this, 'formatValue'), $group['resources']);
            $entries .= '<group>';
            $entries .= '  <name>' . $this->formatValue($group['name']) . '</name>';
            $entries .= '  <resources>';
            $entries .= '    <resource>' . implode($resources, '</resource><resource>') . '</resource>';
            $entries .= '  </resources>';
            $entries .= '</group>';
        }
        return <<<GROUPS
<?xml version="1.0" encoding="UTF-8"?>
<imbo>
  <search>
    <hits>{$model->getHits()}</hits>
    <page>{$model->getPage()}</page>
    <limit>{$model->getLimit()}</limit>
    <count>{$model->getCount()}</count>
  </search>
  <groups>{$entries}</groups>
</imbo>
GROUPS;
    }
示例#3
0
文件: JSON.php 项目: imbo/imbo
 /**
  * {@inheritdoc}
  */
 public function formatGroups(Model\Groups $model)
 {
     return $this->encode(['search' => ['hits' => $model->getHits(), 'page' => $model->getPage(), 'limit' => $model->getLimit(), 'count' => $model->getCount()], 'groups' => $model->getGroups()]);
 }