Improve docblocks

This commit is contained in:
Dennis Eichhorn 2018-12-28 23:08:24 +01:00
parent 7af3cb042f
commit 29bee2e1f5
58 changed files with 165 additions and 157 deletions

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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

View File

@ -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
}

View File

@ -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)
*

View File

@ -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
*/

View File

@ -43,7 +43,7 @@ final class Auth
*
* @param SessionInterface $session Session
*
* @return int
* @return int Returns the user id
*
* @since 1.0.0
*/

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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
*/

View File

@ -29,7 +29,7 @@ final class Lorenzkurve
*
* @param array<float|int> $data Datapoints (can be unsorted)
*
* @return float
* @return float Returns the gini coefficient
*
* @since 1.0.0
*/

View File

@ -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
*/

View File

@ -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
*/

View File

@ -31,7 +31,7 @@ interface RenderableInterface
/**
* Get the evaluated contents of the object.
*
* @return string
* @return string Returns rendered output
*
* @since 1.0.0
*/

View File

@ -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
*/

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -30,7 +30,7 @@ final class Rest
*
* @param Request $request Request
*
* @return string
* @return string Returns the request result
*
* @since 1.0.0
*/

View File

@ -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

View File

@ -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.

View File

@ -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
{
/**

View File

@ -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
{
/**

View File

@ -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
{
/**

View File

@ -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

View File

@ -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<string> $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
*/

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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)
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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
*/

View File

@ -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

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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
{

View File

@ -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
{

View File

@ -98,11 +98,7 @@ class C25 extends C128Abstract
}
/**
* Generate weighted code string
*
* @return string
*
* @since 1.0.0
* {@inheritdoc}
*/
protected function generateCodeString() : string
{

View File

@ -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
{

View File

@ -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
{

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)
*

View File

@ -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
*/

View File

@ -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
*/

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);
}
/**

View File

@ -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);
}
}

View File

@ -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);
}
}