/** * {@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::getResources * @covers Imbo\Model\AccessRule::setResources */ public function testSetAndGetResources() { $this->assertSame([], $this->model->getResources()); $this->assertSame($this->model, $this->model->setResources(['r1', 'r2'])); $this->assertSame(['r1', 'r2'], $this->model->getResources()); }
/** * {@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); }