From 7284ed98fa3debe623be702b1e1f2e128dda2929 Mon Sep 17 00:00:00 2001
From: Robert Lange <robert.lange@uni-leipzig.de>
Date: Tue, 21 Dec 2021 16:02:45 +0100
Subject: [PATCH] refs #21064 [fid] codestyles for Service

---
 .../src/Role/PermissionProvider/Factory.php   |   2 -
 module/fid/src/Service/Client.php             | 348 ++++++++++++------
 module/fid/src/Service/ClientException.php    |  20 +-
 module/fid/src/Service/ClientFactory.php      |  58 +--
 .../Service/DataTransferObject/Address.php    | 130 +++++--
 .../Service/DataTransferObject/Library.php    | 106 ++++--
 .../src/Service/DataTransferObject/Logon.php  |  94 +++--
 .../src/Service/DataTransferObject/Order.php  | 134 ++++++-
 .../src/Service/DataTransferObject/Record.php |  46 ++-
 .../src/Service/DataTransferObject/User.php   | 222 +++++++++--
 .../Service/UserAuthorizationException.php    |  20 +-
 .../Service/UserNotAuthorizedException.php    |  20 +-
 .../src/Service/UserNotLoggedinException.php  |  20 +-
 13 files changed, 932 insertions(+), 288 deletions(-)

diff --git a/module/fid/src/Role/PermissionProvider/Factory.php b/module/fid/src/Role/PermissionProvider/Factory.php
index 761c717d219..9c22dd2663f 100644
--- a/module/fid/src/Role/PermissionProvider/Factory.php
+++ b/module/fid/src/Role/PermissionProvider/Factory.php
@@ -37,8 +37,6 @@ use Zend\ServiceManager\ServiceManager;
  * @author   Demian Katz <demian.katz@villanova.edu>
  * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
  * @link     https://vufind.org/wiki/development:plugins:hierarchy_components Wiki
- *
- * @codeCoverageIgnore
  */
 class Factory extends \VuFind\Role\PermissionProvider\Factory
 {
diff --git a/module/fid/src/Service/Client.php b/module/fid/src/Service/Client.php
index 5a37773170d..4541acca9ec 100644
--- a/module/fid/src/Service/Client.php
+++ b/module/fid/src/Service/Client.php
@@ -1,7 +1,11 @@
 <?php
 /**
+ * Fidis client
+ *
  * 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,8 +19,11 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * @author  Sebastian Kehr <kehr@ub.uni-leipzig.de>
- * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace fid\Service;
 
@@ -38,6 +45,15 @@ use Symfony\Component\Serializer\SerializerInterface;
 use VuFind\Cookie\CookieManager;
 use Zend\Session\Container as Session;
 
+/**
+ * FID client class
+ *
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
+ */
 class Client
 {
     protected const ERRMSG_HTTPCLIENT
@@ -46,62 +62,44 @@ class Client
     protected const ERRMSG_HTTPRESPONSE
         = 'An unexcected http response occured.';
 
-    /**
-     * @var string
-     */
+    /* @var string */
     protected $config;
 
-    /**
-     * @var Session
-     */
+    /* @var Session */
     protected $session;
 
-    /**
-     * @var CookieManager
-     */
+    /* @var CookieManager */
     protected $cookies;
 
-    /**
-     * @var SerializerInterface
-     */
+    /* @var SerializerInterface */
     protected $serializer;
 
-    /**
-     * @var HttpClientInterface
-     */
+    /* @var HttpClientInterface */
     protected $httpClient;
 
-    /**
-     * @var UriFactoryInterface
-     */
+    /* @var UriFactoryInterface */
     protected $uriFactory;
 
-    /**
-     * @var StreamFactoryInterface
-     */
+    /* @var StreamFactoryInterface */
     protected $streamFactory;
 
-    /**
-     * @var RequestFactoryInterface
-     */
+    /* @var RequestFactoryInterface */
     protected $requestFactory;
 
-    /**
-     * @var string
-     */
+    /* @var string */
     protected $locale = 'en';
 
     /**
      * Client constructor.
      *
-     * @param array                   $config
-     * @param Session                 $session
-     * @param CookieManager           $cookies
-     * @param SerializerInterface     $serializer
-     * @param HttpClientInterface     $httpClient
-     * @param UriFactoryInterface     $uriFactory
-     * @param StreamFactoryInterface  $streamFactory
-     * @param RequestFactoryInterface $requestFactory
+     * @param array                   $config         config
+     * @param Session                 $session        session
+     * @param CookieManager           $cookies        cookies
+     * @param SerializerInterface     $serializer     serializer
+     * @param HttpClientInterface     $httpClient     httpClient
+     * @param UriFactoryInterface     $uriFactory     uriFactory
+     * @param StreamFactoryInterface  $streamFactory  streamFactory
+     * @param RequestFactoryInterface $requestFactory requestFactory
      */
     public function __construct(
         array $config,
@@ -124,13 +122,22 @@ class Client
     }
 
     /**
-     * @param string $locale
+     * Set local for translations
+     *
+     * @param string $locale locale
+     *
+     * @return void
      */
     public function setLocale(string $locale): void
     {
         $this->locale = $locale;
     }
-
+    
+    /**
+     * Get if user is logged in
+     *
+     * @return bool
+     */
     public function isLoggedOn(): bool
     {
         try {
@@ -141,9 +148,12 @@ class Client
     }
 
     /**
-     * @param string[] $credentials
+     * Get user logon
+     *
+     * @param string ...$credentials credentials
      *
      * @return Logon
+     *
      * @throws ClientException
      */
     public function logon(string ...$credentials): Logon
@@ -175,8 +185,10 @@ class Client
     }
 
     /**
-     * @param string $username
-     * @param string $password
+     * Check credentials
+     *
+     * @param string $username username
+     * @param string $password password
      *
      * @return bool
      */
@@ -196,6 +208,10 @@ class Client
     }
 
     /**
+     * Logout
+     *
+     * @return void
+     *
      * @throws ClientException
      */
     public function logoff(): void
@@ -222,9 +238,12 @@ class Client
     }
 
     /**
-     * @param Order $order
+     * Request creation of an order
+     *
+     * @param Order $order order
      *
      * @return Order
+     *
      * @throws ClientException
      */
     public function requestOrderCreation(Order $order): Order
@@ -243,9 +262,7 @@ class Client
         if ($response->getStatusCode() !== 201) {
             $this->throwException($response);
         }
-        /**
-         * @var Order $result
-         */
+        /* @var Order $result */
         $result = $this->serializer->deserialize(
             (string)$response->getBody(),
             Order::class,
@@ -258,7 +275,16 @@ class Client
 
         return $result;
     }
