diff --git a/lib/Db/PublicationType.php b/lib/Db/PublicationType.php index b7a5a307..68b2e6e7 100644 --- a/lib/Db/PublicationType.php +++ b/lib/Db/PublicationType.php @@ -140,7 +140,7 @@ public function getSchema(IURLGenerator $urlGenerator): object $schema['required'] = []; $schema['properties'] = []; - foreach($this->getProperties() as $name => $property) { + foreach ($this->getProperties() as $name => $property) { if ($property['required'] === true) { $schema['required'][] = $name; } diff --git a/lib/Service/ObjectService.php b/lib/Service/ObjectService.php index b8084d7a..9a5e022f 100644 --- a/lib/Service/ObjectService.php +++ b/lib/Service/ObjectService.php @@ -307,7 +307,7 @@ public function saveObject(string $objectType, array $object, bool $updateVersio // Get the appropriate mapper for the object type $mapper = $this->getMapper($objectType); - if($objectType === 'publication') { + if ($objectType === 'publication') { $object = $this->validationService->validatePublication($object); } diff --git a/lib/Service/ValidationService.php b/lib/Service/ValidationService.php index b3f974d0..dc863d36 100644 --- a/lib/Service/ValidationService.php +++ b/lib/Service/ValidationService.php @@ -5,12 +5,16 @@ use OCA\OpenCatalogi\Db\CatalogMapper; use OCA\OpenCatalogi\Db\Publication; use OCA\OpenCatalogi\Db\PublicationType; +use OCP\AppFramework\Db\DoesNotExistException; +use OCP\AppFramework\Db\MultipleObjectsReturnedException; use OCP\AppFramework\OCS\OCSBadRequestException; use OCP\AppFramework\OCS\OCSNotFoundException; use OCP\IAppConfig; use OCP\IURLGenerator; use Opis\JsonSchema\Errors\ErrorFormatter; use Opis\JsonSchema\Validator; +use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; /** * Class ValidationService @@ -33,10 +37,10 @@ public function __construct( * @param Publication $publication The publication to validate. * @return Publication The validated publication. * - * @throws \OCP\AppFramework\Db\DoesNotExistException - * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException - * @throws \Psr\Container\ContainerExceptionInterface - * @throws \Psr\Container\NotFoundExceptionInterface + * @throws DoesNotExistException + * @throws MultipleObjectsReturnedException + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface */ public function validatePublication(array $publication): array { @@ -52,7 +56,7 @@ public function validatePublication(array $publication): array $publication['validation'] = []; - if($result->hasError()) { + if ($result->hasError()) { $errors = (new ErrorFormatter())->format($result->error()); $publication['validation'] = $errors; }