diff --git a/MDErrorReporter.php b/MDErrorReporter.php index 9e980ae..d7253bb 100644 --- a/MDErrorReporter.php +++ b/MDErrorReporter.php @@ -107,9 +107,8 @@ final class MDErrorReporter { $msg .= \sprintf("%-{$longestKey}s :: %s", $key, (string)$value) . PHP_EOL; } } - $msg .= PHP_EOL; - return $msg; + return $msg . PHP_EOL; } @@ -120,15 +119,13 @@ final class MDErrorReporter { */ public function getAdditionalDebuggingInfo():array { - $output = [ + return [ "Current memory usage" => $this->human_filesize(\memory_get_usage()), "Peak memory usage" => $this->human_filesize(\memory_get_peak_usage()), "Included / required files" => \get_included_files(), # "Allowed memory usage" => $this->human_filesize((int)ini_get("memory_limit")), ]; - return $output; - } /** diff --git a/exceptions/generic/MDAccessDeniedException.php b/exceptions/generic/MDAccessDeniedException.php index 3b53df6..1394754 100644 --- a/exceptions/generic/MDAccessDeniedException.php +++ b/exceptions/generic/MDAccessDeniedException.php @@ -2,7 +2,7 @@ declare(strict_types = 1); /** - * Custom exception class for invalid page parameters. + * Custom exception class to throw when users attempt to access a page without necessary permissions. */ final class MDAccessDeniedException extends MDExpectedException { /** @@ -12,8 +12,7 @@ final class MDAccessDeniedException extends MDExpectedException { */ public function errorMessage() { //error message - $errorMsg = 'Parameter: ' . $this->getMessage() . ' is not a valid, numeric values.'; - return $errorMsg; + return 'Access denied: ' . $this->getMessage(); } } diff --git a/exceptions/generic/MDConfigCannotBeLoadedException.php b/exceptions/generic/MDConfigCannotBeLoadedException.php index 223f26c..913680b 100644 --- a/exceptions/generic/MDConfigCannotBeLoadedException.php +++ b/exceptions/generic/MDConfigCannotBeLoadedException.php @@ -12,8 +12,7 @@ final class MDConfigCannotBeLoadedException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'Could not connect to databse. Please try again later.'; - return $errorMsg; + return 'Could not connect to databse. Please try again later.'; } } diff --git a/exceptions/generic/MDExpectedException.php b/exceptions/generic/MDExpectedException.php index 7808de8..3f8ac1a 100644 --- a/exceptions/generic/MDExpectedException.php +++ b/exceptions/generic/MDExpectedException.php @@ -12,8 +12,7 @@ class MDExpectedException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'Parameter: ' . $this->getMessage() . ' is not a valid, numeric values.'; - return $errorMsg; + return 'Parameter: ' . $this->getMessage() . ' is not a valid, numeric values.'; } } diff --git a/exceptions/generic/MDFileDoesNotExist.php b/exceptions/generic/MDFileDoesNotExist.php index e7407ff..c116e17 100644 --- a/exceptions/generic/MDFileDoesNotExist.php +++ b/exceptions/generic/MDFileDoesNotExist.php @@ -17,8 +17,7 @@ final class MDFileDoesNotExist extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'This file does not exist: ' . $this->getMessage(); - return $errorMsg; + return 'This file does not exist: ' . $this->getMessage(); } } diff --git a/exceptions/generic/MDFileIsNotReadable.php b/exceptions/generic/MDFileIsNotReadable.php index 95f962c..a6ae8f8 100644 --- a/exceptions/generic/MDFileIsNotReadable.php +++ b/exceptions/generic/MDFileIsNotReadable.php @@ -17,8 +17,7 @@ final class MDFileIsNotReadable extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'This file does not exist: ' . $this->getMessage(); - return $errorMsg; + return 'This file does not exist: ' . $this->getMessage(); } } diff --git a/exceptions/generic/MDInaccessiblePropertyException.php b/exceptions/generic/MDInaccessiblePropertyException.php index 92e850c..f7d57d1 100644 --- a/exceptions/generic/MDInaccessiblePropertyException.php +++ b/exceptions/generic/MDInaccessiblePropertyException.php @@ -12,8 +12,7 @@ final class MDInaccessiblePropertyException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'Property is inaccessible'; - return $errorMsg; + return 'Property is inaccessible'; } } diff --git a/exceptions/generic/MDInputTooLongException.php b/exceptions/generic/MDInputTooLongException.php index 6c6288f..8d8c8cb 100644 --- a/exceptions/generic/MDInputTooLongException.php +++ b/exceptions/generic/MDInputTooLongException.php @@ -13,8 +13,7 @@ final class MDInputTooLongException extends MDgenericInvalidInputsException { */ public function errorMessage() { //error message - $errorMsg = 'Input string is too long'; - return $errorMsg; + return 'Input string is too long'; } } diff --git a/exceptions/generic/MDInvalidColorCode.php b/exceptions/generic/MDInvalidColorCode.php index f2fe9dd..dd5ddb3 100644 --- a/exceptions/generic/MDInvalidColorCode.php +++ b/exceptions/generic/MDInvalidColorCode.php @@ -12,8 +12,7 @@ final class MDInvalidColorCode extends MDgenericInvalidInputsException { */ public function errorMessage() { //error message - $errorMsg = 'Input color code is invalid'; - return $errorMsg; + return 'Input color code is invalid'; } } diff --git a/exceptions/generic/MDInvalidEmail.php b/exceptions/generic/MDInvalidEmail.php index 4976186..33c3984 100644 --- a/exceptions/generic/MDInvalidEmail.php +++ b/exceptions/generic/MDInvalidEmail.php @@ -13,8 +13,7 @@ final class MDInvalidEmail extends MDgenericInvalidInputsException { */ public function errorMessage() { //error message - $errorMsg = 'Input URL is invalid'; - return $errorMsg; + return 'Input URL is invalid'; } } diff --git a/exceptions/generic/MDInvalidEmptyInputException.php b/exceptions/generic/MDInvalidEmptyInputException.php index 0eacd0d..7fd9530 100644 --- a/exceptions/generic/MDInvalidEmptyInputException.php +++ b/exceptions/generic/MDInvalidEmptyInputException.php @@ -19,8 +19,7 @@ final class MDInvalidEmptyInputException extends MDgenericInvalidInputsException */ public function errorMessage() { //error message - $errorMsg = 'A value needs to be provided: ' . $this->getMessage(); - return $errorMsg; + return 'A value needs to be provided: ' . $this->getMessage(); } } diff --git a/exceptions/generic/MDInvalidUrl.php b/exceptions/generic/MDInvalidUrl.php index 5d00784..a056742 100644 --- a/exceptions/generic/MDInvalidUrl.php +++ b/exceptions/generic/MDInvalidUrl.php @@ -13,8 +13,7 @@ final class MDInvalidUrl extends MDgenericInvalidInputsException { */ public function errorMessage() { //error message - $errorMsg = 'Input URL is invalid'; - return $errorMsg; + return 'Input URL is invalid'; } } diff --git a/exceptions/generic/MDOutputBufferNotStarted.php b/exceptions/generic/MDOutputBufferNotStarted.php index fe06b83..b856a3a 100644 --- a/exceptions/generic/MDOutputBufferNotStarted.php +++ b/exceptions/generic/MDOutputBufferNotStarted.php @@ -17,8 +17,7 @@ final class MDOutputBufferNotStarted extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'Output buffer has not yet been started, is to be used: ' . $this->getMessage(); - return $errorMsg; + return 'Output buffer has not yet been started, is to be used: ' . $this->getMessage(); } } diff --git a/exceptions/generic/MDRequiredConfigNotSet.php b/exceptions/generic/MDRequiredConfigNotSet.php index fcec6a8..88a69a4 100644 --- a/exceptions/generic/MDRequiredConfigNotSet.php +++ b/exceptions/generic/MDRequiredConfigNotSet.php @@ -12,8 +12,7 @@ final class MDRequiredConfigNotSet extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'Could not connect to databse. Please try again later.'; - return $errorMsg; + return 'Could not connect to databse. Please try again later.'; } } diff --git a/exceptions/generic/MDWrongCsrfTokenException.php b/exceptions/generic/MDWrongCsrfTokenException.php index b8cfd45..195d4a0 100644 --- a/exceptions/generic/MDWrongCsrfTokenException.php +++ b/exceptions/generic/MDWrongCsrfTokenException.php @@ -13,8 +13,7 @@ final class MDWrongCsrfTokenException extends MDgenericInvalidInputsException { */ public function errorMessage() { //error message - $errorMsg = 'Input URL is invalid'; - return $errorMsg; + return 'Input URL is invalid'; } } diff --git a/exceptions/generic/MDgenericInvalidInputsException.php b/exceptions/generic/MDgenericInvalidInputsException.php index a6b673b..e332d72 100644 --- a/exceptions/generic/MDgenericInvalidInputsException.php +++ b/exceptions/generic/MDgenericInvalidInputsException.php @@ -13,8 +13,7 @@ class MDgenericInvalidInputsException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'Inputs are not valid.'; - return $errorMsg; + return 'Inputs are not valid.'; } } diff --git a/exceptions/generic/MDhttpFailedException.php b/exceptions/generic/MDhttpFailedException.php index 17a7524..e834e86 100644 --- a/exceptions/generic/MDhttpFailedException.php +++ b/exceptions/generic/MDhttpFailedException.php @@ -13,8 +13,7 @@ final class MDhttpFailedException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'Inputs are not valid.'; - return $errorMsg; + return 'Inputs are not valid.'; } } diff --git a/exceptions/generic/MDmainEntityNotExistentException.php b/exceptions/generic/MDmainEntityNotExistentException.php index 40a97f1..355a61a 100644 --- a/exceptions/generic/MDmainEntityNotExistentException.php +++ b/exceptions/generic/MDmainEntityNotExistentException.php @@ -13,8 +13,7 @@ final class MDmainEntityNotExistentException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'Could not connect to databse. Please try again later.'; - return $errorMsg; + return 'Could not connect to databse. Please try again later.'; } } diff --git a/exceptions/generic/MDpageParameterNotFromListException.php b/exceptions/generic/MDpageParameterNotFromListException.php index 1bc4ab2..f81723c 100644 --- a/exceptions/generic/MDpageParameterNotFromListException.php +++ b/exceptions/generic/MDpageParameterNotFromListException.php @@ -13,8 +13,7 @@ final class MDpageParameterNotFromListException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'Invalid parameter: ' . $this->getMessage() . '.'; - return $errorMsg; + return 'Invalid parameter: ' . $this->getMessage() . '.'; } } diff --git a/exceptions/page/MDPageNotInAggregatedException.php b/exceptions/page/MDPageNotInAggregatedException.php index cdd2ca8..0daf65d 100644 --- a/exceptions/page/MDPageNotInAggregatedException.php +++ b/exceptions/page/MDPageNotInAggregatedException.php @@ -13,8 +13,7 @@ final class MDPageNotInAggregatedException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'There is no entity to be shown here (id: ' . $this->getMessage() . ').'; - return $errorMsg; + return 'There is no entity to be shown here (id: ' . $this->getMessage() . ').'; } } diff --git a/exceptions/page/MDmainEntityNotPublicException.php b/exceptions/page/MDmainEntityNotPublicException.php index cb4a8e6..67f9146 100644 --- a/exceptions/page/MDmainEntityNotPublicException.php +++ b/exceptions/page/MDmainEntityNotPublicException.php @@ -13,8 +13,7 @@ final class MDmainEntityNotPublicException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'There is no entity to be shown here (id: ' . $this->getMessage() . ').'; - return $errorMsg; + return 'There is no entity to be shown here (id: ' . $this->getMessage() . ').'; } } diff --git a/exceptions/page/MDpageParameterMissingException.php b/exceptions/page/MDpageParameterMissingException.php index 51b2fa8..73f5cf6 100644 --- a/exceptions/page/MDpageParameterMissingException.php +++ b/exceptions/page/MDpageParameterMissingException.php @@ -12,8 +12,7 @@ final class MDpageParameterMissingException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'Parameter: ' . $this->getMessage() . ' is required but missing.'; - return $errorMsg; + return 'Parameter: ' . $this->getMessage() . ' is required but missing.'; } } diff --git a/exceptions/page/MDpageParameterNotNumericException.php b/exceptions/page/MDpageParameterNotNumericException.php index f11aa7d..e6dbb07 100644 --- a/exceptions/page/MDpageParameterNotNumericException.php +++ b/exceptions/page/MDpageParameterNotNumericException.php @@ -12,8 +12,7 @@ final class MDpageParameterNotNumericException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'Parameter: ' . $this->getMessage() . ' is not a valid, numeric values.'; - return $errorMsg; + return 'Parameter: ' . $this->getMessage() . ' is not a valid, numeric values.'; } } diff --git a/exceptions/updates/MDDuplicateLinkException.php b/exceptions/updates/MDDuplicateLinkException.php index 89891b5..48f377e 100644 --- a/exceptions/updates/MDDuplicateLinkException.php +++ b/exceptions/updates/MDDuplicateLinkException.php @@ -14,8 +14,7 @@ final class MDDuplicateLinkException extends Exception { public function errorMessage() { //error message - $errorMsg = 'Duplicate link exception: ' . $this->getMessage() . '.'; - return $errorMsg; + return 'Duplicate link exception: ' . $this->getMessage() . '.'; } } diff --git a/exceptions/updates/MDFileIsNotWritable.php b/exceptions/updates/MDFileIsNotWritable.php index 4b37b70..05f5da7 100644 --- a/exceptions/updates/MDFileIsNotWritable.php +++ b/exceptions/updates/MDFileIsNotWritable.php @@ -17,8 +17,7 @@ final class MDFileIsNotWritable extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'This file or directory cannot be written: ' . $this->getMessage(); - return $errorMsg; + return 'This file or directory cannot be written: ' . $this->getMessage(); } } diff --git a/exceptions/updates/MDFileUploadNotAcceptedException.php b/exceptions/updates/MDFileUploadNotAcceptedException.php index 5e30fa8..b0f0278 100644 --- a/exceptions/updates/MDFileUploadNotAcceptedException.php +++ b/exceptions/updates/MDFileUploadNotAcceptedException.php @@ -13,8 +13,7 @@ final class MDFileUploadNotAcceptedException extends Exception { */ public function errorMessage() { //error message - $errorMsg = $this->getMessage(); - return $errorMsg; + return $this->getMessage(); } } diff --git a/exceptions/updates/MDInvalidCurrency.php b/exceptions/updates/MDInvalidCurrency.php index 829174f..4258230 100644 --- a/exceptions/updates/MDInvalidCurrency.php +++ b/exceptions/updates/MDInvalidCurrency.php @@ -20,8 +20,7 @@ final class MDInvalidCurrency extends MDgenericInvalidInputsException { */ public function errorMessage() { //error message - $errorMsg = 'The following currency is not available: ' . $this->getMessage(); - return $errorMsg; + return 'The following currency is not available: ' . $this->getMessage(); } } diff --git a/exceptions/updates/MDInvalidInputDate.php b/exceptions/updates/MDInvalidInputDate.php index 2e07d18..18099e0 100644 --- a/exceptions/updates/MDInvalidInputDate.php +++ b/exceptions/updates/MDInvalidInputDate.php @@ -20,8 +20,7 @@ final class MDInvalidInputDate extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'The following currency is not available: ' . $this->getMessage(); - return $errorMsg; + return 'The following currency is not available: ' . $this->getMessage(); } } diff --git a/exceptions/updates/MDInvalidLengthUnit.php b/exceptions/updates/MDInvalidLengthUnit.php index fa25427..476bdda 100644 --- a/exceptions/updates/MDInvalidLengthUnit.php +++ b/exceptions/updates/MDInvalidLengthUnit.php @@ -20,8 +20,7 @@ final class MDInvalidLengthUnit extends MDgenericInvalidInputsException { */ public function errorMessage() { //error message - $errorMsg = 'The following length unit is not available: ' . $this->getMessage(); - return $errorMsg; + return 'The following length unit is not available: ' . $this->getMessage(); } } diff --git a/exceptions/updates/MDInvalidLicense.php b/exceptions/updates/MDInvalidLicense.php index 322bf97..a9cbb63 100644 --- a/exceptions/updates/MDInvalidLicense.php +++ b/exceptions/updates/MDInvalidLicense.php @@ -20,8 +20,7 @@ final class MDInvalidLicense extends MDgenericInvalidInputsException { */ public function errorMessage() { //error message - $errorMsg = 'The following license is not available: ' . $this->getMessage(); - return $errorMsg; + return 'The following license is not available: ' . $this->getMessage(); } } diff --git a/exceptions/updates/MDInvalidObjectPublicationBackground.php b/exceptions/updates/MDInvalidObjectPublicationBackground.php index c7d29ef..7defc79 100644 --- a/exceptions/updates/MDInvalidObjectPublicationBackground.php +++ b/exceptions/updates/MDInvalidObjectPublicationBackground.php @@ -20,8 +20,7 @@ final class MDInvalidObjectPublicationBackground extends MDgenericInvalidInputsE */ public function errorMessage() { //error message - $errorMsg = 'The following object publication type is not available: ' . $this->getMessage(); - return $errorMsg; + return 'The following object publication type is not available: ' . $this->getMessage(); } } diff --git a/exceptions/updates/MDInvalidWeightUnit.php b/exceptions/updates/MDInvalidWeightUnit.php index 7d45336..d07b033 100644 --- a/exceptions/updates/MDInvalidWeightUnit.php +++ b/exceptions/updates/MDInvalidWeightUnit.php @@ -20,8 +20,7 @@ final class MDInvalidWeightUnit extends MDgenericInvalidInputsException { */ public function errorMessage() { //error message - $errorMsg = 'The following weight unit is not available: ' . $this->getMessage(); - return $errorMsg; + return 'The following weight unit is not available: ' . $this->getMessage(); } } diff --git a/exceptions/updates/MDNoUpdateVarSetException.php b/exceptions/updates/MDNoUpdateVarSetException.php index 5519a86..e6882dd 100644 --- a/exceptions/updates/MDNoUpdateVarSetException.php +++ b/exceptions/updates/MDNoUpdateVarSetException.php @@ -13,8 +13,7 @@ final class MDNoUpdateVarSetException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'No update variable has been set.'; - return $errorMsg; + return 'No update variable has been set.'; } } diff --git a/exceptions/updates/MDTooManyFilesUploadException.php b/exceptions/updates/MDTooManyFilesUploadException.php index 392cd80..5f0059c 100644 --- a/exceptions/updates/MDTooManyFilesUploadException.php +++ b/exceptions/updates/MDTooManyFilesUploadException.php @@ -19,8 +19,7 @@ final class MDTooManyFilesUploadException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'This file\'s extension or mimetype is incorrect: ' . $this->getMessage(); - return $errorMsg; + return 'This file\'s extension or mimetype is incorrect: ' . $this->getMessage(); } } diff --git a/exceptions/updates/MDWrongFileType.php b/exceptions/updates/MDWrongFileType.php index 0fc7037..4616949 100644 --- a/exceptions/updates/MDWrongFileType.php +++ b/exceptions/updates/MDWrongFileType.php @@ -19,8 +19,7 @@ final class MDWrongFileType extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'This file\'s extension or mimetype is incorrect: ' . $this->getMessage(); - return $errorMsg; + return 'This file\'s extension or mimetype is incorrect: ' . $this->getMessage(); } } diff --git a/exceptions/updates/MDcouldNotSaveException.php b/exceptions/updates/MDcouldNotSaveException.php index 68c0e63..b5cbab7 100644 --- a/exceptions/updates/MDcouldNotSaveException.php +++ b/exceptions/updates/MDcouldNotSaveException.php @@ -2,8 +2,7 @@ declare(strict_types = 1); /** - * Exception thrown in case the main entity of a page (e.g. an object, an institution etc.) - * are not set public. + * Exception thrown in case an update failed. */ final class MDcouldNotSaveException extends Exception { /** @@ -13,8 +12,7 @@ final class MDcouldNotSaveException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'Could not save.'; - return $errorMsg; + return 'Could not save.'; } } diff --git a/exceptions/updates/MDcouldNotSetPublic.php b/exceptions/updates/MDcouldNotSetPublic.php index 37db318..d29111b 100644 --- a/exceptions/updates/MDcouldNotSetPublic.php +++ b/exceptions/updates/MDcouldNotSetPublic.php @@ -3,7 +3,7 @@ declare(strict_types = 1); /** * Exception thrown in case the main entity of a page (e.g. an object, an institution etc.) - * are not set public. + * could not be set public. */ final class MDcouldNotSetPublic extends Exception { /** @@ -13,8 +13,7 @@ final class MDcouldNotSetPublic extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'Could not set this to public.'; - return $errorMsg; + return 'Could not set this to public.'; } } diff --git a/exceptions/updates/MDwriteAccessDeniedException.php b/exceptions/updates/MDwriteAccessDeniedException.php index c9ebce9..1a8c479 100644 --- a/exceptions/updates/MDwriteAccessDeniedException.php +++ b/exceptions/updates/MDwriteAccessDeniedException.php @@ -13,8 +13,7 @@ final class MDwriteAccessDeniedException extends Exception { */ public function errorMessage() { //error message - $errorMsg = 'You have no permission to write this.'; - return $errorMsg; + return 'You have no permission to write this.'; } }