-
+    
+    /**
+     * Get record by id
+     *
+     * @param string $recordid record_id
+     *
+     * @return Record
+     *
+     * @throws ClientException
+     */
     public function requestRecord(string $recordid) : Record
     {
         $request = $this->buildRequest('get', "records/$recordid");
@@ -267,9 +293,7 @@ class Client
         if ($response->getStatusCode() !== 200) {
             $this->throwException($response);
         }
-        /**
-         * @var Record $record
-         */
+        /* @var Record $record */
         $record = $this->serializer->deserialize(
             (string)$response->getBody(),
             Record::class,
@@ -280,7 +304,10 @@ class Client
     }
 
     /**
+     * Get list of orders
+     *
      * @return array|Order[]
+     *
      * @throws ClientException
      */
     public function requestOrderList(): array
@@ -291,9 +318,7 @@ class Client
         if ($response->getStatusCode() !== 200) {
             $this->throwException($response);
         }
-        /**
-         * @var Order[] $list
-         */
+        /* @var Order[] $list */
         $list = $this->serializer->deserialize(
             (string)$response->getBody(),
             Order::class . '[]',
@@ -311,7 +336,13 @@ class Client
     }
 
     /**
+     * Get order by id
+     * TODO: Why can id be null?
+     *
+     * @param null $orderId order identifier
+     *
      * @return Order|null
+     *
      * @throws ClientException
      * @throws UserNotAuthorizedException
      */
@@ -324,9 +355,7 @@ class Client
             $this->throwException($response);
         }
 
-        /**
-         * @var Order $order
-         */
+        /* @var Order $order */
         $order = $this->serializer->deserialize(
             (string)$response->getBody(),
             Order::class,
@@ -337,13 +366,21 @@ class Client
     }
 
     /**
-     * @param  Order $user
+     * Update order
+     *
+     * @param Order $order order
+     *
      * @return bool
+     *
      * @throws ClientException
      */
     public function requestOrderUpdate(Order $order) : bool
     {
-        $body = $this->serializer->serialize($order, 'json', ['groups' => ['order:update:request']]);
+        $body = $this->serializer->serialize(
+            $order,
+            'json',
+            ['groups' => ['order:update:request']]
+        );
         $request = $this->buildRequest('put', "orders/{$order->getId()}", $body);
         $response = $this->sendAuthenticatedRequest($request);
 
@@ -356,10 +393,14 @@ class Client
     }
 
     /**
-     * @param string $baseUrl
-     * @param string $username
-     * @param string $firstname
-     * @param string $lastname
+     * Request registration link
+     *
+     * @param string $baseUrl   baseUrl
+     * @param string $username  username
+     * @param string $firstname firstname
+     * @param string $lastname  lastname
+     *
+     * @return void
      *
      * @throws ClientException
      */
@@ -386,10 +427,13 @@ class Client
     }
 
     /**
-     * @param string $baseUrl
-     * @param string $username
+     * Request (new) password link by mail
+     *
+     * @param string $baseUrl  base url
+     * @param string $username username
      *
      * @return void
+     *
      * @throws ClientException
      */
     public function requestPasswordLink(string $baseUrl, string $username): void
@@ -404,8 +448,12 @@ class Client
     }
 
     /**
-     * @param string $baseUrl
-     * @param string $username
+     * Request (new) username link by mail
+     *
+     * @param string $baseUrl  base url
+     * @param string $username username
+     *
+     * @return void
      *
      * @throws ClientException
      */
@@ -421,23 +469,28 @@ class Client
     }
 
     /**
+     * Get user details
+     *
+     * @param null $userId      user identifier
+     * @param bool $forceReload force reload
+     *
      * @return User|null
+     *
      * @throws ClientException
      * @throws UserNotAuthorizedException
+     * @throws UserNotLoggedinException
      */
-    public function requestUserDetails($userId = null, $forceRelaod = false): ?User
+    public function requestUserDetails($userId = null, $forceReload = false): ?User
     {
         $logon = $this->restoreLogon();
 
-        /**
-         * @var User $user
-         */
+        /* @var User $user */
         $user = $this->session['user'] ?? null;
         $ownId = $logon->getOwnerId();
 
         if (null === $userId || $userId === $ownId) {
             // user asks for own profile data
-            if (!empty($user) && !$forceRelaod) {
+            if (!empty($user) && !$forceReload) {
                 return $user;
             }
             $userId = $ownId;
@@ -453,9 +506,7 @@ class Client
             $this->throwException($response);
         }
 
-        /**
-         * @var User $user
-         */
+        /* @var User $user */
         $user = $this->serializer->deserialize(
             (string)$response->getBody(),
             User::class,
@@ -470,9 +521,12 @@ class Client
     }
 
     /**
-     * @param User $user
+     * Create new user
+     *
+     * @param User $user user data
      *
      * @return User
+     *
      * @throws ClientException
      */
     public function requestUserCreation(User $user): User
@@ -491,9 +545,7 @@ class Client
         if ($response->getStatusCode() !== 201) {
             $this->throwException($response);
         }
-        /**
-         * @var User $result
-         */
+        /* @var User $result */
         $result = $this->serializer->deserialize(
             (string)$response->getBody(),
             User::class,
@@ -505,9 +557,12 @@ class Client
     }
 
     /**
-     * @param User $user
+     * Update user
+     *
+     * @param User $user user
      *
      * @return User
+     *
      * @throws ClientException
      */
     public function requestUserUpdate(User $user): User
@@ -516,9 +571,12 @@ class Client
     }
 
     /**
-     * @param User $user
+     * Update password
+     *
+     * @param User $user user
      *
      * @return User
+     *
      * @throws ClientException
      */
     public function requestUserPasswordUpdate(User $user): User
@@ -530,9 +588,12 @@ class Client
     }
 
     /**
-     * @param User $user
+     * Update username
+     *
+     * @param User $user user
      *
      * @return User
+     *
      * @throws ClientException
      */
     public function requestUserUsernameUpdate(User $user): User
@@ -546,7 +607,10 @@ class Client
     }
 
     /**
+     * Get list of users
+     *
      * @return User[]
+     *
      * @throws ClientException
      * @throws UserNotAuthorizedException
      */
@@ -566,9 +630,7 @@ class Client
         if ($response->getStatusCode() !== 200) {
             $this->throwException($response);
         }
-        /**
-         * @var Library[] $list
-         */
+        /* @var Library[] $list */
         $list = $this->serializer->deserialize(
             (string)$response->getBody(),
             User::class . '[]',
@@ -584,18 +646,28 @@ class Client
 
         return $this->session['users'] = array_combine($keys, $list);
     }
-
+    
+    /**
+     * Empty user list from session
+     *
+     * @return void
+     */
     public function flushUserList()
     {
         unset($this->session['users']);
     }
 
     /**
-     * throws an Exception in case the user does not have the requested permission
+     * Authorize user
+     *
+     * Throws an Exception in case the user does not have the requested permission
      * or the permission cannot be verified
      *
-     * @param  String    $permission Name of the permission
-     * @param  User|null $user       user object or null if we want to validate the currently logged in user
+     * @param String    $permission Name of the permission
+     * @param User|null $user       user or null for the currently logged in user
+     *
+     * @return void
+     *
      * @throws ClientException
      * @throws UserNotLoggedinException
      * @throws UserNotAuthorizedException
@@ -619,9 +691,12 @@ class Client
     }
 
     /**
-     * @param String $permission
+     * Check if user is authorized
+     *
+     * @param String $permission name of permission
      *
      * @return bool
+     *
      * @throws ClientException
      */
     public function isAuthorized(String $permission)
@@ -635,7 +710,10 @@ class Client
     }
 
     /**
+     * Get list of libraries
+     *
      * @return Library[]
+     *
      * @throws ClientException
      */
     public function requestLibraryList(): array
@@ -650,9 +728,7 @@ class Client
         if ($response->getStatusCode() !== 200) {
             $this->throwException($response);
         }
