/** * {@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::getUsers * @covers Imbo\Model\AccessRule::setUsers */ public function testSetAndGetUsers() { $this->assertSame([], $this->model->getUsers()); $this->assertSame($this->model, $this->model->setUsers(['u1', 'u2'])); $this->assertSame(['u1', 'u2'], $this->model->getUsers()); }
/** * {@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); }