getCount() public méthode

Get the number of groups
public getCount ( ) : integer
Résultat integer
Exemple #1
0
 /**
  * @covers Imbo\Model\Groups::getCount
  */
 public function testCanCountImages()
 {
     $this->assertSame(0, $this->model->getCount());
     $this->assertSame($this->model, $this->model->setGroups(['group1' => [], 'group2' => []]));
     $this->assertSame(2, $this->model->getCount());
 }
Exemple #2
0
    /**
     * {@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;
    }
Exemple #3
0
 /**
  * {@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()]);
 }