-        /**
-         * @var Library[] $list
-         */
+        /* @var Library[] $list */
         $list = $this->serializer->deserialize(
             (string)$response->getBody(),
             Library::class . '[]',
@@ -677,8 +753,12 @@ class Client
     }
 
     /**
-     * @param  $id
+     * Get library by id
+     *
+     * @param $id identifier
+     *
      * @return Library
+     *
      * @throws ClientException
      */
     public function requestLibraryById($id): Library
@@ -694,9 +774,7 @@ class Client
             $this->throwException($response);
         }
 
-        /**
-         * @var Library $list
-         */
+        /* @var Library $list */
         $library = $this->serializer->deserialize(
             (string)$response->getBody(),
             Library::class,
@@ -714,14 +792,18 @@ class Client
             $this->session->homeLibrary = [];
         }
 
-        return $this->session->homeLibrary[$this->locale] = array_combine($phpTypeCasting, [$library])[$id];
+        return $this->session->homeLibrary[$this->locale]
+            = array_combine($phpTypeCasting, [$library])[$id];
     }
 
     /**
-     * @param User  $user
-     * @param array $groups
+     * Do update user
+     *
+     * @param User  $user   user
+     * @param array $groups groups
      *
      * @return User
+     *
      * @throws ClientException
      */
     protected function doRequestUserUpdate(User $user, array $groups): User
@@ -733,9 +815,7 @@ class Client
         if ($response->getStatusCode() !== 200) {
             $this->throwException($response);
         }
-        /**
-         * @var User $result
-         */
+        /* @var User $result */
         $result = $this->serializer->deserialize(
             (string)$response->getBody(),
             User::class,
@@ -752,7 +832,12 @@ class Client
     }
 
     /**
+     * Refresh logon
+     *
+     * @param Logon $logon logon
+     *
      * @return Logon
+     *
      * @throws ClientException
      */
     protected function refreshLogon(Logon $logon): Logon
@@ -776,10 +861,13 @@ class Client
     }
 
     /**
-     * @param RequestInterface $request
-     * @param bool             $retryOn401
+     * Send request for authentication
+     *
+     * @param RequestInterface $request    request
+     * @param bool             $retryOn401 retry if http status is Unauthorized
      *
      * @return ResponseInterface
+     *
      * @throws ClientException
      */
     protected function sendAuthenticatedRequest(
@@ -799,9 +887,12 @@ class Client
     }
 
     /**
-     * @param RequestInterface $request
+     * Send request
+     *
+     * @param RequestInterface $request request
      *
      * @return ResponseInterface
+     *
      * @throws ClientException
      */
     protected function sendRequest(RequestInterface $request): ResponseInterface
@@ -812,7 +903,17 @@ class Client
             throw new ClientException(self::ERRMSG_HTTPCLIENT, 0, $exception);
         }
     }
-
+    
+    /**
+     * Build request object
+     *
+     * @param string $verb  verb
+     * @param string $path  path
+     * @param string $body  body
+     * @param array  $query query
+     *
+     * @return RequestInterface
+     */
     protected function buildRequest(
         string $verb,
         string $path,
@@ -844,7 +945,11 @@ class Client
     }
 
     /**
-     * @param ResponseInterface $response
+     * Throw exception
+     *
+     * @param ResponseInterface $response response
+     *
+     * @return void
      *
      * @throws ClientException
      */
