Remove redundant is_array checks on return result from LabelMapper::findAll
Signed-off-by: Raul <raul@nextcloud.com>
This commit is contained in:
@@ -91,14 +91,12 @@ class LabelService {
|
|||||||
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE);
|
$this->permissionService->checkPermission(null, $boardId, Acl::PERMISSION_MANAGE);
|
||||||
|
|
||||||
$boardLabels = $this->labelMapper->findAll($boardId);
|
$boardLabels = $this->labelMapper->findAll($boardId);
|
||||||
if (\is_array($boardLabels)) {
|
foreach ($boardLabels as $boardLabel) {
|
||||||
foreach ($boardLabels as $boardLabel) {
|
if ($boardLabel->getTitle() === $title) {
|
||||||
if ($boardLabel->getTitle() === $title) {
|
throw new BadRequestException('title must be unique');
|
||||||
throw new BadRequestException('title must be unique');
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->boardService->isArchived(null, $boardId)) {
|
if ($this->boardService->isArchived(null, $boardId)) {
|
||||||
throw new StatusException('Operation not allowed. This board is archived.');
|
throw new StatusException('Operation not allowed. This board is archived.');
|
||||||
@@ -163,17 +161,15 @@ class LabelService {
|
|||||||
$label = $this->find($id);
|
$label = $this->find($id);
|
||||||
|
|
||||||
$boardLabels = $this->labelMapper->findAll($label->getBoardId());
|
$boardLabels = $this->labelMapper->findAll($label->getBoardId());
|
||||||
if (\is_array($boardLabels)) {
|
foreach ($boardLabels as $boardLabel) {
|
||||||
foreach ($boardLabels as $boardLabel) {
|
if ($boardLabel->getId() === $label->getId()) {
|
||||||
if ($boardLabel->getId() === $label->getId()) {
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
if ($boardLabel->getTitle() === $title) {
|
||||||
if ($boardLabel->getTitle() === $title) {
|
throw new BadRequestException('title must be unique');
|
||||||
throw new BadRequestException('title must be unique');
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->boardService->isArchived($this->labelMapper, $id)) {
|
if ($this->boardService->isArchived($this->labelMapper, $id)) {
|
||||||
throw new StatusException('Operation not allowed. This board is archived.');
|
throw new StatusException('Operation not allowed. This board is archived.');
|
||||||
|
|||||||
Reference in New Issue
Block a user