/** * {@inheritdoc} */ public function formatAccessRule(Model\AccessRule $model) { $rule = $this->formatAccessRuleArray(['id' => $model->getId(), 'users' => $model->getUsers(), 'group' => $model->getGroup(), 'resources' => $model->getResources()]); return <<<RULE <?xml version="1.0" encoding="UTF-8"?> <imbo> {$rule} </imbo> RULE; }
/** * @covers Imbo\Model\AccessRule::getId * @covers Imbo\Model\AccessRule::setId */ public function testSetAndGetId() { $this->assertNull($this->model->getId()); $this->assertSame($this->model, $this->model->setId(1)); $this->assertSame(1, $this->model->getId()); }
/** * {@inheritdoc} */ public function formatAccessRule(Model\AccessRule $model) { $data = ['id' => $model->getId(), 'users' => $model->getUsers()]; if ($group = $model->getGroup()) { $data['group'] = $group; } if ($resources = $model->getResources()) { $data['resources'] = $resources; } return $this->encode($data); }