@@ -856,14 +961,15 @@ class Client
     }
 
     /**
+     * Restore logon
+     *
      * @return Logon
+     *
      * @throws ClientException
      */
     protected function restoreLogon(): Logon
     {
-        /**
-         * @var Logon $logon
-         */
+        /* @var Logon $logon */
         if ($logon = $this->session['logon'] ?? null) {
             $logon->setToken($this->cookies->get('finc_fid_logon'));
             if (time() < $logon->getExpiresAt()) {
@@ -875,7 +981,14 @@ class Client
         $this->cookies->set('finc_fid_logon', null);
         throw new ClientException('Missing or expired logon.', 401);
     }
-
+    
+    /**
+     * Store logon
+     *
+     * @param Logon $logon logon
+     *
+     * @return Logon
+     */
     protected function storeLogon(Logon $logon): Logon
     {
         $this->cookies->set('finc_fid_logon', $token = $logon->getToken());
@@ -884,13 +997,18 @@ class Client
         $logon->setToken($token);
         return $logon;
     }
-
+    
+    /**
+     * Parse logon
+     *
+     * @param string $logon logon
+     *
+     * @return Logon
+     */
     protected function parseLogon(string $logon): Logon
     {
         $logon = $this->serializer->deserialize($logon, Logon::class, 'json');
-        /**
-         * @var Logon $logon
-         */
+        /* @var Logon $logon */
         return $logon;
     }
 }
diff --git a/module/fid/src/Service/ClientException.php b/module/fid/src/Service/ClientException.php
index 3e10451c98f..1691046a5f9 100644
--- a/module/fid/src/Service/ClientException.php
+++ b/module/fid/src/Service/ClientException.php
@@ -1,7 +1,11 @@
 <?php
 /**
+ * Fidis client exception
+ *
  * 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,11 +19,23 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * @author  Sebastian Kehr <kehr@ub.uni-leipzig.de>
- * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace fid\Service;
 
+/**
+ * FID client exception class
+ *
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
+ */
 class ClientException extends \Exception
 {
 }
diff --git a/module/fid/src/Service/ClientFactory.php b/module/fid/src/Service/ClientFactory.php
index 5e9af766797..4b949464590 100644
--- a/module/fid/src/Service/ClientFactory.php
+++ b/module/fid/src/Service/ClientFactory.php
@@ -1,6 +1,10 @@
 <?php
 /**
- * Copyright (C) 2020 Leipzig University Library
+ * Fidis client factory
+ *
+ * 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
@@ -15,8 +19,11 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * @author  Sebastian Kehr <kehr@ub.uni-leipzig.de>
- * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace fid\Service;
 
@@ -31,47 +38,42 @@ use VuFind\Cookie\CookieManager;
 use Zend\Session\Container as Session;
 use Zend\Session\SessionManager;
 
+/**
+ * FID client factory class
+ *
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
+ */
 class ClientFactory
 {
     /**
-     * @param ContainerInterface $container
+     * Invoke Client
+     *
+     * @param ContainerInterface $container container
      *
      * @return Client
      */
     public function __invoke(ContainerInterface $container): Client
     {
-        /**
-         * @var ClientConfigListener $clientConfigListener
-         */
+        /* @var ClientConfigListener $clientConfigListener */
         $clientConfigListener = $container->get(ClientConfigListener::class);
-        /**
-         * @var SessionManager $sessionManager
-         */
+        /* @var SessionManager $sessionManager */
         $sessionManager = $container->get(SessionManager::class);
         $session = new Session(Client::class, $sessionManager);
-        /**
-         * @var CookieManager $cookies
-         */
+        /* @var CookieManager $cookies */
         $cookies = $container->get(CookieManager::class);
-        /**
-         * @var SerializerInterface $serializer
-         */
+        /* @var SerializerInterface $serializer */
         $serializer = $container->get(SerializerInterface::class);
-        /**
-         * @var HttpClientInterface $httpClient
-         */
+        /* @var HttpClientInterface $httpClient */
         $httpClient = $container->get(HttpClientInterface::class);
-        /**
-         * @var UriFactoryInterface $uriFactory
-         */
+        /* @var UriFactoryInterface $uriFactory */
         $uriFactory = $container->get(UriFactoryInterface::class);
-        /**
-         * @var StreamFactoryInterface $streamFactory
-         */
+        /* @var StreamFactoryInterface $streamFactory */
         $streamFactory = $container->get(StreamFactoryInterface::class);
-        /**
-         * @var RequestFactoryInterface $requestFactory
-         */
+        /* @var RequestFactoryInterface $requestFactory */
         $requestFactory = $container->get(RequestFactoryInterface::class);
 
         return new Client(
diff --git a/module/fid/src/Service/DataTransferObject/Address.php b/module/fid/src/Service/DataTransferObject/Address.php
index 8b1ea912994..ada00f14302 100644
--- a/module/fid/src/Service/DataTransferObject/Address.php
+++ b/module/fid/src/Service/DataTransferObject/Address.php
@@ -1,7 +1,11 @@
 <?php
 /**
+ * Dto for fid address data
+ *
  * 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,16 +19,30 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * @author  Sebastian Kehr <kehr@ub.uni-leipzig.de>
- * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace fid\Service\DataTransferObject;
 
 use Symfony\Component\Serializer\Annotation\Groups;
 
+/**
+ * FID address dto class
+ *
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
+ */
 class Address
 {
     /**
+     * Address identifier
+     *
      * @var      string|null
      * @Groups({
      *     "user:details:response",
@@ -35,12 +53,12 @@ class Address
      */
     protected $id;
 
-    /**
-     * @var User|null
-     */
+    /* @var User|null */
     protected $user;
 
     /**
+     * First address line
+     *
      * @var      string|null
      * @Groups({
      *     "user:details:response",
@@ -53,6 +71,8 @@ class Address
     protected $line1;
 
     /**
+     * Second address line
+     *
      * @var      string|null
      * @Groups({
      *     "user:details:response",
@@ -65,6 +85,8 @@ class Address
     protected $line2;
 
     /**
+     * Postal
+     *
      * @var      string|null
      * @Groups({
      *     "user:details:response",
@@ -77,6 +99,8 @@ class Address
     protected $zip;
 
     /**
+     * Town
+     *
      * @var      string|null
      * @Groups({
      *     "user:details:response",
@@ -89,6 +113,8 @@ class Address
     protected $city;
 
     /**
+     * Country
+     *
      * @var      string|null
      * @Groups({
      *     "user:details:response",
@@ -101,38 +127,52 @@ class Address
     protected $country;
 
     /**
+     * Get address identifier
+     *
      * @return string|null
      */
     public function getId(): ?string
     {
         return $this->id;
     }
-
+    
     /**
-     * @param string|null $id
+     * Get address identifier
+     *
+     * @param string|null $id identifier
+     *
+     * @return void
      */
     public function setId(?string $id): void
     {
         $this->id = $id;
     }
-
+    
     /**
-     * @return User|null
+     * Set user
+     *
+     * @param User|null $user User
+     *
+     * @return void
      */
-    public function getUser(): ?User
+    public function setUser(?User $user): void
     {
-        return $this->user;
+        $this->user = $user;
     }
-
+    
     /**
-     * @param User|null $user
+     * Get user
+     *
+     * @return User|null
      */
-    public function setUser(?User $user): void
+    public function getUser(): ?User
     {
-        $this->user = $user;
+        return $this->user;
     }
-
+    
     /**
+     * Get first line
+     *
      * @return string|null
      */
     public function getLine1(): ?string
@@ -141,7 +181,11 @@ class Address
     }
 
     /**
-     * @param string|null $line1
+     * Set first line
+     *
+     * @param string|null $line1 first line
+     *
+     * @return void
      */
     public function setLine1(?string $line1): void
     {
@@ -149,6 +193,8 @@ class Address
     }
 
     /**
+     * Get second line
+     *
      * @return string|null
      */
     public function getLine2(): ?string
@@ -157,7 +203,11 @@ class Address
     }
 
     /**
-     * @param string|null $line2
+     * Set second line
+     *
+     * @param string|null $line2 second line
+     *
+     * @return void
      */
     public function setLine2(?string $line2): void
     {
@@ -165,6 +215,8 @@ class Address
     }
 
     /**
+     * Get postal
+     *
      * @return string|null
      */
     public function getZip(): ?string
@@ -173,7 +225,11 @@ class Address
     }
 
     /**
-     * @param string|null $zip
+     * Set postal
+     *
+     * @param string|null $zip postal
+     *
+     * @return void
      */
     public function setZip(?string $zip): void
     {
@@ -181,7 +237,9 @@ class Address
     }
 
     /**
-     * @return string|null
+     * Get town
+     *
+     * @return string|null town
      */
     public function getCity(): ?string
     {
@@ -189,7 +247,11 @@ class Address
     }
 
     /**
-     * @param string|null $city
+     * Set town
+     *
+     * @param string|null $city town
+     *
+     * @return void
      */
     public function setCity(?string $city): void
     {
@@ -197,6 +259,8 @@ class Address
     }
 
     /**
+     * Get country
+     *
      * @return string|null
      */
     public function getCountry(): ?string
@@ -205,18 +269,34 @@ class Address
     }
 
     /**
-     * @param string|null $country
+     * Set country
+     *
+     * @param string|null $country country
+     *
+     * @return void
      */
     public function setCountry(?string $country): void
     {
         $this->country = $country;
     }
-
+    
+    /**
+     * Represent object as a string
+     *
+     * @return string
+     */
     public function __toString()
     {
-        return $this->id . ': ' . $this->line1 . ' ' . $this->line2 . '; ' . $this->zip . ' ' . $this->city . '; ' . $this->country;
+        return $this->id . ': ' . $this->line1 . ' '
+            . $this->line2 . '; ' . $this->zip . ' '
+            . $this->city . '; ' . $this->country;
     }
-
+    
+    /**
+     * Check if line1, zip and city is set
+     *
+     * @return bool
+     */
     public function isCompleteAddress() : bool
     {
         return strlen($this->line1) > 0
diff --git a/module/fid/src/Service/DataTransferObject/Library.php b/module/fid/src/Service/DataTransferObject/Library.php
index 56a0e84bb5e..3063dc9c522 100644
--- a/module/fid/src/Service/DataTransferObject/Library.php
+++ b/module/fid/src/Service/DataTransferObject/Library.php
@@ -1,6 +1,10 @@
 <?php
 /**
- * Copyright (C) 2019  Leipzig University Library
+ * FID dto for libraries
+ *
+ * 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 as published by
@@ -15,49 +19,49 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
- * @author  Sebastian Kehr <kehr@ub.uni-leipzig.de>
- * @license https://opensource.org/licenses/GPL-3.0 GNU GPLv3
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace fid\Service\DataTransferObject;
 
+/**
+ * FID library dto class
+ *
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
+ */
 class Library
 {
-    /**
-     * @var string
-     */
+    /* @var string */
     protected $id;
 
-    /**
-     * @var string
-     */
+    /* @var string */
     protected $ezb = '';
 
-    /**
-     * @var string
-     */
+    /* @var string */
     protected $dbis = '';
 
-    /**
-     * @var string
-     */
+    /* @var string */
     protected $network = '';
 
-    /**
-     * @var string
-     */
+    /* @var string */
     protected $boss = '';
 
-    /**
-     * @var string
-     */
+    /* @var string */
     protected $isil = '';
 
-    /**
-     * @var string
-     */
+    /* @var string */
     protected $label = '';
 
     /**
+     * Get identifier
+     *
      * @return string
      */
     public function getId(): string
@@ -66,7 +70,11 @@ class Library
     }
 
     /**
-     * @param string $id
+     * Set identifier
+     *
+     * @param string $id identifier
+     *
+     * @return void
      */
     public function setId(string $id): void
     {
@@ -74,6 +82,8 @@ class Library
     }
 
     /**
+     * Get Electronic Journal Database
+     *
      * @return string
      */
     public function getEzb(): string
@@ -82,7 +92,11 @@ class Library
     }
 
     /**
-     * @param string $ezb
+     * Get Electronic Journal Database
+     *
+     * @param string $ezb ezb
+     *
+     * @return void
      */
     public function setEzb(string $ezb): void
     {
@@ -90,6 +104,8 @@ class Library
     }
 
     /**
+     * Get Database Information System
+     *
      * @return string
      */
     public function getDbis(): string
@@ -98,7 +114,11 @@ class Library
     }
 
     /**
-     * @param string $dbis
+     * Set Database Information System
+     *
+     * @param string $dbis dbis
+     *
+     * @return void
      */
     public function setDbis(string $dbis): void
     {
@@ -106,6 +126,8 @@ class Library
     }
 
     /**
+     * Get network
+     *
      * @return string
      */
     public function getNetwork(): string
