mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
Update PHPDoc and comments
This commit is contained in:
@@ -159,6 +159,7 @@ trait BaseTestCaseTrait
|
|||||||
* @param int $requiredArgumentsCount (optional) Expected count/amount of required arguments
|
* @param int $requiredArgumentsCount (optional) Expected count/amount of required arguments
|
||||||
* of the verified method
|
* of the verified method
|
||||||
* @throws UnknownOopVisibilityTypeException
|
* @throws UnknownOopVisibilityTypeException
|
||||||
|
* @throws ReflectionException
|
||||||
*
|
*
|
||||||
* Attention. 2nd argument, the $method, may be:
|
* Attention. 2nd argument, the $method, may be:
|
||||||
* - string - name of the method
|
* - string - name of the method
|
||||||
@@ -215,6 +216,7 @@ trait BaseTestCaseTrait
|
|||||||
* @param int $argumentsCount (optional) Expected count/amount of arguments of the verified method
|
* @param int $argumentsCount (optional) Expected count/amount of arguments of the verified method
|
||||||
* @param int $requiredArgumentsCount (optional) Expected count/amount of required arguments of the verified
|
* @param int $requiredArgumentsCount (optional) Expected count/amount of required arguments of the verified
|
||||||
* method
|
* method
|
||||||
|
* @throws ReflectionException
|
||||||
* @throws UnknownOopVisibilityTypeException
|
* @throws UnknownOopVisibilityTypeException
|
||||||
*/
|
*/
|
||||||
protected static function assertConstructorVisibilityAndArguments(
|
protected static function assertConstructorVisibilityAndArguments(
|
||||||
@@ -236,6 +238,7 @@ trait BaseTestCaseTrait
|
|||||||
* Asserts that class with given namespace has no constructor
|
* Asserts that class with given namespace has no constructor
|
||||||
*
|
*
|
||||||
* @param string $classNamespace Namespace of class that contains constructor to verify
|
* @param string $classNamespace Namespace of class that contains constructor to verify
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
protected static function assertHasNoConstructor($classNamespace)
|
protected static function assertHasNoConstructor($classNamespace)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -530,6 +530,10 @@ class Arrays
|
|||||||
*/
|
*/
|
||||||
public static function removeElement(array $array, $item)
|
public static function removeElement(array $array, $item)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* No elements or the element does not exist?
|
||||||
|
* Nothing to do
|
||||||
|
*/
|
||||||
if (empty($array) || !in_array($item, $array)) {
|
if (empty($array) || !in_array($item, $array)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -626,6 +630,10 @@ class Arrays
|
|||||||
*/
|
*/
|
||||||
public static function setKeysAsValues(array $array, $ignoreDuplicatedValues = true)
|
public static function setKeysAsValues(array $array, $ignoreDuplicatedValues = true)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* No elements?
|
||||||
|
* Nothing to do
|
||||||
|
*/
|
||||||
if (empty($array)) {
|
if (empty($array)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -1083,6 +1091,10 @@ class Arrays
|
|||||||
*/
|
*/
|
||||||
public static function getAllValuesOfKey(array $array, $key)
|
public static function getAllValuesOfKey(array $array, $key)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* No elements?
|
||||||
|
* Nothing to do
|
||||||
|
*/
|
||||||
if (empty($array)) {
|
if (empty($array)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class Bundle
|
|||||||
*
|
*
|
||||||
* @param string $viewPath Path of the view / template, e.g. "MyDirectory/my-template"
|
* @param string $viewPath Path of the view / template, e.g. "MyDirectory/my-template"
|
||||||
* @param string $bundleName Full name of the bundle, e.g. "MyExtraBundle"
|
* @param string $bundleName Full name of the bundle, e.g. "MyExtraBundle"
|
||||||
* @param string $extension (optional) Extension of the view / template
|
* @param string $extension (optional) Extension of the view / template (default: "html.twig")
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*
|
*
|
||||||
* @throws IncorrectBundleNameException
|
* @throws IncorrectBundleNameException
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
namespace Meritoo\Common\Utilities;
|
namespace Meritoo\Common\Utilities;
|
||||||
|
|
||||||
use Gedmo\Sluggable\Util\Urlizer;
|
use Gedmo\Sluggable\Util\Urlizer;
|
||||||
|
use Meritoo\Common\Exception\Regex\IncorrectColorHexLengthException;
|
||||||
|
use Meritoo\Common\Exception\Regex\InvalidColorHexValueException;
|
||||||
use Symfony\Component\HttpFoundation\Cookie;
|
use Symfony\Component\HttpFoundation\Cookie;
|
||||||
use Transliterator;
|
use Transliterator;
|
||||||
|
|
||||||
@@ -1433,6 +1435,9 @@ class Miscellaneous
|
|||||||
*
|
*
|
||||||
* @param string $color Hexadecimal value of color to invert (with or without hash), e.g. "dd244c" or "#22a5fe"
|
* @param string $color Hexadecimal value of color to invert (with or without hash), e.g. "dd244c" or "#22a5fe"
|
||||||
* @return string
|
* @return string
|
||||||
|
*
|
||||||
|
* @throws IncorrectColorHexLengthException
|
||||||
|
* @throws InvalidColorHexValueException
|
||||||
*/
|
*/
|
||||||
public static function getInvertedColor($color)
|
public static function getInvertedColor($color)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ class Reflection
|
|||||||
* @param bool $withoutInheritance (optional) If is set to true, only methods for given class are returned.
|
* @param bool $withoutInheritance (optional) If is set to true, only methods for given class are returned.
|
||||||
* Otherwise - all methods, with inherited methods too.
|
* Otherwise - all methods, with inherited methods too.
|
||||||
* @return array
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function getMethods($class, $withoutInheritance = false)
|
public static function getMethods($class, $withoutInheritance = false)
|
||||||
{
|
{
|
||||||
@@ -65,6 +67,8 @@ class Reflection
|
|||||||
*
|
*
|
||||||
* @param object|string $class The object or name of object's class
|
* @param object|string $class The object or name of object's class
|
||||||
* @return array
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function getConstants($class)
|
public static function getConstants($class)
|
||||||
{
|
{
|
||||||
@@ -79,6 +83,8 @@ class Reflection
|
|||||||
*
|
*
|
||||||
* @param object|string $class The object or name of object's class
|
* @param object|string $class The object or name of object's class
|
||||||
* @return int|null
|
* @return int|null
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function getMaxNumberConstant($class)
|
public static function getMaxNumberConstant($class)
|
||||||
{
|
{
|
||||||
@@ -105,6 +111,8 @@ class Reflection
|
|||||||
* @param object|string $class The object or name of object's class
|
* @param object|string $class The object or name of object's class
|
||||||
* @param string $method Name of the method to find
|
* @param string $method Name of the method to find
|
||||||
* @return bool
|
* @return bool
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function hasMethod($class, $method)
|
public static function hasMethod($class, $method)
|
||||||
{
|
{
|
||||||
@@ -119,6 +127,8 @@ class Reflection
|
|||||||
* @param object|string $class The object or name of object's class
|
* @param object|string $class The object or name of object's class
|
||||||
* @param string $property Name of the property to find
|
* @param string $property Name of the property to find
|
||||||
* @return bool
|
* @return bool
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function hasProperty($class, $property)
|
public static function hasProperty($class, $property)
|
||||||
{
|
{
|
||||||
@@ -133,6 +143,8 @@ class Reflection
|
|||||||
* @param object|string $class The object or name of object's class
|
* @param object|string $class The object or name of object's class
|
||||||
* @param string $constant Name of the constant to find
|
* @param string $constant Name of the constant to find
|
||||||
* @return bool
|
* @return bool
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function hasConstant($class, $constant)
|
public static function hasConstant($class, $constant)
|
||||||
{
|
{
|
||||||
@@ -147,6 +159,8 @@ class Reflection
|
|||||||
* @param object|string $class The object or name of object's class
|
* @param object|string $class The object or name of object's class
|
||||||
* @param string $constant Name of the constant that contains a value
|
* @param string $constant Name of the constant that contains a value
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function getConstantValue($class, $constant)
|
public static function getConstantValue($class, $constant)
|
||||||
{
|
{
|
||||||
@@ -169,6 +183,8 @@ class Reflection
|
|||||||
* @param bool $force (optional) If is set to true, try to retrieve value even if the object doesn't have
|
* @param bool $force (optional) If is set to true, try to retrieve value even if the object doesn't have
|
||||||
* property. Otherwise - not.
|
* property. Otherwise - not.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function getPropertyValue($object, $property, $force = false)
|
public static function getPropertyValue($object, $property, $force = false)
|
||||||
{
|
{
|
||||||
@@ -285,6 +301,8 @@ class Reflection
|
|||||||
* @param bool $force (optional) If is set to true, try to retrieve value even if the
|
* @param bool $force (optional) If is set to true, try to retrieve value even if the
|
||||||
* object does not have property. Otherwise - not.
|
* object does not have property. Otherwise - not.
|
||||||
* @return array
|
* @return array
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function getPropertyValues($objects, $property, $force = false)
|
public static function getPropertyValues($objects, $property, $force = false)
|
||||||
{
|
{
|
||||||
@@ -444,6 +462,8 @@ class Reflection
|
|||||||
* @param bool $includeParents (optional) If is set to true, properties of parent classes are
|
* @param bool $includeParents (optional) If is set to true, properties of parent classes are
|
||||||
* included (recursively). Otherwise - not.
|
* included (recursively). Otherwise - not.
|
||||||
* @return array|ReflectionProperty
|
* @return array|ReflectionProperty
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function getProperties($source, $filter = null, $includeParents = false)
|
public static function getProperties($source, $filter = null, $includeParents = false)
|
||||||
{
|
{
|
||||||
@@ -477,6 +497,8 @@ class Reflection
|
|||||||
*
|
*
|
||||||
* @param array|object|string $source An array of objects, namespaces, object or namespace
|
* @param array|object|string $source An array of objects, namespaces, object or namespace
|
||||||
* @return ReflectionClass|bool
|
* @return ReflectionClass|bool
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function getParentClass($source)
|
public static function getParentClass($source)
|
||||||
{
|
{
|
||||||
@@ -549,6 +571,7 @@ class Reflection
|
|||||||
* namespaces, object or namespace.
|
* namespaces, object or namespace.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*
|
*
|
||||||
|
* @throws CannotResolveClassNameException
|
||||||
* @throws MissingChildClassesException
|
* @throws MissingChildClassesException
|
||||||
* @throws TooManyChildClassesException
|
* @throws TooManyChildClassesException
|
||||||
*/
|
*/
|
||||||
@@ -583,6 +606,8 @@ class Reflection
|
|||||||
* @param int $filter (optional) Filter of properties. Uses ReflectionProperty class constants.
|
* @param int $filter (optional) Filter of properties. Uses ReflectionProperty class constants.
|
||||||
* By default all properties are allowed / processed.
|
* By default all properties are allowed / processed.
|
||||||
* @return null|ReflectionProperty
|
* @return null|ReflectionProperty
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function getProperty($class, $property, $filter = null)
|
public static function getProperty($class, $property, $filter = null)
|
||||||
{
|
{
|
||||||
@@ -609,7 +634,9 @@ class Reflection
|
|||||||
* @param bool $verifyParents If is set to true, parent classes are verified if they use given
|
* @param bool $verifyParents If is set to true, parent classes are verified if they use given
|
||||||
* trait. Otherwise - not.
|
* trait. Otherwise - not.
|
||||||
* @return bool|null
|
* @return bool|null
|
||||||
|
*
|
||||||
* @throws CannotResolveClassNameException
|
* @throws CannotResolveClassNameException
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function usesTrait($class, $trait, $verifyParents = false)
|
public static function usesTrait($class, $trait, $verifyParents = false)
|
||||||
{
|
{
|
||||||
@@ -652,6 +679,8 @@ class Reflection
|
|||||||
*
|
*
|
||||||
* @param array|object|string $class An array of objects, namespaces, object or namespace
|
* @param array|object|string $class An array of objects, namespaces, object or namespace
|
||||||
* @return string|null
|
* @return string|null
|
||||||
|
*
|
||||||
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function getParentClassName($class)
|
public static function getParentClassName($class)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -730,6 +730,10 @@ class Regex
|
|||||||
*/
|
*/
|
||||||
public static function isValidMoneyValue($value)
|
public static function isValidMoneyValue($value)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Not a scalar value?
|
||||||
|
* Nothing to do
|
||||||
|
*/
|
||||||
if (!is_scalar($value)) {
|
if (!is_scalar($value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use Generator;
|
|||||||
use Meritoo\Common\Exception\Regex\IncorrectColorHexLengthException;
|
use Meritoo\Common\Exception\Regex\IncorrectColorHexLengthException;
|
||||||
use Meritoo\Common\Exception\Regex\InvalidColorHexValueException;
|
use Meritoo\Common\Exception\Regex\InvalidColorHexValueException;
|
||||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||||
|
use ReflectionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test case of the useful regular expressions methods
|
* Test case of the useful regular expressions methods
|
||||||
@@ -24,6 +25,9 @@ class RegexTest extends BaseTestCase
|
|||||||
private $simpleText;
|
private $simpleText;
|
||||||
private $camelCaseText;
|
private $camelCaseText;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws ReflectionException
|
||||||
|
*/
|
||||||
public function testConstructor()
|
public function testConstructor()
|
||||||
{
|
{
|
||||||
static::assertHasNoConstructor(Regex::class);
|
static::assertHasNoConstructor(Regex::class);
|
||||||
|
|||||||
Reference in New Issue
Block a user