From ea4df2a7b6a6509f51ee4fe9dc0e50777dca292a Mon Sep 17 00:00:00 2001 From: Robert Lange <robert.lange@uni-leipzig.de> Date: Wed, 15 Dec 2021 19:31:32 +0100 Subject: [PATCH] refs #21064 [fid] RecordTab and Serializer: add comments --- module/fid/src/RecordTab/Worldcat.php | 10 +++-- .../OrderCreationRequestUserNormalizer.php | 44 ++++++++++++++++--- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/module/fid/src/RecordTab/Worldcat.php b/module/fid/src/RecordTab/Worldcat.php index dfd75e5d040..ddcdf3c0bb1 100644 --- a/module/fid/src/RecordTab/Worldcat.php +++ b/module/fid/src/RecordTab/Worldcat.php @@ -20,7 +20,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * @category VuFind - * @package RecordTabs + * @package RecordTab * @author Demian Katz <demian.katz@villanova.edu> * @author André Lahmann <lahmann@ub.uni-leipzig.de> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License @@ -32,7 +32,7 @@ namespace fid\RecordTab; * Staff view tab for AI records * * @category VuFind - * @package RecordTabs + * @package RecordTab * @author Demian Katz <demian.katz@villanova.edu> * @author Gregor Gawol <gawol@ub.uni-leipzig.de> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License @@ -65,7 +65,11 @@ class Worldcat extends \VuFind\RecordTab\AbstractBase */ public function isActive() { - if (!$this->getRecordDriver()->tryMethod('hasRecordPermission', [$this->accessPermission])) { + $hasRecordPermission = $this->getRecordDriver()->tryMethod( + 'hasRecordPermission', + [$this->accessPermission] + ); + if (!$hasRecordPermission) { return false; } $oclc = $this->getRecordDriver()->tryMethod('getOCLC'); diff --git a/module/fid/src/Serializer/OrderCreationRequestUserNormalizer.php b/module/fid/src/Serializer/OrderCreationRequestUserNormalizer.php index 6eafa10b223..70bcfcc0574 100644 --- a/module/fid/src/Serializer/OrderCreationRequestUserNormalizer.php +++ b/module/fid/src/Serializer/OrderCreationRequestUserNormalizer.php @@ -2,6 +2,8 @@ /** * Copyright (C) 2019 Leipzig University Library * + * PHP Version 7 + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. @@ -15,9 +17,15 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * @author Gregor Gawol <gawol@ub.uni-leipzig.de> - * @author Sebastian Kehr <kehr@ub.uni-leipzig.de> - * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2 + * Serializer for Order Requests to FIDIS API + * https://git.sc.uni-leipzig.de/ubl/finc/fid/fidis/-/blob/master/bundle/Entity/Order.php + * + * @category VuFind + * @package Serializer + * @author Gregor Gawol <gawol@ub.uni-leipzig.de> + * @author Sebastian Kehr <kehr@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2 + * @link https://vufind.org/wiki/development Wiki */ namespace fid\Serializer; @@ -26,11 +34,33 @@ use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; +/** + * Class OrderCreationRequestUserNormalizer + * + * Serializer for Order Requests to FIDIS API + * https://git.sc.uni-leipzig.de/ubl/finc/fid/fidis/-/blob/master/bundle/Entity/Order.php + * + * @category VuFind + * @package Serializer + * @author Gregor Gawol <gawol@ub.uni-leipzig.de> + * @author Sebastian Kehr <kehr@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2 + * @link https://vufind.org/wiki/development Wiki + */ class OrderCreationRequestUserNormalizer implements ContextAwareNormalizerInterface, NormalizerAwareInterface { use NormalizerAwareTrait; + /** + * {@inheritdoc} + * + * @param mixed $data Order data + * @param null $format Format the normalization result will be encoded as + * @param array $context Context options for the normalizer + * + * @return bool true if Serializer supports normalization otherwise false + */ public function supportsNormalization( $data, $format = null, @@ -41,9 +71,11 @@ class OrderCreationRequestUserNormalizer implements } /** - * @param mixed|User $object - * @param null $format - * @param array $context + * {@inheritdoc} + * + * @param mixed|User $object Object to normalize + * @param null $format Format the normalization result will be encoded as + * @param array $context Context options for the normalizer * * @return array|bool|float|int|string */ -- GitLab