@@ -114,7 +136,11 @@ class Library
     }
 
     /**
-     * @param string $network
+     * Set Network
+     *
+     * @param string $network network
+     *
+     * @return void
      */
     public function setNetwork(string $network): void
     {
@@ -122,6 +148,8 @@ class Library
     }
 
     /**
+     * Get BSZ One Stop Search
+     *
      * @return string
      */
     public function getBoss(): string
@@ -130,7 +158,11 @@ class Library
     }
 
     /**
-     * @param string $boss
+     * Set BSZ One Stop Search
+     *
+     * @param string $boss BOSS
+     *
+     * @return void
      */
     public function setBoss(string $boss): void
     {
@@ -138,6 +170,8 @@ class Library
     }
 
     /**
+     * Get international standard identifier
+     *
      * @return string
      */
     public function getIsil(): string
@@ -146,7 +180,11 @@ class Library
     }
 
     /**
-     * @param string $isil
+     * Set international standard identifier
+     *
+     * @param string $isil ISIL
+     *
+     * @return void
      */
     public function setIsil(string $isil): void
     {
@@ -154,6 +192,8 @@ class Library
     }
 
     /**
+     * Get label
+     *
      * @return string
      */
     public function getLabel(): string
@@ -162,7 +202,11 @@ class Library
     }
 
     /**
-     * @param string $label
+     * Set label
+     *
+     * @param string $label label
+     *
+     * @return void
      */
     public function setLabel(string $label): void
     {
diff --git a/module/fid/src/Service/DataTransferObject/Logon.php b/module/fid/src/Service/DataTransferObject/Logon.php
index 25afa7aec6e..9d2b43e510b 100644
--- a/module/fid/src/Service/DataTransferObject/Logon.php
+++ b/module/fid/src/Service/DataTransferObject/Logon.php
@@ -1,7 +1,11 @@
 <?php
 /**
+ * Dto for fid session
+ *
  * 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,44 +19,46 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * @author  Sebastian Kehr <kehr@ub.uni-leipzig.de>
- * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace fid\Service\DataTransferObject;
 
+/**
+ * FID logon dto class
+ *
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
+ */
 class Logon
 {
-    /**
-     * @var string|null
-     */
+    /* @var string|null */
     protected $username;
 
-    /**
-     * @var string|null
-     */
+    /* @var string|null */
     protected $password;
 
-    /**
-     * @var int|null
-     */
+    /* @var int|null */
     protected $stalesAt;
 
-    /**
-     * @var int|null
-     */
+    /* @var int|null */
     protected $expiresAt;
 
-    /**
-     * @var string|null
-     */
+    /* @var string|null */
     protected $token;
 
-    /**
-     * @var string|null
-     */
+    /* @var string|null */
     protected $ownerId;
 
     /**
+     * Get name of user
+     *
      * @return string|null
      */
     public function getUsername(): ?string
@@ -61,7 +67,11 @@ class Logon
     }
 
     /**
-     * @param string|null $username
+     * Set name of user
+     *
+     * @param string|null $username username
+     *
+     * @return void
      */
     public function setUsername(?string $username): void
     {
@@ -69,6 +79,8 @@ class Logon
     }
 
     /**
+     * Get user password
+     *
      * @return string|null
      */
     public function getPassword(): ?string
@@ -77,7 +89,11 @@ class Logon
     }
 
     /**
-     * @param string|null $password
+     * Set user password
+     *
+     * @param string|null $password password
+     *
+     * @return void
      */
     public function setPassword(?string $password): void
     {
@@ -85,7 +101,9 @@ class Logon
     }
 
     /**
-     * @return string|null
+     * Get auth token
+     *
+     * @return string|null token
      */
     public function getToken(): ?string
     {
@@ -93,6 +111,8 @@ class Logon
     }
 
     /**
+     * Get time in seconds when logon will stale
+     *
      * @return int|null
      */
     public function getStalesAt(): ?int
@@ -101,7 +121,11 @@ class Logon
     }
 
     /**
-     * @param int|null $stalesAt
+     * Set time in seconds when logon will stale
+     *
+     * @param int|null $stalesAt stales at
+     *
+     * @return void
      */
     public function setStalesAt(?int $stalesAt): void
     {
@@ -109,6 +133,8 @@ class Logon
     }
 
     /**
+     * Get time in seconds when logon will expire
+     *
      * @return int|null
      */
     public function getExpiresAt(): ?int
@@ -117,7 +143,11 @@ class Logon
     }
 
     /**
-     * @param int|null $expiresAt
+     * Set time in seconds when logon will expire
+     *
+     * @param int|null $expiresAt expires at
+     *
+     * @return void
      */
     public function setExpiresAt(?int $expiresAt): void
     {
@@ -125,7 +155,11 @@ class Logon
     }
 
     /**
-     * @param string|null $token
+     * Set token
+     *
+     * @param string|null $token token
+     *
+     * @return void
      */
     public function setToken(?string $token): void
     {
@@ -133,6 +167,8 @@ class Logon
     }
 
     /**
+     * Get owner identifier
+     *
      * @return string|null
      */
     public function getOwnerId(): ?string
