From 29bee2e1f5ac2e6b734605faec433891b0093b0e Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 28 Dec 2018 23:08:24 +0100 Subject: [PATCH] Improve docblocks --- Account/Account.php | 20 ++++++++----------- Account/AccountManager.php | 6 +++--- Account/Group.php | 8 ++++---- Account/PermissionAbstract.php | 8 ++++---- Account/PermissionOwner.php | 2 ++ Account/PermissionType.php | 12 +++++------ ApplicationAbstract.php | 2 +- Asset/AssetManager.php | 6 +++--- Auth/Auth.php | 2 +- Autoloader.php | 2 +- Business/Finance/Depreciation.php | 2 +- Business/Finance/FinanceFormulas.php | 4 ++-- Business/Finance/Lorenzkurve.php | 2 +- Business/Marketing/Metrics.php | 2 +- Business/Marketing/NetPromoterScore.php | 6 +++--- Contract/RenderableInterface.php | 2 +- .../Database/DatabaseExceptionFactory.php | 4 ++-- DataStorage/Database/RelationType.php | 4 ++-- DataStorage/Database/Schema/QueryType.php | 4 ++-- Event/EventManager.php | 10 ++++++++++ Localization/Localization.php | 8 ++++++++ Math/Statistic/Forecast/Forecasts.php | 2 +- Message/Http/Rest.php | 2 +- Message/ResponseType.php | 2 +- Module/InstallerAbstract.php | 4 ++-- Module/StatusAbstract.php | 6 ++++-- Module/UninstallerAbstract.php | 4 ++-- Module/UpdaterAbstract.php | 4 ++-- Router/Router.php | 15 ++++++++++++++ Security/PhpCode.php | 15 ++++++++------ Stdlib/Base/PhoneType.php | 2 +- Stdlib/Map/KeyType.php | 8 +++++--- Stdlib/Map/OrderType.php | 8 +++++--- Stdlib/Queue/PriorityMode.php | 12 ++++++----- System/File/ContentPutMode.php | 4 ++-- System/File/ExtensionType.php | 5 +++-- System/MimeType.php | 4 ++-- System/SystemType.php | 4 +--- UnhandledHandler.php | 2 +- Uri/Argument.php | 4 ++-- Uri/Http.php | 6 +++--- Utils/Barcode/C128Abstract.php | 6 +++--- Utils/Barcode/C128a.php | 8 +------- Utils/Barcode/C128c.php | 6 +----- Utils/Barcode/C25.php | 6 +----- Utils/Barcode/C39.php | 14 ++----------- Utils/Barcode/Codebar.php | 14 ++----------- Utils/Converter/AngleType.php | 2 +- Utils/Converter/EnergyPowerType.php | 2 +- Utils/Converter/PressureType.php | 2 +- Utils/Parser/Php/ArrayParser.php | 2 +- Utils/RnG/Name.php | 2 +- Validation/Base/Json.php | 8 ++++---- Validation/Network/Hostname.php | 2 +- Validation/Network/Ip.php | 10 +++++----- Validation/Validator.php | 2 +- Version/Version.php | 4 ++-- tests/System/File/ExtensionTypeTest.php | 3 ++- 58 files changed, 165 insertions(+), 157 deletions(-) diff --git a/Account/Account.php b/Account/Account.php index 1de49b3fa..8825d0b6c 100644 --- a/Account/Account.php +++ b/Account/Account.php @@ -347,7 +347,7 @@ class Account implements ArrayableInterface, \JsonSerializable /** * Get name. * - * @return string + * @return string Returns the login name or null * * @since 1.0.0 */ @@ -359,7 +359,7 @@ class Account implements ArrayableInterface, \JsonSerializable /** * Get name1. * - * @return string + * @return string Returns the name1 * * @since 1.0.0 */ @@ -385,7 +385,7 @@ class Account implements ArrayableInterface, \JsonSerializable /** * Get name2. * - * @return string + * @return string Returns name 2 * * @since 1.0.0 */ @@ -411,7 +411,7 @@ class Account implements ArrayableInterface, \JsonSerializable /** * Get name3. * - * @return string + * @return string Returns name 3 * * @since 1.0.0 */ @@ -437,7 +437,7 @@ class Account implements ArrayableInterface, \JsonSerializable /** * Get email. * - * @return string + * @return string Returns the email address * * @since 1.0.0 */ @@ -469,9 +469,7 @@ class Account implements ArrayableInterface, \JsonSerializable /** * Get status. * - * AccountStatus - * - * @return int + * @return int Returns the status (AccountStatus) * * @since 1.0.0 */ @@ -503,9 +501,7 @@ class Account implements ArrayableInterface, \JsonSerializable /** * Get type. * - * AccountType - * - * @return int + * @return int Returns the type (AccountType) * * @since 1.0.0 */ @@ -609,7 +605,7 @@ class Account implements ArrayableInterface, \JsonSerializable /** * Get string representation. * - * @return string + * @return string Returns the json_encode of this object * * @since 1.0.0 */ diff --git a/Account/AccountManager.php b/Account/AccountManager.php index 287a1a10b..21f976e6b 100644 --- a/Account/AccountManager.php +++ b/Account/AccountManager.php @@ -87,7 +87,7 @@ final class AccountManager implements \Countable * * @param Account $account Account * - * @return bool + * @return bool Returns true if the account could be added otherwise false is returned * * @since 1.0.0 */ @@ -107,7 +107,7 @@ final class AccountManager implements \Countable * * @param int $id Account id * - * @return bool + * @return bool Returns true if the account could be removed otherwise false * * @since 1.0.0 */ @@ -125,7 +125,7 @@ final class AccountManager implements \Countable /** * Get accounts count. * - * @return int + * @return int Returns the amount of accounts in the manager (>= 0) * * @since 1.0.0 */ diff --git a/Account/Group.php b/Account/Group.php index 0ee050ab1..402391c5c 100644 --- a/Account/Group.php +++ b/Account/Group.php @@ -87,7 +87,7 @@ class Group implements ArrayableInterface, \JsonSerializable /** * Get group id. * - * @return int + * @return int Returns the id of the group * * @since 1.0.0 */ @@ -99,7 +99,7 @@ class Group implements ArrayableInterface, \JsonSerializable /** * Get group name. * - * @return string + * @return string Returns the name of the group * * @since 1.0.0 */ @@ -125,7 +125,7 @@ class Group implements ArrayableInterface, \JsonSerializable /** * Get group description. * - * @return string + * @return string Returns the description of the group * * @since 1.0.0 */ @@ -183,7 +183,7 @@ class Group implements ArrayableInterface, \JsonSerializable /** * Get string representation. * - * @return string + * @return string Returns the json_encode of this object * * @since 1.0.0 */ diff --git a/Account/PermissionAbstract.php b/Account/PermissionAbstract.php index b36a61141..490e4e04c 100644 --- a/Account/PermissionAbstract.php +++ b/Account/PermissionAbstract.php @@ -102,7 +102,7 @@ class PermissionAbstract implements \JsonSerializable /** * Get permission id. * - * @return int + * @return int Retunrs the id of the permission * * @since 1.0.0 */ @@ -192,7 +192,7 @@ class PermissionAbstract implements \JsonSerializable /** * Get providing module id. * - * @return int + * @return int Returns the module responsible for setting this permission * * @since 1.0.0 */ @@ -296,7 +296,7 @@ class PermissionAbstract implements \JsonSerializable /** * Get permission * - * @return int + * @return int Returns the permission (PermissionType) * * @since 1.0.0 */ @@ -338,7 +338,7 @@ class PermissionAbstract implements \JsonSerializable * * @param int $permission Permission * - * @return bool + * @return bool Returns true if the permission is set otherwise returns false * * @since 1.0.0 */ diff --git a/Account/PermissionOwner.php b/Account/PermissionOwner.php index e63188dac..827aba509 100644 --- a/Account/PermissionOwner.php +++ b/Account/PermissionOwner.php @@ -19,6 +19,8 @@ use phpOMS\Stdlib\Base\Enum; /** * Permision type/owner enum. * + * A permission can be long to a group or an account. + * * @package phpOMS\Account * @license OMS License 1.0 * @link http://website.orange-management.de diff --git a/Account/PermissionType.php b/Account/PermissionType.php index a6c864a00..24f7e38ca 100644 --- a/Account/PermissionType.php +++ b/Account/PermissionType.php @@ -26,10 +26,10 @@ use phpOMS\Stdlib\Base\Enum; */ abstract class PermissionType extends Enum { - public const NONE = 1; - public const READ = 2; - public const CREATE = 4; - public const MODIFY = 8; - public const DELETE = 16; - public const PERMISSION = 32; + public const NONE = 1; // No permission + public const READ = 2; // Is able to read models/data + public const CREATE = 4; // Is able to create models/data + public const MODIFY = 8; // Is able to modify models/data + public const DELETE = 16; // Is able to delete models/data + public const PERMISSION = 32; // Is able to change permissions } diff --git a/ApplicationAbstract.php b/ApplicationAbstract.php index 9a134a294..41413c512 100644 --- a/ApplicationAbstract.php +++ b/ApplicationAbstract.php @@ -181,7 +181,7 @@ class ApplicationAbstract * * @param string $name Variable name * - * @return mixed + * @return mixed Returns the value of the application member * * @todo replace with proper getter (faster) * diff --git a/Asset/AssetManager.php b/Asset/AssetManager.php index a496a915f..2d123ed63 100644 --- a/Asset/AssetManager.php +++ b/Asset/AssetManager.php @@ -40,7 +40,7 @@ final class AssetManager implements \Countable * @param string $asset Asset * @param bool $overwrite Overwrite * - * @return bool + * @return bool Returns true if the asset could be set otherwise false * * @since 1.0.0 */ @@ -60,7 +60,7 @@ final class AssetManager implements \Countable * * @param string $id Asset id * - * @return bool + * @return bool Returns true if the asset could be removed otherwise false * * @since 1.0.0 */ @@ -96,7 +96,7 @@ final class AssetManager implements \Countable /** * Get asset count. * - * @return int + * @return int Returns the amount of assets (>= 0) * * @since 1.0.0 */ diff --git a/Auth/Auth.php b/Auth/Auth.php index b77d8b5cf..ff08915e7 100644 --- a/Auth/Auth.php +++ b/Auth/Auth.php @@ -43,7 +43,7 @@ final class Auth * * @param SessionInterface $session Session * - * @return int + * @return int Returns the user id * * @since 1.0.0 */ diff --git a/Autoloader.php b/Autoloader.php index d05b6c2d0..7a44cfe09 100644 --- a/Autoloader.php +++ b/Autoloader.php @@ -96,7 +96,7 @@ final class Autoloader * * @example Autoloader::exists('\phpOMS\Autoloader') // true * - * @return bool + * @return bool Returns true if the namespace/class exists, otherwise false * * @since 1.0.0 */ diff --git a/Business/Finance/Depreciation.php b/Business/Finance/Depreciation.php index 94fc1f6ab..23b35a42c 100644 --- a/Business/Finance/Depreciation.php +++ b/Business/Finance/Depreciation.php @@ -30,7 +30,7 @@ final class Depreciation * @param float $start Value to depreciate * @param int $duration Useful life time * - * @return float + * @return float Returns the straight line depreciation * * @since 1.0.0 */ diff --git a/Business/Finance/FinanceFormulas.php b/Business/Finance/FinanceFormulas.php index c325cf5b3..18f140c19 100644 --- a/Business/Finance/FinanceFormulas.php +++ b/Business/Finance/FinanceFormulas.php @@ -41,7 +41,7 @@ final class FinanceFormulas * @param float $r Stated annual interest rate * @param int $n number of times compounded * - * @return float + * @return float Returns the APY * * @since 1.0.0 */ @@ -280,7 +280,7 @@ final class FinanceFormulas * @param float $p Payment factor * @param float $r Rate per period * - * @return int + * @return int Returns the PV * * @since 1.0.0 */ diff --git a/Business/Finance/Lorenzkurve.php b/Business/Finance/Lorenzkurve.php index 35f0c52cb..63eb88a17 100644 --- a/Business/Finance/Lorenzkurve.php +++ b/Business/Finance/Lorenzkurve.php @@ -29,7 +29,7 @@ final class Lorenzkurve * * @param array $data Datapoints (can be unsorted) * - * @return float + * @return float Returns the gini coefficient * * @since 1.0.0 */ diff --git a/Business/Marketing/Metrics.php b/Business/Marketing/Metrics.php index 2480bffbc..0d4a26841 100644 --- a/Business/Marketing/Metrics.php +++ b/Business/Marketing/Metrics.php @@ -35,7 +35,7 @@ final class Metrics * @param int $cn New customers during period * @param int $cs Customers at the start of the period * - * @return float + * @return float Returns the customer retention * * @since 1.0.0 */ diff --git a/Business/Marketing/NetPromoterScore.php b/Business/Marketing/NetPromoterScore.php index 57e4daa5a..d8133d4a9 100644 --- a/Business/Marketing/NetPromoterScore.php +++ b/Business/Marketing/NetPromoterScore.php @@ -87,7 +87,7 @@ final class NetPromoterScore * * Detractors are all ratings below 7. * - * @return int + * @return int Returns the amount of detractors (>= 0) * * @since 1.0.0 */ @@ -108,7 +108,7 @@ final class NetPromoterScore * * Passives are all ratings between 7 and 8 (inclusive) * - * @return int + * @return int Returns the amount of passives (>= 0) * * @since 1.0.0 */ @@ -129,7 +129,7 @@ final class NetPromoterScore * * Promotoers are all ratings larger 8 * - * @return int + * @return int Returns the amount of promoters (>= 0) * * @since 1.0.0 */ diff --git a/Contract/RenderableInterface.php b/Contract/RenderableInterface.php index 692bfba82..0eefa5f6f 100644 --- a/Contract/RenderableInterface.php +++ b/Contract/RenderableInterface.php @@ -31,7 +31,7 @@ interface RenderableInterface /** * Get the evaluated contents of the object. * - * @return string + * @return string Returns rendered output * * @since 1.0.0 */ diff --git a/DataStorage/Database/DatabaseExceptionFactory.php b/DataStorage/Database/DatabaseExceptionFactory.php index b500edb6e..de4f25ab3 100644 --- a/DataStorage/Database/DatabaseExceptionFactory.php +++ b/DataStorage/Database/DatabaseExceptionFactory.php @@ -31,7 +31,7 @@ class DatabaseExceptionFactory * * @param \PDOException $e Exception * - * @return string + * @return string Returns exception namespace/class * * @since 1.0.0 */ @@ -50,7 +50,7 @@ class DatabaseExceptionFactory * * @param \PDOException $e Exception * - * @return string + * @return string Returns exception pessage * * @since 1.0.0 */ diff --git a/DataStorage/Database/RelationType.php b/DataStorage/Database/RelationType.php index f562e575d..c7ee86ad0 100644 --- a/DataStorage/Database/RelationType.php +++ b/DataStorage/Database/RelationType.php @@ -17,9 +17,9 @@ namespace phpOMS\DataStorage\Database; use phpOMS\Stdlib\Base\Enum; /** - * Database type enum. + * Relation type enum. * - * Database types that are supported by the application + * Relations which can be used in order to specifiy how the DataMapper is supposed to work (level of detail) * * @package phpOMS\DataStorage\Database * @license OMS License 1.0 diff --git a/DataStorage/Database/Schema/QueryType.php b/DataStorage/Database/Schema/QueryType.php index a24139d9a..45e308f21 100644 --- a/DataStorage/Database/Schema/QueryType.php +++ b/DataStorage/Database/Schema/QueryType.php @@ -17,9 +17,9 @@ namespace phpOMS\DataStorage\Database\Schema; use phpOMS\DataStorage\Database\Query\QueryType as DefaultQueryType; /** - * Database type enum. + * Query type enum. * - * Database types that are supported by the application + * Types used by the schema grammar in order to build the correct query. * * @package phpOMS\DataStorage\Database\Schema * @license OMS License 1.0 diff --git a/Event/EventManager.php b/Event/EventManager.php index 11deb500c..28d6071d2 100644 --- a/Event/EventManager.php +++ b/Event/EventManager.php @@ -76,6 +76,16 @@ final class EventManager implements \Countable /** * Add events from file. * + * Files need to return a php array of the following structure: + * return [ + * '{EVENT_ID}' => [ + * 'callback' => [ + * '{DESTINATION_NAMESPACE:method}', // can also be static by using :: between namespace and functio name + * // more callbacks here + * ], + * ], + * ]; + * * @param string $path Hook file path * * @return bool diff --git a/Localization/Localization.php b/Localization/Localization.php index bf61d6515..7200c0043 100644 --- a/Localization/Localization.php +++ b/Localization/Localization.php @@ -140,6 +140,14 @@ final class Localization /** * Load localization from language code * + * Files need to return a php array of the following structure: + * return [ + * '{MODULE_NAME}' => [ + * '{INTERNAL_STRING_REPRESENTATION}' => '{OUTPUT_STRING}', + * // more key/value pairs here + * ], + * ]; + * * @param string $langCode Language code * * @return void diff --git a/Math/Statistic/Forecast/Forecasts.php b/Math/Statistic/Forecast/Forecasts.php index a80d1effb..3c00ebc75 100644 --- a/Math/Statistic/Forecast/Forecasts.php +++ b/Math/Statistic/Forecast/Forecasts.php @@ -15,7 +15,7 @@ declare(strict_types=1); namespace phpOMS\Math\Statistic\Forecast; /** - * Address type enum. + * General forecasts helper class. * * @package phpOMS\Math\Statistic\Forecast * @license OMS License 1.0 diff --git a/Message/Http/Rest.php b/Message/Http/Rest.php index b05b71bbc..6b9b13090 100644 --- a/Message/Http/Rest.php +++ b/Message/Http/Rest.php @@ -30,7 +30,7 @@ final class Rest * * @param Request $request Request * - * @return string + * @return string Returns the request result * * @since 1.0.0 */ diff --git a/Message/ResponseType.php b/Message/ResponseType.php index aac23b017..af557414d 100644 --- a/Message/ResponseType.php +++ b/Message/ResponseType.php @@ -17,7 +17,7 @@ namespace phpOMS\Message; use phpOMS\Stdlib\Base\Enum; /** - * Request type enum. + * Response type enum. * * @package phpOMS\Message * @license OMS License 1.0 diff --git a/Module/InstallerAbstract.php b/Module/InstallerAbstract.php index 809c336f8..f5ac535b0 100644 --- a/Module/InstallerAbstract.php +++ b/Module/InstallerAbstract.php @@ -24,14 +24,14 @@ use phpOMS\System\File\PermissionException; use phpOMS\Utils\Parser\Php\ArrayParser; /** - * Installer Abstract class. + * Installer abstract class. * * @package phpOMS\Module * @license OMS License 1.0 * @link http://website.orange-management.de * @since 1.0.0 */ -class InstallerAbstract +abstract class InstallerAbstract { /** * Register module in database. diff --git a/Module/StatusAbstract.php b/Module/StatusAbstract.php index 8553711d5..713ab10b9 100644 --- a/Module/StatusAbstract.php +++ b/Module/StatusAbstract.php @@ -18,14 +18,16 @@ use phpOMS\DataStorage\Database\DatabasePool; use phpOMS\DataStorage\Database\Query\Builder; /** - * Installer Abstract class. + * Status abstract class. + * + * This abstraction can be used by modules in order to manipulate their basic status/state. * * @package phpOMS\Module * @license OMS License 1.0 * @link http://website.orange-management.de * @since 1.0.0 */ -class StatusAbstract +abstract class StatusAbstract { /** diff --git a/Module/UninstallerAbstract.php b/Module/UninstallerAbstract.php index d6b5548f6..f2f0d3941 100644 --- a/Module/UninstallerAbstract.php +++ b/Module/UninstallerAbstract.php @@ -18,14 +18,14 @@ use phpOMS\DataStorage\Database\DatabasePool; use phpOMS\DataStorage\Database\Schema\Builder as SchemaBuilder; /** - * Installer Abstract class. + * Uninstaller abstract class. * * @package phpOMS\Module * @license OMS License 1.0 * @link http://website.orange-management.de * @since 1.0.0 */ -class UninstallerAbstract +abstract class UninstallerAbstract { /** diff --git a/Module/UpdaterAbstract.php b/Module/UpdaterAbstract.php index 8dc264351..362ee684a 100644 --- a/Module/UpdaterAbstract.php +++ b/Module/UpdaterAbstract.php @@ -17,14 +17,14 @@ namespace phpOMS\Module; use phpOMS\DataStorage\Database\DatabasePool; /** - * Installer Abstract class. + * Updater abstract class. * * @package phpOMS\Module * @license OMS License 1.0 * @link http://website.orange-management.de * @since 1.0.0 */ -class UpdaterAbstract +abstract class UpdaterAbstract { /** diff --git a/Router/Router.php b/Router/Router.php index 1a2458b69..84bcf8edb 100644 --- a/Router/Router.php +++ b/Router/Router.php @@ -36,6 +36,21 @@ final class Router /** * Add routes from file. * + * Files need to return a php array of the following structure: + * return [ + * '{REGEX_PATH}' => [ + * 'dest' => '{DESTINATION_NAMESPACE:method}', // can also be static by using :: between namespace and functio name + * 'verb' => RouteVerb::{VERB}, + * 'permission' => [ // optional + * 'module' => '{MODULE_NAME}', + * 'type' => PermissionType::{TYPE}, + * 'state' => PermissionState::{STATE}, + * ], + * // define different destination for different verb + * ], + * // define another regex path, destination, permission here + * ]; + * * @param string $path Route file path * * @return bool diff --git a/Security/PhpCode.php b/Security/PhpCode.php index c02007ab4..46c7a090e 100644 --- a/Security/PhpCode.php +++ b/Security/PhpCode.php @@ -17,6 +17,9 @@ namespace phpOMS\Security; /** * Php code security class. * + * This can be used to ensure php code doesn't contain malicious functions and or characters. + * Additionally this can also be used in order verify that the source code is not altered compared to some expected source code. + * * @package phpOMS\Security * @license OMS License 1.0 * @link http://website.orange-management.de @@ -70,7 +73,7 @@ final class PhpCode * * @param string $source Source code * - * @return string + * @return string Normalized source code * * @since 1.0.0 */ @@ -84,7 +87,7 @@ final class PhpCode * * @param string $source Source code * - * @return bool + * @return bool Returns true if the code has unicode characters otherwise false is returned * * @since 1.0.0 */ @@ -98,7 +101,7 @@ final class PhpCode * * @param array $functions Functions to check * - * @return bool + * @return bool Returns true if code has disabled function calls otherwise false is returned * * @since 1.0.0 */ @@ -127,7 +130,7 @@ final class PhpCode * * @param string $source Source code * - * @return bool + * @return bool Returns true if code contains deprecated functions otherwise false is returned * * @since 1.0.0 */ @@ -148,7 +151,7 @@ final class PhpCode * @param string $source Source code path * @param string $hash Source hash * - * @return bool + * @return bool Returns true if filee matches expected signature otherwise false is returned * * @since 1.0.0 */ @@ -163,7 +166,7 @@ final class PhpCode * @param string $source Source code * @param string $remote Remote code * - * @return bool + * @return bool Returns true if source code is the same as the expected code otherwise false is returned * * @since 1.0.0 */ diff --git a/Stdlib/Base/PhoneType.php b/Stdlib/Base/PhoneType.php index 252d2c3b6..6b0be5fcb 100644 --- a/Stdlib/Base/PhoneType.php +++ b/Stdlib/Base/PhoneType.php @@ -15,7 +15,7 @@ declare(strict_types=1); namespace phpOMS\Stdlib\Base; /** - * Address type enum. + * Phone type enum. * * @package phpOMS\Stdlib\Base * @license OMS License 1.0 diff --git a/Stdlib/Map/KeyType.php b/Stdlib/Map/KeyType.php index 06410fc86..80a9b8a0e 100644 --- a/Stdlib/Map/KeyType.php +++ b/Stdlib/Map/KeyType.php @@ -17,7 +17,9 @@ namespace phpOMS\Stdlib\Map; use phpOMS\Stdlib\Base\Enum; /** - * Account type enum. + * Multi map key type enum. + * + * These keys specify how the multi map works. * * @package phpOMS\Stdlib\Map * @license OMS License 1.0 @@ -26,6 +28,6 @@ use phpOMS\Stdlib\Base\Enum; */ abstract class KeyType extends Enum { - public const SINGLE = 0; - public const MULTIPLE = 1; + public const SINGLE = 0; // There can only be one key(-combination) per value + public const MULTIPLE = 1; // There can be multiple keys per value } diff --git a/Stdlib/Map/OrderType.php b/Stdlib/Map/OrderType.php index 564ffa86c..0363ed1e9 100644 --- a/Stdlib/Map/OrderType.php +++ b/Stdlib/Map/OrderType.php @@ -17,7 +17,9 @@ namespace phpOMS\Stdlib\Map; use phpOMS\Stdlib\Base\Enum; /** - * Account type enum. + * Muli map order type enum. + * + * Specifies if keys in the map can be ordered in any way or need to match the exact order. * * @package phpOMS\Stdlib\Map * @license OMS License 1.0 @@ -26,6 +28,6 @@ use phpOMS\Stdlib\Base\Enum; */ abstract class OrderType extends Enum { - public const LOOSE = 0; - public const STRICT = 1; + public const LOOSE = 0; // Doesn't matter in which order the keys are ordered + public const STRICT = 1; // The exact key order matters for setting/getting values } diff --git a/Stdlib/Queue/PriorityMode.php b/Stdlib/Queue/PriorityMode.php index 28dd2180d..f48a553d8 100644 --- a/Stdlib/Queue/PriorityMode.php +++ b/Stdlib/Queue/PriorityMode.php @@ -17,7 +17,9 @@ namespace phpOMS\Stdlib\Queue; use phpOMS\Stdlib\Base\Enum; /** - * Account type enum. + * Priority type enum. + * + * Defines the different priorities in which elements from the queue can be extracted. * * @package phpOMS\Stdlib\Queue * @license OMS License 1.0 @@ -26,8 +28,8 @@ use phpOMS\Stdlib\Base\Enum; */ abstract class PriorityMode extends Enum { - public const FIFO = 1; - public const LIFO = 2; - public const HIGHEST = 4; - public const LOWEST = 8; + public const FIFO = 1; // First in first out + public const LIFO = 2; // Last in first out + public const HIGHEST = 4; // Highest priority first (same as FIFO if all inserted elements got inserted at the same time with the same priority) + public const LOWEST = 8; // Lowest priority first (same as LIFO if all inserted lements got inserted at the same time with the same priority) } diff --git a/System/File/ContentPutMode.php b/System/File/ContentPutMode.php index e79b81921..a6b67b383 100644 --- a/System/File/ContentPutMode.php +++ b/System/File/ContentPutMode.php @@ -17,9 +17,9 @@ namespace phpOMS\System\File; use phpOMS\Stdlib\Base\Enum; /** - * Database type enum. + * Content put type enum. * - * Database types that are supported by the application + * Defines how the content manipulation should be handled. * * @package phpOMS\System\File * @license OMS License 1.0 diff --git a/System/File/ExtensionType.php b/System/File/ExtensionType.php index 832fabf31..509c6a638 100644 --- a/System/File/ExtensionType.php +++ b/System/File/ExtensionType.php @@ -17,9 +17,9 @@ namespace phpOMS\System\File; use phpOMS\Stdlib\Base\Enum; /** - * Database type enum. + * Extension type enum. * - * Database types that are supported by the application + * Defines what kind of category a file belongs to. * * @package phpOMS\System\File * @license OMS License 1.0 @@ -38,4 +38,5 @@ abstract class ExtensionType extends Enum public const ARCHIVE = 128; public const PRESENTATION = 256; public const IMAGE = 512; + public const EXECUTABLE = 1024; } diff --git a/System/MimeType.php b/System/MimeType.php index bb34009b8..197c6b9d0 100644 --- a/System/MimeType.php +++ b/System/MimeType.php @@ -17,9 +17,9 @@ namespace phpOMS\System; use phpOMS\Stdlib\Base\Enum; /** - * Database type enum. + * Mime type enum. * - * Database types that are supported by the application + * Common mime types which can be helpful for responses where a specific mime needs to be set. * * @package phpOMS\System * @license OMS License 1.0 diff --git a/System/SystemType.php b/System/SystemType.php index b3c39f232..eb652f24b 100644 --- a/System/SystemType.php +++ b/System/SystemType.php @@ -17,9 +17,7 @@ namespace phpOMS\System; use phpOMS\Stdlib\Base\Enum; /** - * Database type enum. - * - * Database types that are supported by the application + * Operating system type enum. * * @package phpOMS\System * @license OMS License 1.0 diff --git a/UnhandledHandler.php b/UnhandledHandler.php index 91dfb1682..9351ce97c 100644 --- a/UnhandledHandler.php +++ b/UnhandledHandler.php @@ -53,7 +53,7 @@ final class UnhandledHandler * @param string $errfile Error file * @param int $errline Error line * - * @return bool + * @return bool Returns true if the error could be logged otherwise false is returned * * @since 1.0.0 */ diff --git a/Uri/Argument.php b/Uri/Argument.php index 4a0915162..eb2bbbcd8 100644 --- a/Uri/Argument.php +++ b/Uri/Argument.php @@ -17,9 +17,9 @@ namespace phpOMS\Uri; use phpOMS\Utils\StringUtils; /** - * Uri interface. + * Console argument class. * - * Used in order to create and evaluate a uri + * Considers arguments used in ca CLI as uri * * @package phpOMS\Uri * @license OMS License 1.0 diff --git a/Uri/Http.php b/Uri/Http.php index b9803d16f..fa20e28ba 100644 --- a/Uri/Http.php +++ b/Uri/Http.php @@ -17,9 +17,9 @@ namespace phpOMS\Uri; use phpOMS\Utils\StringUtils; /** - * Uri interface. + * HTTP Uri. * - * Used in order to create and evaluate a uri + * Uri used for http requests (incoming & outgoing) * * @package phpOMS\Uri * @license OMS License 1.0 @@ -180,7 +180,7 @@ final class Http implements UriInterface /** * Get current uri. * - * @return string + * @return string Returns the current uri * * @since 1.0.0 */ diff --git a/Utils/Barcode/C128Abstract.php b/Utils/Barcode/C128Abstract.php index 9db537a9a..6a3ba69fc 100644 --- a/Utils/Barcode/C128Abstract.php +++ b/Utils/Barcode/C128Abstract.php @@ -193,7 +193,7 @@ abstract class C128Abstract /** * Get content * - * @return string + * @return string Returns the string representation of the code * * @since 1.0.0 */ @@ -269,7 +269,7 @@ abstract class C128Abstract * * @param string $barcode Barcode string * - * @return bool + * @return bool Returns true if the string is valid for the specific code implementetion otherwise false is returned * * @since 1.0.0 */ @@ -289,7 +289,7 @@ abstract class C128Abstract /** * Generate weighted code string * - * @return string + * @return string Returns the code string generated from the human readable content * * @since 1.0.0 */ diff --git a/Utils/Barcode/C128a.php b/Utils/Barcode/C128a.php index 075338d44..0a32477d5 100644 --- a/Utils/Barcode/C128a.php +++ b/Utils/Barcode/C128a.php @@ -81,13 +81,7 @@ class C128a extends C128Abstract protected static $CODE_END = '2331112'; /** - * Set content to encrypt - * - * @param string $content Content to encrypt - * - * @return void - * - * @since 1.0.0 + * {@inheritdoc} */ public function setContent(string $content) : void { diff --git a/Utils/Barcode/C128c.php b/Utils/Barcode/C128c.php index db9ffaf17..a654ed3d5 100644 --- a/Utils/Barcode/C128c.php +++ b/Utils/Barcode/C128c.php @@ -80,11 +80,7 @@ class C128c extends C128Abstract protected static $CODE_END = '2331112'; /** - * Generate weighted code string - * - * @return string - * - * @since 1.0.0 + * {@inheritdoc} */ protected function generateCodeString() : string { diff --git a/Utils/Barcode/C25.php b/Utils/Barcode/C25.php index 420ab6061..9f2d3deaa 100644 --- a/Utils/Barcode/C25.php +++ b/Utils/Barcode/C25.php @@ -98,11 +98,7 @@ class C25 extends C128Abstract } /** - * Generate weighted code string - * - * @return string - * - * @since 1.0.0 + * {@inheritdoc} */ protected function generateCodeString() : string { diff --git a/Utils/Barcode/C39.php b/Utils/Barcode/C39.php index 72de3260d..040af6645 100644 --- a/Utils/Barcode/C39.php +++ b/Utils/Barcode/C39.php @@ -62,13 +62,7 @@ class C39 extends C128Abstract protected static $CODE_END = '121121211'; /** - * Set content to encrypt - * - * @param string $content Barcode content - * - * @return void - * - * @since 1.0.0 + * {@inheritdoc} */ public function setContent(string $content) : void { @@ -76,11 +70,7 @@ class C39 extends C128Abstract } /** - * Generate weighted code string - * - * @return string - * - * @since 1.0.0 + * {@inheritdoc} */ protected function generateCodeString() : string { diff --git a/Utils/Barcode/Codebar.php b/Utils/Barcode/Codebar.php index 5c509f46c..3d8891454 100644 --- a/Utils/Barcode/Codebar.php +++ b/Utils/Barcode/Codebar.php @@ -63,13 +63,7 @@ class Codebar extends C128Abstract protected static $CODE_END = '1122121'; /** - * Set content to encrypt - * - * @param string $content Barcode content - * - * @return void - * - * @since 1.0.0 + * {@inheritdoc} */ public function setContent(string $content) : void { @@ -77,11 +71,7 @@ class Codebar extends C128Abstract } /** - * Generate weighted code string - * - * @return string - * - * @since 1.0.0 + * {@inheritdoc} */ protected function generateCodeString() : string { diff --git a/Utils/Converter/AngleType.php b/Utils/Converter/AngleType.php index e21c692d3..4b5374921 100644 --- a/Utils/Converter/AngleType.php +++ b/Utils/Converter/AngleType.php @@ -17,7 +17,7 @@ namespace phpOMS\Utils\Converter; use phpOMS\Stdlib\Base\Enum; /** - * Speed type enum. + * Angle type enum. * * @package phpOMS\Utils\Converter * @license OMS License 1.0 diff --git a/Utils/Converter/EnergyPowerType.php b/Utils/Converter/EnergyPowerType.php index 870ddda93..37178c313 100644 --- a/Utils/Converter/EnergyPowerType.php +++ b/Utils/Converter/EnergyPowerType.php @@ -17,7 +17,7 @@ namespace phpOMS\Utils\Converter; use phpOMS\Stdlib\Base\Enum; /** - * Speed type enum. + * Energy/Power type enum. * * @package phpOMS\Utils\Converter * @license OMS License 1.0 diff --git a/Utils/Converter/PressureType.php b/Utils/Converter/PressureType.php index df01162ff..3dff1aab8 100644 --- a/Utils/Converter/PressureType.php +++ b/Utils/Converter/PressureType.php @@ -17,7 +17,7 @@ namespace phpOMS\Utils\Converter; use phpOMS\Stdlib\Base\Enum; /** - * Speed type enum. + * Pressure type enum. * * @package phpOMS\Utils\Converter * @license OMS License 1.0 diff --git a/Utils/Parser/Php/ArrayParser.php b/Utils/Parser/Php/ArrayParser.php index 8ed25e16b..51c753879 100644 --- a/Utils/Parser/Php/ArrayParser.php +++ b/Utils/Parser/Php/ArrayParser.php @@ -57,7 +57,7 @@ class ArrayParser * @param mixed $value Value to serialzie * @param int $depth Array depth * - * @return string + * @return string Returns the parsed value as string representation * * @throws \UnexpectedValueException Throws this exception if the value cannot be parsed (invalid data type) * diff --git a/Utils/RnG/Name.php b/Utils/RnG/Name.php index 4f6d421ef..e84e43167 100644 --- a/Utils/RnG/Name.php +++ b/Utils/RnG/Name.php @@ -487,7 +487,7 @@ class Name * @param string[] $type Name type (female, male, family) * @param string $origin Name origin (western) * - * @return string + * @return string Returns a random name * * @since 1.0.0 */ diff --git a/Validation/Base/Json.php b/Validation/Base/Json.php index e105d0d93..9038f9c7a 100644 --- a/Validation/Base/Json.php +++ b/Validation/Base/Json.php @@ -17,7 +17,7 @@ namespace phpOMS\Validation\Base; use phpOMS\Validation\ValidatorAbstract; /** - * Validate date. + * Validate json. * * @package phpOMS\Validation\Base * @license OMS License 1.0 @@ -42,7 +42,7 @@ abstract class Json extends ValidatorAbstract * @param array $source Source structure * @param bool $perfect No additional elements in source allowed * - * @return bool + * @return bool Returns true if the template validates the source otherwise false * * @since 1.0.0 */ @@ -141,7 +141,7 @@ abstract class Json extends ValidatorAbstract * @param array $template Template structure * @param array $source Source structure * - * @return bool + * @return bool Returns true if the source implements all required elements otherwise false is returned * * @since 1.0.0 */ @@ -180,7 +180,7 @@ abstract class Json extends ValidatorAbstract * @param array $template Template structure * @param array $source Source structure * - * @return bool + * @return bool Returns true if the source is correct in relation to the template otherwise false is returned * * @since 1.0.0 */ diff --git a/Validation/Network/Hostname.php b/Validation/Network/Hostname.php index c1835c7ff..3ad9a09fb 100644 --- a/Validation/Network/Hostname.php +++ b/Validation/Network/Hostname.php @@ -42,6 +42,6 @@ abstract class Hostname extends ValidatorAbstract */ public static function isValid($value, array $constraints = null) : bool { - return filter_var(\gethostbyname($value), FILTER_VALIDATE_IP) !== false; + return \filter_var(\gethostbyname($value), FILTER_VALIDATE_IP) !== false; } } diff --git a/Validation/Network/Ip.php b/Validation/Network/Ip.php index 1c9e1103a..251d5ca10 100644 --- a/Validation/Network/Ip.php +++ b/Validation/Network/Ip.php @@ -42,7 +42,7 @@ abstract class Ip extends ValidatorAbstract */ public static function isValid($value, array $constraints = null) : bool { - return filter_var($value, FILTER_VALIDATE_IP) !== false; + return \filter_var($value, FILTER_VALIDATE_IP) !== false; } /** @@ -50,13 +50,13 @@ abstract class Ip extends ValidatorAbstract * * @param mixed $value to validate * - * @return bool + * @return bool Returns true if value is valid ip6 otherwise false * * @since 1.0.0 */ public static function isValidIpv6($value) : bool { - return filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false; + return \filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false; } /** @@ -64,12 +64,12 @@ abstract class Ip extends ValidatorAbstract * * @param mixed $value to validate * - * @return bool + * @return bool eturns true if value is valid ip4 otherwise false * * @since 1.0.0 */ public static function isValidIpv4($value) : bool { - return filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false; + return \filter_var($value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false; } } diff --git a/Validation/Validator.php b/Validation/Validator.php index 9677a79d5..9524bf49b 100644 --- a/Validation/Validator.php +++ b/Validation/Validator.php @@ -122,7 +122,7 @@ final class Validator extends ValidatorAbstract */ public static function contains(string $var, $substr) : bool { - return is_string($substr) ? \strpos($var, $substr) !== false : StringUtils::contains($var, $substr); + return \is_string($substr) ? \strpos($var, $substr) !== false : StringUtils::contains($var, $substr); } /** diff --git a/Version/Version.php b/Version/Version.php index 5c828d13f..c179b5f6d 100644 --- a/Version/Version.php +++ b/Version/Version.php @@ -43,12 +43,12 @@ final class Version * @param string $ver1 Version * @param string $ver2 Version * - * @return int + * @return int Returns the version comparison (0 = equals; -1 = lower; 1 = higher) * * @since 1.0.0 */ public static function compare(string $ver1, string $ver2) : int { - return version_compare($ver1, $ver2); + return \version_compare($ver1, $ver2); } } diff --git a/tests/System/File/ExtensionTypeTest.php b/tests/System/File/ExtensionTypeTest.php index d3fe7eca8..c095ee3d6 100644 --- a/tests/System/File/ExtensionTypeTest.php +++ b/tests/System/File/ExtensionTypeTest.php @@ -19,7 +19,7 @@ class ExtensionTypeTest extends \PHPUnit\Framework\TestCase { public function testEnums() : void { - self::assertEquals(10, \count(ExtensionType::getConstants())); + self::assertEquals(11, \count(ExtensionType::getConstants())); self::assertEquals(ExtensionType::getConstants(), array_unique(ExtensionType::getConstants())); self::assertEquals(1, ExtensionType::UNKNOWN); @@ -32,5 +32,6 @@ class ExtensionTypeTest extends \PHPUnit\Framework\TestCase self::assertEquals(128, ExtensionType::ARCHIVE); self::assertEquals(256, ExtensionType::PRESENTATION); self::assertEquals(512, ExtensionType::IMAGE); + self::assertEquals(1024, ExtensionType::EXECUTABLE); } }