@@ -141,7 +177,11 @@ class Logon
     }
 
     /**
-     * @param string|null $ownerId
+     * Set owner identifier
+     *
+     * @param string|null $ownerId owner id
+     *
+     * @return void
      */
     public function setOwnerId(?string $ownerId): void
     {
diff --git a/module/fid/src/Service/DataTransferObject/Order.php b/module/fid/src/Service/DataTransferObject/Order.php
index e368c3dee04..a15daf68bff 100644
--- a/module/fid/src/Service/DataTransferObject/Order.php
+++ b/module/fid/src/Service/DataTransferObject/Order.php
@@ -1,7 +1,11 @@
 <?php
 /**
+ * Dto for fid order
+ *
  * 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,8 +19,11 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * @author  Sebastian Kehr <kehr@ub.uni-leipzig.de>
- * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace fid\Service\DataTransferObject;
 
@@ -24,9 +31,20 @@ namespace fid\Service\DataTransferObject;
 
 use Symfony\Component\Serializer\Annotation\Groups;
 
+/**
+ * FID order dto class
+ *
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
+ */
 class Order
 {
     /**
+     * Identifier
+     *
      * @var      string|null
      * @Groups({
      *     "order:creation:response",
@@ -40,6 +58,8 @@ class Order
     protected $id;
 
     /**
+     * Type of order
+     *
      * @var      string
      * @Groups({
      *     "order:creation:request",
@@ -54,6 +74,8 @@ class Order
     protected $type = '';
 
     /**
+     * Label
+     *
      * @var      string
      * @Groups({
      *     "order:creation:request",
@@ -68,6 +90,8 @@ class Order
     protected $label = '';
 
     /**
+     * User
+     *
      * @var      User|null
      * @Groups({
      *     "order:creation:request",
@@ -82,6 +106,8 @@ class Order
     protected $user;
 
     /**
+     * Custom data
+     *
      * @var      array
      * @Groups({
      *     "order:creation:request",
@@ -96,6 +122,8 @@ class Order
     protected $data = [];
 
     /**
+     * Creation time
+     *
      * @var      \DateTime
      * @Groups({
      *     "order:creation:response",
@@ -111,6 +139,8 @@ class Order
     public const DATETIME_FORMAT = 'Y-m-d H:i:s';
 
     /**
+     * Get identifier
+     *
      * @return string|null
      */
     public function getId(): ?string
@@ -119,7 +149,11 @@ class Order
     }
 
     /**
-     * @param string|null $id
+     * Set identifier
+     *
+     * @param string|null $id identifier
+     *
+     * @return void
      */
     public function setId(?string $id): void
     {
@@ -127,6 +161,8 @@ class Order
     }
 
     /**
+     * Get label
+     *
      * @return string
      */
     public function getLabel(): string
@@ -135,7 +171,11 @@ class Order
     }
 
     /**
-     * @param string $label
+     * Set label
+     *
+     * @param string $label label
+     *
+     * @return void
      */
     public function setLabel(string $label): void
     {
@@ -143,6 +183,8 @@ class Order
     }
 
     /**
+     * Get type of order
+     *
      * @return string
      */
     public function getType(): string
@@ -151,7 +193,11 @@ class Order
     }
 
     /**
-     * @param string $type
+     * Set type of order
+     *
+     * @param string $type type
+     *
+     * @return void
      */
     public function setType(string $type): void
     {
@@ -159,6 +205,8 @@ class Order
     }
 
     /**
+     * Get fid user
+     *
      * @return User|null
      */
     public function getUser(): ?User
@@ -167,7 +215,11 @@ class Order
     }
 
     /**
-     * @param User|null $user
+     * Set fid user
+     *
+     * @param User|null $user user
+     *
+     * @return void
      */
     public function setUser(?User $user): void
     {
@@ -175,6 +227,8 @@ class Order
     }
 
     /**
+     * Get data - container for additional miscellaneous information
+     *
      * @return array
      */
     public function getData(): array
@@ -183,7 +237,11 @@ class Order
     }
 
     /**
-     * @param array $data
+     * Set data - container for additional miscellaneous information
+     *
+     * @param array $data custom data
+     *
+     * @return void
      */
     public function setData(array $data): void
     {
@@ -191,6 +249,8 @@ class Order
     }
 
     /**
+     * Get creation date
+     *
      * @return \DateTime
      */
     public function getCreatedAt(): \DateTime
@@ -199,27 +259,48 @@ class Order
     }
 
     /**
-     * @param \DateTime $createdAt
+     * Set creation date
+     *
+     * @param \DateTime $createdAt created at
+     *
+     * @return void
      */
     public function setCreatedAt(\DateTime $createdAt): void
     {
         $this->createdAt = $createdAt;
     }
-
+    
+    /**
+     * Get order label
+     *
+     * @return string
+     */
     public function __toString()
     {
         return $this->getLabel();
     }
-
+    
+    /**
+     * Get due date
+     *
+     * @return \DateTime|null
+     */
     public function getDueDate(): ? \DateTime
     {
         return (!empty($this->data['dueDate']))
-            ? \DateTime::createFromFormat(self::DATETIME_FORMAT, $this->data['dueDate'])
+            ? \DateTime::createFromFormat(
+                self::DATETIME_FORMAT,
+                $this->data['dueDate']
+            )
             : null;
     }
 
     /**
-     * @param \DateTime $dueDate
+     * Set due date
+     *
+     * @param \DateTime $date due date
+     *
+     * @return void
      */
     public function setDueDate(\DateTime $date)
     {
@@ -227,12 +308,22 @@ class Order
         $data['dueDate'] = $date->format(self::DATETIME_FORMAT);
         $this->setData($data);
     }
-
+    
+    /**
+     * Get due date as string d.m.Y.
+     *
+     * @return String
+     */
     public function displayDueDate(): String
     {
         return $this->getDueDate() ? $this->getDueDate()->format('d.m.Y') : '';
     }
-
+    
+    /**
+     * Check due date
+     *
+     * @return bool
+     */
     public function isOverdue() : bool
     {
         if ($duedate = $this->getDueDate()) {
@@ -244,6 +335,8 @@ class Order
     }
 
     /**
+     * Get order status
+     *
      * @return string
      */
     public function getStatus(): ? string
@@ -252,7 +345,11 @@ class Order
     }
 
     /**
-     * @param string $status
+     * Set order status
+     *
+     * @param string $status status
+     *
+     * @return void
      */
     public function setStatus(?string $status): void
     {
@@ -260,7 +357,12 @@ class Order
             $this->data['status'] = $status;
         }
     }
-
+    
+    /**
+     * Get record identifier
+     *
+     * @return mixed|null
+     */
     public function getRecordId()
     {
         return $this->data['record']['id'] ?? null;
diff --git a/module/fid/src/Service/DataTransferObject/Record.php b/module/fid/src/Service/DataTransferObject/Record.php
index f2981bd704e..715f44aefe5 100644
--- a/module/fid/src/Service/DataTransferObject/Record.php
+++ b/module/fid/src/Service/DataTransferObject/Record.php
@@ -1,6 +1,10 @@
 <?php
 /**
- * Copyright (C) 2019  Leipzig University Library
+ * Dto for short record representation in fid (orders)
+ *
+ * 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 as published by
@@ -15,24 +19,34 @@
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
- * @author  Sebastian Kehr <kehr@ub.uni-leipzig.de>
- * @license https://opensource.org/licenses/GPL-3.0 GNU GPLv3
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace fid\Service\DataTransferObject;
 
+/**
+ * FID order dto class
+ *
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
+ */
 class Record
 {
-    /**
-     * @var string
-     */
+    /* @var string */
     protected $id;
 
-    /**
-     * @var bool
-     */
+    /* @var bool */
     protected $ordered = '';
 
     /**
+     * Get identifier
+     *
      * @return string
      */
     public function getId(): string
@@ -41,7 +55,11 @@ class Record
     }
 
     /**
-     * @param string $id
+     * Set identifier
+     *
+     * @param string $id record_id
+     *
+     * @return void
      */
     public function setId(string $id): void
     {
@@ -49,6 +67,8 @@ class Record
     }
 
     /**
+     * Get is ordered
+     *
      * @return bool
      */
     public function getOrdered(): bool
@@ -57,7 +77,11 @@ class Record
     }
 
     /**
-     * @param bool $ordered
+     * Set is ordered
+     *
+     * @param bool $ordered is Ordered
+     *
+     * @return void
      */
     public function setOrdered(bool $ordered): void
     {
diff --git a/module/fid/src/Service/DataTransferObject/User.php b/module/fid/src/Service/DataTransferObject/User.php
index 42c642eff19..40c861a7b5a 100644
--- a/module/fid/src/Service/DataTransferObject/User.php
+++ b/module/fid/src/Service/DataTransferObject/User.php
@@ -1,7 +1,11 @@
 <?php
 /**
+ * Dto for fid user
+ *
  * 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,16 +19,30 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * @author  Sebastian Kehr <kehr@ub.uni-leipzig.de>
- * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace fid\Service\DataTransferObject;
 
 use Symfony\Component\Serializer\Annotation\Groups;
 
+/**
+ * FID order dto class
+ *
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
+ */
 class User
 {
     /**
+     * Identifier
+     *
      * @var      null|string
      * @Groups({
      *     "order:creation:response",
@@ -38,6 +56,8 @@ class User
     protected $id;
 
     /**
+     * Username
+     *
      * @var      null|string
      * @Groups({
      *     "order:creation:response",
@@ -53,6 +73,8 @@ class User
     protected $username;
 
     /**
+     * Password
+     *
      * @var      null|string
      * @Groups({
      *     "user:details:response",
@@ -63,6 +85,8 @@ class User
     protected $password;
 
     /**
+     * Salutation
+     *
      * @var      string
      * @Groups({
      *     "user:details:response",
@@ -75,6 +99,8 @@ class User
     protected $salutation;
 
     /**
+     * Academic title
+     *
      * @var      string
      * @Groups({
      *     "user:details:response",
@@ -87,6 +113,8 @@ class User
     protected $academicTitle;
 
     /**
+     * Firstname
+     *
      * @var      null|string
      * @Groups({
      *     "order:creation:response",
@@ -102,6 +130,8 @@ class User
     protected $firstname;
 
     /**
+     * Lastname
+     *
      * @var      null|string
      * @Groups({
      *     "order:creation:response",
@@ -117,6 +147,8 @@ class User
     protected $lastname;
 
     /**
+     * Home library
+     *
      * @var      null|string
      * @Groups({
      *     "user:details:response",
@@ -129,6 +161,8 @@ class User
     protected $homeLibrary;
 
     /**
+     * College
+     *
      * @var      string
      * @Groups({
      *     "user:details:response",
@@ -141,6 +175,8 @@ class User
     protected $college = '';
 
     /**
+     * Job title
+     *
      * @var      string
      * @Groups({
      *     "user:details:response",
@@ -153,6 +189,8 @@ class User
     protected $jobTitle = '';
 
     /**
+     * Addresses
+     *
      * @var      Address[]
      * @Groups({
      *     "user:details:response",
@@ -165,6 +203,8 @@ class User
     protected $addresses = [];
 
     /**
+     * Orders
+     *
      * @var      Order[]
      * @Groups({
      *     "user:details:response",
@@ -175,6 +215,8 @@ class User
     protected $orders = [];
 
     /**
+     * Permissions
+     *
      * @var      array[]
      * @Groups({
      *     "user:details:response",
@@ -187,6 +229,8 @@ class User
     protected $permissions = [];
 
     /**
+     * Custom Data
+     *
      * @var      array
      * @Groups({
      *     "user:details:response",
@@ -202,7 +246,7 @@ class User
      * Magic function as shortcut for all getters
      * TODO ensure public visibility of all called getters
      *
-     * @param $name
+     * @param $name name
      *
      * @return |null
      */
@@ -217,6 +261,8 @@ class User
     }
 
     /**
+     * Get identifier
+     *
      * @return string|null
      */
     public function getId(): ?string
@@ -225,7 +271,11 @@ class User
     }
 
     /**
-     * @param string|null $id
+     * Set identifier
+     *
+     * @param string|null $id id
+     *
+     * @return void
      */
     public function setId(?string $id): void
     {
@@ -233,6 +283,8 @@ class User
     }
 
     /**
+     * Get username
+     *
      * @return string|null
      */
     public function getUsername(): ?string
@@ -241,7 +293,11 @@ class User
     }
 
     /**
-     * @param string|null $username
+     * Set username
+     *
+     * @param string|null $username username
+     *
+     * @return void
      */
     public function setUsername(?string $username): void
     {
@@ -249,6 +305,8 @@ class User
     }
 
     /**
+     * Get password
+     *
      * @return string|null
      */
     public function getPassword(): ?string
@@ -257,7 +315,11 @@ class User
     }
 
     /**
-     * @param string|null $password
+     * Set password
+     *
+     * @param string|null $password password
+     *
+     * @return void
      */
     public function setPassword(?string $password): void
     {
@@ -265,6 +327,8 @@ class User
     }
 
     /**
+     * Get salutation
+     *
      * @return string|null
      */
     public function getSalutation(): ?string
@@ -273,7 +337,11 @@ class User
     }
 
     /**
-     * @param string|null $salutation
+     * Set salutation
+     *
+     * @param string|null $salutation salutation
+     *
+     * @return void
      */
     public function setSalutation(?string $salutation): void
     {
@@ -281,6 +349,8 @@ class User
     }
 
     /**
+     * Get academic title
+     *
      * @return string|null
      */
     public function getAcademicTitle(): ?string
@@ -289,7 +359,11 @@ class User
     }
 
     /**
-     * @param string|null $academicTitle
+     * Set academic title
+     *
+     * @param string|null $academicTitle academic title
+     *
+     * @return void
      */
     public function setAcademicTitle(?string $academicTitle): void
     {
@@ -297,6 +371,8 @@ class User
     }
 
     /**
+     * Get firsname
+     *
      * @return string|null
      */
     public function getFirstname(): ?string
@@ -305,7 +381,11 @@ class User
     }
 
     /**
-     * @param string|null $firstname
+     * Set firstname
+     *
+     * @param string|null $firstname firstname
+     *
+     * @return void
      */
     public function setFirstname(?string $firstname): void
     {
@@ -313,6 +393,8 @@ class User
     }
 
     /**
+     * Get lastname
+     *
      * @return string|null
      */
     public function getLastname(): ?string
@@ -321,7 +403,11 @@ class User
     }
 
     /**
-     * @param string|null $lastname
+     * Set lastname
+     *
+     * @param string|null $lastname lastname
+     *
+     * @return void
      */
     public function setLastname(?string $lastname): void
     {
@@ -329,6 +415,8 @@ class User
     }
 
     /**
+     * Get home library
+     *
      * @return string
      */
     public function getHomeLibrary(): string
@@ -337,7 +425,11 @@ class User
     }
 
     /**
-     * @param string $homeLibrary
+     * Set home library
+     *
+     * @param string $homeLibrary home library
+     *
+     * @return void
      */
     public function setHomeLibrary(string $homeLibrary): void
     {
@@ -345,6 +437,8 @@ class User
     }
 
     /**
+     * Get collage
+     *
      * @return string
      */
     public function getCollege(): string
@@ -353,7 +447,11 @@ class User
     }
 
     /**
-     * @param string $college
+     * Set collage
+     *
+     * @param string $college college
+     *
+     * @return void
      */
     public function setCollege(string $college): void
     {
@@ -361,6 +459,8 @@ class User
     }
 
     /**
+     * Get job title
+     *
      * @return string|null
      */
     public function getJobTitle(): ?string
@@ -369,7 +469,11 @@ class User
     }
 
     /**
-     * @param string|null $jobTitle
+     * Set job title
+     *
+     * @param string|null $jobTitle job title
+     *
+     * @return void
      */
     public function setJobTitle(?string $jobTitle): void
     {
@@ -377,6 +481,8 @@ class User
     }
 
     /**
+     * Get addresses
+     *
      * @return Address[]
      */
     public function getAddresses(): array
@@ -385,6 +491,8 @@ class User
     }
 
     /**
+     * Get delivery address
+     *
      * @return Address | null
      */
     public function getDeliveryAddress(): ?Address
@@ -392,11 +500,14 @@ class User
         if (empty($addresses = $this->getAddresses())) {
             return null;
         }
-        $addressIndex = !empty($this->getData()["deliveryAddress"]) ? $this->getData()["deliveryAddress"] : 0;
+        $addressIndex = !empty($this->getData()["deliveryAddress"]) ?
+            $this->getData()["deliveryAddress"] : 0;
         return $addresses[$addressIndex];
     }
 
     /**
+     * Get deleted flag
+     *
      * @return bool
      */
     public function isDeleted(): bool
@@ -405,6 +516,10 @@ class User
     }
 
     /**
+     * Set deleted flag
+     *
+     * @param bool $delete delete
+     *
      * @return void
      */
     public function setDeleted(bool $delete): void
@@ -416,7 +531,10 @@ class User
     }
 
     /**
-     * @param  string $deletedAt
+     * Set deleted at
+     *
+     * @param string $deletedAt deleted at
+     *
      * @return void
      */
     public function setDeletedAt(string $deletedAt): void
@@ -425,11 +543,14 @@ class User
     }
 
     /**
+     * Get whether delivery address is a business address
+     *
      * @return boolean
      */
     public function deliveryAddressIsBusinessAddress(): bool
     {
-        $addressIndex = !empty($this->getData()["deliveryAddress"]) ? $this->getData()["deliveryAddress"] : 0;
+        $addressIndex = !empty($this->getData()["deliveryAddress"]) ?
+            $this->getData()["deliveryAddress"] : 0;
         if ($addressIndex == 0) {
             return true;
         } else {
@@ -438,15 +559,22 @@ class User
     }
 
     /**
+     * Get if user has subscribed a fid newsletter
+     *
      * @return boolean
      */
     public function isNewsletter(): bool
     {
-        return !empty($this->getData()["newsletter"]) ? $this->getData()["newsletter"] : 0;
+        return !empty($this->getData()["newsletter"]) ?
+            $this->getData()["newsletter"] : 0;
     }
 
     /**
-     * @param Address[] $addresses
+     * Set addresses
+     *
+     * @param Address[] $addresses addresses
+     *
+     * @return void
      */
     public function setAddresses(array $addresses): void
     {
@@ -457,6 +585,8 @@ class User
     }
 
     /**
+     * Get orders
+     *
      * @return Order[]
      */
     public function getOrders(): array
@@ -465,7 +595,11 @@ class User
     }
 
     /**
-     * @param Order[] $orders
+     * Set orders
+     *
+     * @param Order[] $orders orders
+     *
+     * @return void
      */
     public function setOrders(array $orders): void
     {
@@ -476,7 +610,11 @@ class User
     }
 
     /**
-     * @param Order $order
+     * Add order
+     *
+     * @param Order $order order
+     *
+     * @return void
      */
     public function addOrder($order): void
     {
@@ -484,6 +622,8 @@ class User
     }
 
     /**
+     * Get permissions
+     *
      * @return array[]
      */
     public function getPermissions(): array
@@ -492,13 +632,24 @@ class User
     }
 
     /**
-     * @param array[] $permissions
+     * Set permissions
+     *
+     * @param array[] $permissions permissions
+     *
+     * @return void
      */
     public function setPermissions(array $permissions): void
     {
         $this->permissions = $permissions;
     }
-
+    
+    /**
+     * Check is user has given permission
+     *
+     * @param $permission permission
+     *
+     * @return bool
+     */
     public function hasPermission($permission): bool
     {
         if (isset($this->permissions[$permission])
@@ -510,6 +661,8 @@ class User
     }
 
     /**
+     * Get custom data
+     *
      * @return array
      */
     public function getData(): array
@@ -518,7 +671,11 @@ class User
     }
 
     /**
-     * @param array $data
+     * Set custom data
+     *
+     * @param array $data data
+     *
+     * @return void
      */
     public function setData(array $data): void
     {
@@ -526,13 +683,20 @@ class User
     }
 
     /**
+     * Get libero id
+     *
      * @return string
      */
     public function getLiberoId() : string
     {
         return 'FID' . str_pad($this->getId(), 10, "0", STR_PAD_LEFT);
     }
-
+    
+    /**
+     * Get all properties except password
+     *
+     * @return array
+     */
     public function getFieldList()
     {
         $fields = [];
@@ -544,7 +708,15 @@ class User
         }
         return $fields;
     }
-
+    
+    /**
+     * Export user data as string
+     *
+     * @param array  $fields    fields
+     * @param string $delimiter delimiter
+     *
+     * @return string
+     */
     public function export($fields, $delimiter="\t")
     {
         $output = '';
diff --git a/module/fid/src/Service/UserAuthorizationException.php b/module/fid/src/Service/UserAuthorizationException.php
index e8557c35035..d5ab5a59a5c 100644
--- a/module/fid/src/Service/UserAuthorizationException.php
+++ b/module/fid/src/Service/UserAuthorizationException.php
@@ -1,7 +1,11 @@
 <?php
 /**
+ * Fidis client user authorization exception
+ *
  * 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,11 +19,23 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * @author  Sebastian Kehr <kehr@ub.uni-leipzig.de>
- * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace fid\Service;
 
+/**
+ * FID client user authorization exception class
+ *
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
+ */
 class UserAuthorizationException extends \Exception
 {
 }
diff --git a/module/fid/src/Service/UserNotAuthorizedException.php b/module/fid/src/Service/UserNotAuthorizedException.php
index f0845ad537c..366d2a3c0de 100644
--- a/module/fid/src/Service/UserNotAuthorizedException.php
+++ b/module/fid/src/Service/UserNotAuthorizedException.php
@@ -1,7 +1,11 @@
 <?php
 /**
+ * Fidis client user unauthorized exception
+ *
  * 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,11 +19,23 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * @author  Sebastian Kehr <kehr@ub.uni-leipzig.de>
- * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace fid\Service;
 
+/**
+ * FID client user unauthorized exception class
+ *
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
+ */
 class UserNotAuthorizedException extends UserAuthorizationException
 {
 }
diff --git a/module/fid/src/Service/UserNotLoggedinException.php b/module/fid/src/Service/UserNotLoggedinException.php
index 37a27dbbbf5..d82071a071e 100644
--- a/module/fid/src/Service/UserNotLoggedinException.php
+++ b/module/fid/src/Service/UserNotLoggedinException.php
@@ -1,7 +1,11 @@
 <?php
 /**
+ * Fidis client user logged-out exception
+ *
  * 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,11 +19,23 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * @author  Sebastian Kehr <kehr@ub.uni-leipzig.de>
- * @license http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
  */
 namespace fid\Service;
 
+/**
+ * FID client user logged-out exception class
+ *
+ * @category VuFind
+ * @package  Service
+ * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
+ * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
+ * @link     https://vufind.org/wiki/development Wiki
+ */
 class UserNotLoggedinException extends UserAuthorizationException
 {
 }
-- 
GitLab