new pisilinux web sites
This commit is contained in:
@@ -0,0 +1,268 @@
|
||||
<?php namespace ZN\DataTypes;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\Datatype;
|
||||
use ZN\Controller\Factory;
|
||||
use ZN\Ability\Functionalization;
|
||||
|
||||
class Arrays extends Factory
|
||||
{
|
||||
use Functionalization;
|
||||
|
||||
const factory =
|
||||
[
|
||||
'methods' =>
|
||||
[
|
||||
'casing' => 'Arrays\Casing::use',
|
||||
'lowercase' => 'Arrays\Casing::lower',
|
||||
'uppercase' => 'Arrays\Casing::upper',
|
||||
'titlecase' => 'Arrays\Casing::title',
|
||||
'lowerkeys' => 'Arrays\Casing::lowerKeys',
|
||||
'upperkeys' => 'Arrays\Casing::upperKeys',
|
||||
'titlekeys' => 'Arrays\Casing::titleKeys',
|
||||
'lowervalues' => 'Arrays\Casing::lowerValues',
|
||||
'uppervalues' => 'Arrays\Casing::upperValues',
|
||||
'titlevalues' => 'Arrays\Casing::titleValues',
|
||||
'getfirst' => 'Arrays\GetElement::first',
|
||||
'getlast' => 'Arrays\GetElement::last',
|
||||
'pick' => 'Arrays\GetElement::pick',
|
||||
'addfirst' => 'Arrays\AddElement::first',
|
||||
'addlast' => 'Arrays\AddElement::last',
|
||||
'removekey' => 'Arrays\RemoveElement::key',
|
||||
'removevalue' => 'Arrays\RemoveElement::value',
|
||||
'remove' => 'Arrays\RemoveElement::use',
|
||||
'removelast' => 'Arrays\RemoveElement::last',
|
||||
'removefirst' => 'Arrays\RemoveElement::first',
|
||||
'deleteelement' => 'Arrays\RemoveElement::element',
|
||||
'delete' => 'Arrays\RemoveElement::element',
|
||||
'order' => 'Arrays\Sort::order',
|
||||
'sort' => 'Arrays\Sort::normal',
|
||||
'descending' => 'Arrays\Sort::descending',
|
||||
'ascending' => 'Arrays\Sort::ascending',
|
||||
'ascendingkey' => 'Arrays\Sort::ascendingKey',
|
||||
'descendingkey' => 'Arrays\Sort::descendingKey',
|
||||
'naturalinsensitive' => 'Arrays\Sort::insensitive',
|
||||
'natural' => 'Arrays\Sort::natural',
|
||||
'shuffle' => 'Arrays\Sort::shuffle',
|
||||
'reverse' => 'Arrays\Sort::reverse',
|
||||
'including' => 'Arrays\Including::use',
|
||||
'include' => 'Arrays\Including::use',
|
||||
'excluding' => 'Arrays\Excluding::use',
|
||||
'exclude' => 'Arrays\Excluding::use',
|
||||
'each' => 'Arrays\Each::use',
|
||||
'force' => 'Arrays\Force::do',
|
||||
'forcevalues' => 'Arrays\Force::values',
|
||||
'forcekeys' => 'Arrays\Force::keys',
|
||||
'forcerecursive' => 'Arrays\Force::recursive',
|
||||
'keyval' => 'Arrays\Element::use',
|
||||
'element' => 'Arrays\Element::use',
|
||||
'unidimensional' => 'Arrays\Unidimensional::do',
|
||||
'flatten' => 'Arrays\Unidimensional::do',
|
||||
'searchbetween' => 'Arrays\Search::between',
|
||||
'searchbetweenboth' => 'Arrays\Search::betweenBoth',
|
||||
'searchkeybetween' => 'Arrays\Search::betweenWithKey',
|
||||
'searchkeybetweenboth' => 'Arrays\Search::betweenBothWithKey',
|
||||
'searchkeytovaluebetween' => 'Arrays\Search::betweenWithKeyToValue',
|
||||
'searchvaluetokeybetween' => 'Arrays\Search::betweenWithValueToKey',
|
||||
'searchkeytovaluebetweenboth' => 'Arrays\Search::betweenBothWithKeyToValue',
|
||||
'searchvaluetokeybetweenboth' => 'Arrays\Search::betweenBothWithValueToKey'
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* Functionalization
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
const functionalization =
|
||||
[
|
||||
'merge' => 'array_merge',
|
||||
'recursivemerge' => 'array_merge_recursive',
|
||||
'flip' => 'array_flip',
|
||||
'transform' => 'array_flip',
|
||||
'unique' => 'array_unique',
|
||||
'deleterecurrent' => 'array_unique',
|
||||
'range' => 'range',
|
||||
'series' => 'range',
|
||||
'slice' => 'array_slice',
|
||||
'section' => 'array_slice',
|
||||
'splice' => 'array_splice',
|
||||
'resection' => 'array_splice',
|
||||
'rand' => 'array_rand',
|
||||
'random' => 'array_rand',
|
||||
'map' => 'array_map',
|
||||
'implementcallback' => 'array_map',
|
||||
'count' => 'count',
|
||||
'length' => 'count',
|
||||
'column' => 'array_column',
|
||||
'product' => 'array_product',
|
||||
'sum' => 'array_sum',
|
||||
'intersect' => 'array_intersect',
|
||||
'intersectkey' => 'array_intersect_key',
|
||||
'chunk' => 'array_chunk',
|
||||
'apportion' => 'array_chunk',
|
||||
'key' => 'key',
|
||||
'current' => 'current',
|
||||
'value' => 'current',
|
||||
'values' => 'array_values',
|
||||
'keys' => 'array_keys'
|
||||
];
|
||||
|
||||
/**
|
||||
* Combine
|
||||
*
|
||||
* @param array $keys
|
||||
* @param array $values = []
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function combine(array $keys, array $values = []) : array
|
||||
{
|
||||
if( empty($values) )
|
||||
{
|
||||
$values = $keys;
|
||||
}
|
||||
|
||||
return array_combine($keys, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiple Key
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $keySplit = '|'
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function multikey(array $array, string $keySplit = '|') : array
|
||||
{
|
||||
return Datatype::multikey($array, $keySplit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Value Exists
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $element
|
||||
* @param bool $strict = false
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function valueExists(array $array, $element, bool $strict = false) : bool
|
||||
{
|
||||
return in_array($element, $array, $strict);
|
||||
}
|
||||
|
||||
/**
|
||||
* Value Exists Insensitive
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $element
|
||||
* @param bool $strict = false
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function valueExistsInsensitive(array $array, $element, bool $strict = false) : bool
|
||||
{
|
||||
return self::valueExists(array_map('strtolower', $array), strtolower($element ?? ''), $strict);
|
||||
}
|
||||
|
||||
/**
|
||||
* Key Exists
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function keyExists(array $array, $key) : bool
|
||||
{
|
||||
return isset($array[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Key Exists Insensitive
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function keyEsistsInsensitive(array $array, $key) : bool
|
||||
{
|
||||
return self::keyExists(array_change_key_case($array), strtolower($key ?? ''));
|
||||
}
|
||||
|
||||
/**
|
||||
* Search
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $element
|
||||
* @param bool $strict = false
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function search(array $array, $element, bool $strict = false)
|
||||
{
|
||||
return array_search($element, $array, $strict);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count Same Values
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $key = NULL
|
||||
*
|
||||
* @return int|false
|
||||
*/
|
||||
public static function countSameValues(array $array, ?string $key = NULL)
|
||||
{
|
||||
$return = array_count_values($array);
|
||||
|
||||
if( ! empty($key) )
|
||||
{
|
||||
return $return[$key] ?? false;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fil Keys Range
|
||||
*
|
||||
* @param array
|
||||
* @param scalar $char = ''
|
||||
* @param mixed $min = NULL
|
||||
* @param mixed $max = NULL
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function fillKeysRange(array $array, $char = '', $min = NULL, $max = NULL) : array
|
||||
{
|
||||
$rearray = [];
|
||||
|
||||
if( ! $array )
|
||||
{
|
||||
return $rearray;
|
||||
}
|
||||
|
||||
$keys = range($min ?? min(array_keys($array)), $max ?? max(array_keys($array)));
|
||||
|
||||
foreach( $keys as $key )
|
||||
{
|
||||
$value = isset($array[$key]) ? $array[$key] : $char;
|
||||
|
||||
$rearray[$key] = $value;
|
||||
}
|
||||
|
||||
return $rearray;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php namespace ZN\DataTypes\Arrays;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
class AddElement
|
||||
{
|
||||
/**
|
||||
* Add First
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $element
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function first(array $array, $element, $type = 'array_unshift') : array
|
||||
{
|
||||
if( ! is_array($element) )
|
||||
{
|
||||
$type($array, $element);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( $type === 'array_unshift' )
|
||||
{
|
||||
$array = array_merge($element, $array);
|
||||
}
|
||||
else
|
||||
{
|
||||
$array = array_merge($array, $element);
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Last
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $element
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function last(array $array, $element) : array
|
||||
{
|
||||
return self::first($array, $element, 'array_push');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php namespace ZN\DataTypes\Arrays;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\Datatype;
|
||||
|
||||
class Casing
|
||||
{
|
||||
/**
|
||||
* Case Array
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $type - options[lower|upper|title]
|
||||
* @param string $keyval - options[all|key|value]
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function use(array $array, string $type = 'lower', string $keyval = 'all') : array
|
||||
{
|
||||
return Datatype::caseArray($array, $type, $keyval);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower Keys
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function lowerKeys(array $array) : array
|
||||
{
|
||||
return array_change_key_case($array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Title Keys
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function titleKeys(array $array) : array
|
||||
{
|
||||
return self::use($array, 'title', 'key');
|
||||
}
|
||||
|
||||
/**
|
||||
* Upper Keys
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function upperKeys(array $array) : array
|
||||
{
|
||||
return array_change_key_case($array, CASE_UPPER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower Values
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function lowerValues(array $array) : array
|
||||
{
|
||||
return self::use($array, 'lower', 'value');
|
||||
}
|
||||
|
||||
/**
|
||||
* Title Values
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function titleValues(array $array) : array
|
||||
{
|
||||
return self::use($array, 'title', 'value');
|
||||
}
|
||||
|
||||
/**
|
||||
* Upper Values
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function upperValues(array $array) : array
|
||||
{
|
||||
return self::use($array, 'upper', 'value');
|
||||
}
|
||||
|
||||
/**
|
||||
* All Lower Case
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function lower(array $array) : array
|
||||
{
|
||||
return self::use($array, 'lower', 'all');
|
||||
}
|
||||
|
||||
/**
|
||||
* All Title Case
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function title(array $array) : array
|
||||
{
|
||||
return self::use($array, 'title', 'all');
|
||||
}
|
||||
|
||||
/**
|
||||
* All Upper Case
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function upper(array $array) : array
|
||||
{
|
||||
return self::use($array, 'upper', 'all');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php namespace ZN\DataTypes\Arrays;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
class Each
|
||||
{
|
||||
/**
|
||||
* Each
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callable
|
||||
*/
|
||||
public static function use(array $array, callable $callable)
|
||||
{
|
||||
foreach( $array as $k => $v )
|
||||
{
|
||||
$callable($v, $k);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php namespace ZN\DataTypes\Arrays;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\DataTypes\Exception\InvalidArgumentException;
|
||||
|
||||
class Element
|
||||
{
|
||||
/**
|
||||
* Array Elements
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $keyval = 'value' - options[value|key|values|keys]
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function use(array $array, string $keyval = 'value')
|
||||
{
|
||||
switch( $keyval )
|
||||
{
|
||||
case 'value' : return current($array);
|
||||
case 'key' : return key($array);
|
||||
case 'values' : return array_values($array);
|
||||
case 'keys' : return array_keys($array);
|
||||
default : throw new InvalidArgumentException
|
||||
(
|
||||
'[Arrays::keyval()], 2.($keyval) parameter is invalid! [Available Options:] value, key, values, keys'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php namespace ZN\DataTypes\Arrays;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\DataTypes\Exception\LogicException;
|
||||
|
||||
class Excluding
|
||||
{
|
||||
/**
|
||||
* Exclude Element
|
||||
*
|
||||
* @param array $array
|
||||
* @param array $excluding
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function use(array $array, array $excluding) : array
|
||||
{
|
||||
$newArray = [];
|
||||
|
||||
if( count($excluding) > count($array) )
|
||||
{
|
||||
return $newArray;
|
||||
}
|
||||
|
||||
foreach( $array as $key => $val )
|
||||
{
|
||||
if( ! in_array($val, $excluding) && ! in_array($key, $excluding) )
|
||||
{
|
||||
$newArray[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
return $newArray;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php namespace ZN\DataTypes\Arrays;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
class Force
|
||||
{
|
||||
/**
|
||||
* Force Values
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callable
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function values(array $array, callable $callable) : array
|
||||
{
|
||||
return array_map($callable, $array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Force Keys
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callable
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function keys(array $array, callable $callable) : array
|
||||
{
|
||||
$keys = array_map($callable, array_keys($array));
|
||||
|
||||
return array_combine($keys, array_values($array));
|
||||
}
|
||||
|
||||
/**
|
||||
* Force All
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callable
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function do(array $array, callable $callable) : array
|
||||
{
|
||||
$values = array_values(array_map($callable, $array));
|
||||
$keys = array_values(array_map($callable, array_keys($array)));
|
||||
|
||||
return array_combine($keys, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Force Recursive
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function recursive(array $array, callable $callback) : array
|
||||
{
|
||||
return filter_var($array, FILTER_CALLBACK, ['options' => $callback]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php namespace ZN\DataTypes\Arrays;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
class GetElement
|
||||
{
|
||||
/**
|
||||
* Get Last Element
|
||||
*
|
||||
* @param array $array
|
||||
* @param int $count = 1
|
||||
* @param bool $preserveKey = false
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function last(array $array, int $count = 1, bool $preserveKey = false)
|
||||
{
|
||||
if( $count <= 1 )
|
||||
{
|
||||
$array = end($array) ?? NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return array_slice($array, -$count, NULL, $preserveKey);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get First Element
|
||||
*
|
||||
* @param array $array
|
||||
* @param int $count = 1
|
||||
* @param bool $preserveKey = false
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function first(array $array, int $count = 1, bool $preserveKey = false)
|
||||
{
|
||||
if( $count <= 1 )
|
||||
{
|
||||
$array = current($array) ?? NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
return array_slice($array, 0, $count, $preserveKey);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get values by key
|
||||
*
|
||||
* 5.7.6[added]
|
||||
*
|
||||
* @param array $arrays
|
||||
* @param string $pick
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function pick(array $arrays, string $pick) : array
|
||||
{
|
||||
$values = [];
|
||||
|
||||
foreach( $arrays as $array )
|
||||
{
|
||||
if( is_array($array) && isset($array[$pick]) )
|
||||
{
|
||||
$values[] = $array[$pick];
|
||||
}
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php namespace ZN\DataTypes\Arrays;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\DataTypes\Exception\LogicException;
|
||||
|
||||
class Including
|
||||
{
|
||||
/**
|
||||
* Include Element
|
||||
*
|
||||
* @param array $array
|
||||
* @param array $including
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function use(array $array, array $including) : array
|
||||
{
|
||||
$newArray = [];
|
||||
|
||||
if( count($including) > count($array) )
|
||||
{
|
||||
return $newArray;
|
||||
}
|
||||
|
||||
foreach( $array as $key => $val )
|
||||
{
|
||||
if( in_array($val, $including) || in_array($key, $including) )
|
||||
{
|
||||
$newArray[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
return $newArray;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
<?php namespace ZN\DataTypes\Arrays;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
class RemoveElement
|
||||
{
|
||||
/**
|
||||
* Remove Key
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $keys
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function key(array $array, $keys) : array
|
||||
{
|
||||
if( ! is_array($keys) )
|
||||
{
|
||||
unset($array[$keys]);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach( $keys as $key )
|
||||
{
|
||||
unset($array[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Value
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function value(array $array, $values) : array
|
||||
{
|
||||
return self::element($array, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $keys
|
||||
* @param mixed $values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function use(array $array, $keys = [], $values = []) : array
|
||||
{
|
||||
if( ! empty($keys) )
|
||||
{
|
||||
$array = self::key($array, $keys);
|
||||
}
|
||||
|
||||
if( ! empty($values) )
|
||||
{
|
||||
$array = self::value($array, $values);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Last Element
|
||||
*
|
||||
* @param array $array
|
||||
* @param int $count = 1
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function last(array $array, int $count = 1, $type = 'array_pop') : array
|
||||
{
|
||||
if( $count <= 1 )
|
||||
{
|
||||
$type($array);
|
||||
}
|
||||
else
|
||||
{
|
||||
$arrayCount = count($array);
|
||||
|
||||
for( $i = 1; $i <= $count; $i++ )
|
||||
{
|
||||
$type($array);
|
||||
|
||||
if( $i === $arrayCount )
|
||||
{
|
||||
break; // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove First Element
|
||||
*
|
||||
* @param array $array
|
||||
* @param int $count = 1
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function first(array $array, int $count = 1) : array
|
||||
{
|
||||
return self::last($array, $count, 'array_shift');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Element
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $object
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function element(array $array, $object) : array
|
||||
{
|
||||
if( ! is_array($object) )
|
||||
{
|
||||
$object = [$object];
|
||||
}
|
||||
|
||||
return array_diff($array, $object);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
<?php namespace ZN\DataTypes\Arrays;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
class Search
|
||||
{
|
||||
/**
|
||||
* Finds the expression between two expressions, including parameters. By value to key.
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $start
|
||||
* @param mixed $end
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function betweenBothWithValueToKey(array $array, $start, $end)
|
||||
{
|
||||
$startPosition = array_search($start, $array);
|
||||
|
||||
if( isset($array[$end]) && $startPosition !== false )
|
||||
{
|
||||
return self::betweenBothForeachFunction($array, $startPosition, $end);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the expression between two expressions, including parameters. By key to value.
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $start
|
||||
* @param mixed $end
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function betweenBothWithKeyToValue(array $array, $start, $end)
|
||||
{
|
||||
$endPosition = array_search($end, $array);
|
||||
|
||||
if( isset($array[$start]) && $endPosition !== false )
|
||||
{
|
||||
return self::betweenBothForeachFunction($array, $start, $endPosition);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the expression between two statements.
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $start
|
||||
* @param mixed $end
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function betweenWithValueToKey(array $array, $start, $end)
|
||||
{
|
||||
$startPosition = array_search($start, $array);
|
||||
|
||||
if( isset($array[$end]) && $startPosition !== false )
|
||||
{
|
||||
return self::betweenForeachFunction($array, $startPosition, $end);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the expression between two statements.
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $start
|
||||
* @param mixed $end
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function betweenWithKeyToValue(array $array, $start, $end)
|
||||
{
|
||||
$endPosition = array_search($end, $array);
|
||||
|
||||
if( isset($array[$start]) && $endPosition !== false )
|
||||
{
|
||||
return self::betweenForeachFunction($array, $start, $endPosition);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the expression between two statements.
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $start
|
||||
* @param mixed $end
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function betweenWithKey(array $array, $start, $end)
|
||||
{
|
||||
if( isset($array[$start]) )
|
||||
{
|
||||
return self::betweenForeachFunction($array, $start, $end);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the expression between two expressions, including parameters.
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $start
|
||||
* @param mixed $end
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function betweenBothWithKey(array $array, $start, $end)
|
||||
{
|
||||
if( isset($array[$start]) )
|
||||
{
|
||||
return self::betweenBothForeachFunction($array, $start, $end);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the expression between two statements.
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $start
|
||||
* @param mixed $end
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function between(array $array, $start, $end)
|
||||
{
|
||||
if( self::betweenFunction($array, $start, $end, $startPosition, $endPosition) )
|
||||
{
|
||||
return self::betweenForeachFunction($array, $startPosition, $endPosition);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the expression between two expressions, including parameters.
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $start
|
||||
* @param mixed $end
|
||||
*
|
||||
* @return array|bool
|
||||
*/
|
||||
public static function betweenBoth(array $array, $start, $end)
|
||||
{
|
||||
if( self::betweenFunction($array, $start, $end, $startPosition, $endPosition) )
|
||||
{
|
||||
return self::betweenBothForeachFunction($array, $startPosition, $endPosition);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protected between foreach function.
|
||||
*/
|
||||
protected static function betweenForeachFunction($array, $startPosition, $endPosition)
|
||||
{
|
||||
$foundElements = []; $searchStatus = false;
|
||||
|
||||
foreach( $array as $key => $val )
|
||||
{
|
||||
if( $key === $endPosition )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if( $searchStatus === true )
|
||||
{
|
||||
$foundElements[$key] = $val;
|
||||
}
|
||||
|
||||
if( $key === $startPosition )
|
||||
{
|
||||
$searchStatus = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $foundElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protected between both foreach function.
|
||||
*/
|
||||
protected static function betweenBothForeachFunction($array, $startPosition, $endPosition)
|
||||
{
|
||||
$foundElements = []; $searchStatus = false;
|
||||
|
||||
foreach( $array as $key => $val )
|
||||
{
|
||||
if( $key === $startPosition )
|
||||
{
|
||||
$searchStatus = true;
|
||||
}
|
||||
|
||||
if( $searchStatus === true )
|
||||
{
|
||||
$foundElements[$key] = $val;
|
||||
}
|
||||
|
||||
if( $key === $endPosition )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $foundElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Protected between function.
|
||||
*/
|
||||
protected static function betweenFunction($array, $start, $end, &$startPosition, &$endPosition)
|
||||
{
|
||||
$startPosition = array_search($start, $array);
|
||||
$endPosition = array_search($end , $array);
|
||||
|
||||
return $startPosition !== false && $endPosition !== false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php namespace ZN\DataTypes\Arrays;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\Helper;
|
||||
|
||||
class Sort
|
||||
{
|
||||
/**
|
||||
* Array Order
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $type = NULL - options[desc|asc|asckey|desckey|insens|natural|reverse|userassoc|userkey|user|random]
|
||||
* @param string $flags = 'regular' - options[regular|numeric|string|localeString]
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function order(array $array, $type = NULL, $flags = 'regular') : array
|
||||
{
|
||||
$flags = Helper::toConstant($flags, 'SORT_');
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case 'desc' : arsort($array, $flags); break;
|
||||
case 'asc' : asort($array, $flags); break;
|
||||
case 'asckey' : ksort($array, $flags); break;
|
||||
case 'desckey' : krsort($array, $flags); break;
|
||||
case 'insens' : natcasesort($array); break;
|
||||
case 'natural' : natsort($array); break;
|
||||
case 'reverse' : rsort($array, $flags); break;
|
||||
case 'random' : shuffle($array); break;
|
||||
default : sort($array, $flags);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Normal Order
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $flags = 'regular' - options[regular|numeric|string|localeString]
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function normal(array $array, string $flag = 'regular') : array
|
||||
{
|
||||
return self::order($array, 'sort', $flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Descending Order
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $flags = 'regular' - options[regular|numeric|string|localeString]
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function descending(array $array, string $flag = 'regular') : array
|
||||
{
|
||||
return self::order($array, 'desc', $flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ascending Order
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $flags = 'regular' - options[regular|numeric|string|localeString]
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function ascending(array $array, string $flag = 'regular') : array
|
||||
{
|
||||
return self::order($array, 'asc', $flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ascending Key Order
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $flags = 'regular' - options[regular|numeric|string|localeString]
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function ascendingKey(array $array, string $flag = 'regular') : array
|
||||
{
|
||||
return self::order($array, 'asckey', $flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Descending Key Order
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $flags = 'regular' - options[regular|numeric|string|localeString]
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function descendingKey(array $array, string $flag = 'regular') : array
|
||||
{
|
||||
return self::order($array, 'desckey', $flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $flags = 'regular' - options[regular|numeric|string|localeString]
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function reverse(array $array, string $flag = 'regular') : array
|
||||
{
|
||||
return self::order($array, 'reverse', $flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insensitive Order
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $flags = 'regular' - options[regular|numeric|string|localeString]
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function insensitive(array $array) : array
|
||||
{
|
||||
return self::order($array, 'insens');
|
||||
}
|
||||
|
||||
/**
|
||||
* Natural Order
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function natural(array $array) : array
|
||||
{
|
||||
return self::order($array, 'natural');
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuffle Order
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function shuffle(array $array) : array
|
||||
{
|
||||
return self::order($array, 'random');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php namespace ZN\DataTypes\Arrays;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use RecursiveIteratorIterator, RecursiveArrayIterator;
|
||||
|
||||
class Unidimensional
|
||||
{
|
||||
/**
|
||||
* Unidimensional
|
||||
*
|
||||
* @param array $array
|
||||
* @param bool $preserveKey = false
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function do(array $array, bool $preserveKey = true) : array
|
||||
{
|
||||
return iterator_to_array
|
||||
(
|
||||
new RecursiveIteratorIterator
|
||||
(
|
||||
new RecursiveArrayIterator($array)
|
||||
),
|
||||
|
||||
$preserveKey
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php namespace ZN\DataTypes;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\Ability\Serialization;
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
|
||||
class Collection
|
||||
{
|
||||
use Serialization;
|
||||
|
||||
const serialization =
|
||||
[
|
||||
'class' => 'Arrays',
|
||||
'start' => 'data',
|
||||
'end' => 'get'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php namespace ZN\DataTypes\Exception;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\Ability\Exclusion;
|
||||
|
||||
class InvalidArgumentException extends \InvalidArgumentException
|
||||
{
|
||||
use Exclusion;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php namespace ZN\DataTypes\Exception;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\Ability\Exclusion;
|
||||
|
||||
class LogicException extends \LogicException
|
||||
{
|
||||
use Exclusion;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php namespace ZN\DataTypes;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use stdClass;
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
|
||||
class Objects
|
||||
{
|
||||
/**
|
||||
* Magic Constructor
|
||||
*
|
||||
* @param array $array
|
||||
*/
|
||||
public function __construct(array $array)
|
||||
{
|
||||
self::objectRecursive($array, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Protected Object Recursive
|
||||
*/
|
||||
protected static function objectRecursive(array $array, &$std)
|
||||
{
|
||||
foreach( $array as $key => $value )
|
||||
{
|
||||
if( is_array($value) )
|
||||
{
|
||||
$std->$key = new stdClass;
|
||||
|
||||
self::objectRecursive($value, $std->$key);
|
||||
}
|
||||
else
|
||||
{
|
||||
$std->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php namespace ZN\DataTypes;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\Ability\Serialization;
|
||||
|
||||
#[\AllowDynamicProperties]
|
||||
|
||||
class Stack
|
||||
{
|
||||
use Serialization;
|
||||
|
||||
const serialization =
|
||||
[
|
||||
'class' => 'Strings',
|
||||
'start' => 'data',
|
||||
'end' => 'get'
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
<?php namespace ZN\DataTypes;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\Helper;
|
||||
use ZN\Controller\Factory;
|
||||
use ZN\Ability\Functionalization;
|
||||
|
||||
class Strings extends Factory
|
||||
{
|
||||
use Functionalization;
|
||||
|
||||
const factory =
|
||||
[
|
||||
'methods' =>
|
||||
[
|
||||
'mtrim' => 'Strings\Trim::middle',
|
||||
'trimslashes' => 'Strings\Trim::slashes',
|
||||
'addprefix' => 'Strings\Trim::prefix',
|
||||
'removeprefix' => 'Strings\Trim::removePrefix',
|
||||
'addsuffix' => 'Strings\Trim::suffix',
|
||||
'removesuffix' => 'Strings\Trim::removeSuffix',
|
||||
'addbothfix' => 'Strings\Trim::presuffix',
|
||||
'removebothfix' => 'Strings\Trim::removePresuffix',
|
||||
'casing' => 'Strings\Casing::use',
|
||||
'lowercase' => 'Strings\Casing::lower',
|
||||
'uppercase' => 'Strings\Casing::upper',
|
||||
'titlecase' => 'Strings\Casing::title',
|
||||
'pascalcase' => 'Strings\Casing::pascal',
|
||||
'camelcase' => 'Strings\Casing::camel',
|
||||
'underscorecase' => 'Strings\Casing::underscore',
|
||||
'search' => 'Strings\Search::use',
|
||||
'searchposition' => 'Strings\Search::position',
|
||||
'searchstring' => 'Strings\Search::string',
|
||||
'searchbetween' => 'Strings\Search::between',
|
||||
'searchbetweenboth'=> 'Strings\Search::betweenBoth',
|
||||
'reshuffle' => 'Strings\Substitution::reshuffle',
|
||||
'placement' => 'Strings\Substitution::placement',
|
||||
'replace' => 'Strings\Substitution::replace',
|
||||
'repeatcomplete' => 'Strings\Substitution::repeatComplete',
|
||||
'addslashes' => 'Strings\Security::addSlashes',
|
||||
'removeslashes' => 'Strings\Security::removeSlashes',
|
||||
'section' => 'Strings\Section::use',
|
||||
'splituppercase' => 'Strings\Split::upperCase',
|
||||
'apportion' => 'Strings\Split::apportion',
|
||||
'divide' => 'Strings\Split::divide',
|
||||
'removeelement' => 'Strings\Element::remove',
|
||||
'removefirst' => 'Strings\Element::removeFirst',
|
||||
'removelast' => 'Strings\Element::removeLast',
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* Functionalization
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
const functionalization =
|
||||
[
|
||||
'repeat' => 'str_repeat',
|
||||
'length' => 'mb_strlen',
|
||||
'split' => 'str_split'
|
||||
];
|
||||
|
||||
/**
|
||||
* String to Array
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $split = ' '
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function toArray(string $string, string $split = ' ')
|
||||
{
|
||||
if( empty($split) )
|
||||
{
|
||||
return str_split($string, 1); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
return explode($split, $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pad
|
||||
*
|
||||
* @param string $string
|
||||
* @param int $count = 1
|
||||
* @param string $chars = ' '
|
||||
* @param string $type = 'right' - options[right|left|both]
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function pad(string $string, int $count = 1, string $chars = ' ', string $type = 'right') : string
|
||||
{
|
||||
return str_pad($string, $count, $chars, Helper::toConstant($type, 'STR_PAD_'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Recurrent Count
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $char
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function recurrentCount(string $str, string $char) : int
|
||||
{
|
||||
return count(explode($char, $str)) - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserialize
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function unserialize(string $str) : array
|
||||
{
|
||||
parse_str(urldecode($str), $array);
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function serialize(array $array) : string
|
||||
{
|
||||
$queryString = [];
|
||||
|
||||
foreach( $array as $key => $value )
|
||||
{
|
||||
$queryString[] = urlencode($key) . '=' . urlencode($value);
|
||||
}
|
||||
|
||||
return implode('&', $queryString);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php namespace ZN\DataTypes\Strings;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\Helper;
|
||||
|
||||
class Casing
|
||||
{
|
||||
/**
|
||||
* Casing
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $type = 'lower'
|
||||
* @param string $encoding = 'utf-8'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function use(string $str, string $type = 'lower', string $encoding = 'utf-8') : string
|
||||
{
|
||||
return mb_convert_case($str, Helper::toConstant($type, 'MB_CASE_'), $encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Upper
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $encoding = 'utf-8'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function upper(string $str, string $encoding = 'utf-8') : string
|
||||
{
|
||||
return self::use($str, __FUNCTION__, $encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $encoding = 'utf-8'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function lower(string $str, string $encoding = 'utf-8') : string
|
||||
{
|
||||
return self::use($str, __FUNCTION__, $encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Title
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $encoding = 'utf-8'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function title(string $str, string $encoding = 'utf-8') : string
|
||||
{
|
||||
return self::use($str, __FUNCTION__, $encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Camel
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function camel(string $str) : string
|
||||
{
|
||||
$string = self::title(trim($str));
|
||||
|
||||
$string[0] = self::lower($string);
|
||||
|
||||
return Trim::middle($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pascal
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function pascal(string $str) : string
|
||||
{
|
||||
$string = self::title(trim($str));
|
||||
|
||||
return Trim::middle($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Underscore
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function underscore(string $str) : string
|
||||
{
|
||||
return preg_replace('/(\s+)/', '_', strtolower($str));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php namespace ZN\DataTypes\Strings;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
class Element
|
||||
{
|
||||
/**
|
||||
* Remove First Element
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $separator = '/'
|
||||
* @param int $index = 0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function removeFirst(string $str, string $separator = '/', int $index = 0) : string
|
||||
{
|
||||
return self::remove($str, $separator, abs($index));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Last Element
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $separator = '/'
|
||||
* @param int $index = 0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function removeLast(string $str, string $separator = '/', int $index = 0) : string
|
||||
{
|
||||
return self::remove($str, $separator, -abs($index));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Element
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $separator = '/'
|
||||
* @param int $index = 0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function remove(string $str, string $separator = '/', int $index = 0) : string
|
||||
{
|
||||
$strEx = explode($separator, $str);
|
||||
|
||||
if( ($countStr = count($strEx)) === 1 ) return $str;
|
||||
|
||||
$count = abs($index);
|
||||
|
||||
if( $countStr < $count ) $count = $countStr;
|
||||
|
||||
if( $count > 0 ) for( $start = 1; $start <= $count; $start++ )
|
||||
{
|
||||
($index < 0 ? 'array_pop' : 'array_shift')($strEx);
|
||||
}
|
||||
|
||||
return implode($separator, $strEx);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php namespace ZN\DataTypes\Strings;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
class Search
|
||||
{
|
||||
/**
|
||||
* Finds the expression between two statements.
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $start
|
||||
* @param string $end
|
||||
* @param bool $case = true [optional]
|
||||
* @param bool $both = false [optional]
|
||||
*
|
||||
* @return string|bool
|
||||
*/
|
||||
public static function between(string $str, string $start, string $end, bool $case = true, bool $both = false)
|
||||
{
|
||||
if( preg_match('/(?<start>' . preg_quote($start, '/') . ')(?<search>.*?)(?<end>' . preg_quote($end, '/') . ')/' . ( $case === true ? NULL : 'i' ), $str, $match) )
|
||||
{
|
||||
if( $both === false )
|
||||
{
|
||||
return $match['search'];
|
||||
}
|
||||
|
||||
return $match['start'] . $match['search'] . $match['end'];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the expression between two expressions, including parameters.
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $start
|
||||
* @param string $end
|
||||
* @param bool $case = true [optional]
|
||||
*
|
||||
* @return string|bool
|
||||
*/
|
||||
public static function betweenBoth(string $str, string $start, string $end, bool $case = true)
|
||||
{
|
||||
return self::between($str, $start, $end, $case, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $needle
|
||||
* @param string $type = 'string' - options[string|position]
|
||||
* @param bool $case = true
|
||||
*/
|
||||
public static function use(string $str, string $needle, string $type = 'string', bool $case = true)
|
||||
{
|
||||
if( $type === 'string' )
|
||||
{
|
||||
if( $case === true )
|
||||
{
|
||||
$function = 'mb_strstr';
|
||||
}
|
||||
else
|
||||
{
|
||||
$function = 'mb_stristr'; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
return $function($str, $needle);
|
||||
}
|
||||
|
||||
if( $type === 'position' )
|
||||
{
|
||||
if( $case === true )
|
||||
{
|
||||
$function = 'mb_strpos';
|
||||
}
|
||||
else
|
||||
{
|
||||
$function = 'mb_stripos';
|
||||
}
|
||||
|
||||
return $function($str, $needle);
|
||||
}
|
||||
|
||||
return false; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
/**
|
||||
* Search Position
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $needle
|
||||
* @param bool $case = true
|
||||
*/
|
||||
public static function position(string $str, string $needle, bool $case = true)
|
||||
{
|
||||
return self::use($str, $needle, __FUNCTION__, $case);
|
||||
}
|
||||
|
||||
/**
|
||||
* Search String
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $needle
|
||||
* @param bool $case = true
|
||||
*/
|
||||
public static function string(string $str, string $needle, bool $case = true) : string
|
||||
{
|
||||
return self::use($str, $needle, __FUNCTION__, $case);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php namespace ZN\DataTypes\Strings;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
class Section
|
||||
{
|
||||
/**
|
||||
* Section
|
||||
*
|
||||
* @param string $str
|
||||
* @param int $starting = 0
|
||||
* @param int $count = NULL
|
||||
* @param string $encoding = 'utf-8'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function use(string $str, int $starting = 0, ?int $count = NULL, string $encoding = 'utf-8') : string
|
||||
{
|
||||
return mb_substr($str, $starting, $count, $encoding);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php namespace ZN\DataTypes\Strings;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
class Security
|
||||
{
|
||||
/**
|
||||
* Add Slashes
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $addDifferentChars = NULL
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function addSlashes(string $string, ?string $addDifferentChars = NULL) : string
|
||||
{
|
||||
$return = addslashes($string);
|
||||
|
||||
if( ! empty($addDifferentChars) )
|
||||
{
|
||||
$return = addcslashes($return, $addDifferentChars);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Slashes
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function removeSlashes(string $string) : string
|
||||
{
|
||||
return stripslashes(stripcslashes($string));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php namespace ZN\DataTypes\Strings;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\Base;
|
||||
use ZN\Datatype;
|
||||
|
||||
class Split
|
||||
{
|
||||
/**
|
||||
* Split Upper Case
|
||||
*
|
||||
* @param string $string
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function upperCase(string $string) : array
|
||||
{
|
||||
return Datatype::splitUpperCase($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apportion
|
||||
*
|
||||
* @param string $string
|
||||
* @param int $length = 76
|
||||
* @param string $end = PHP_EOL
|
||||
*/
|
||||
public static function apportion(string $string, int $length = 76, string $end = PHP_EOL) : string
|
||||
{
|
||||
$arrayChunk = array_chunk(preg_split("//u", $string, -1, PREG_SPLIT_NO_EMPTY), $length);
|
||||
|
||||
$string = '';
|
||||
|
||||
foreach( $arrayChunk as $chunk )
|
||||
{
|
||||
$string .= implode('', $chunk) . $end;
|
||||
}
|
||||
|
||||
return Base::removeSuffix($string, $end);
|
||||
}
|
||||
|
||||
/**
|
||||
* Divide
|
||||
*
|
||||
* @param string $str = NULL
|
||||
* @param string $separator = '|'
|
||||
* @param string $index = '0'
|
||||
* @param string $count = '1' - added[5.6.02]
|
||||
*/
|
||||
public static function divide(?string $str = NULL, string $separator = '|', string $index = '0', string $count = '1')
|
||||
{
|
||||
return Datatype::divide($str, $separator, $index, $count);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php namespace ZN\DataTypes\Strings;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
class Substitution
|
||||
{
|
||||
/**
|
||||
* Reshuffle
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $shuffle
|
||||
* @param string $reshuffle
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function reshuffle(string $str, string $shuffle, string $reshuffle) : string
|
||||
{
|
||||
$shuffleEx = explode($shuffle, $str);
|
||||
|
||||
$newstr = '';
|
||||
|
||||
foreach( $shuffleEx as $v )
|
||||
{
|
||||
$newstr .= str_replace($reshuffle, $shuffle, $v).$reshuffle;
|
||||
}
|
||||
|
||||
return substr($newstr, 0, -strlen($reshuffle));
|
||||
}
|
||||
|
||||
/**
|
||||
* Placement
|
||||
*
|
||||
* @param string $str
|
||||
* @param string $delimiter
|
||||
* @param array $array
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function placement(string $str, string $delimiter, array $array) : string
|
||||
{
|
||||
if( ! empty($delimiter) )
|
||||
{
|
||||
$strex = explode($delimiter, $str);
|
||||
}
|
||||
else
|
||||
{
|
||||
return $str;
|
||||
}
|
||||
|
||||
if( (count($strex) - 1) !== count($array) )
|
||||
{
|
||||
return $str;
|
||||
}
|
||||
|
||||
$newstr = '';
|
||||
|
||||
for( $i = 0; $i < count($array); $i++ )
|
||||
{
|
||||
$newstr .= $strex[$i].$array[$i];
|
||||
}
|
||||
|
||||
return $newstr.$strex[count($array)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace
|
||||
*
|
||||
* @param string $string
|
||||
* @param mixed $oldChar
|
||||
* @param mixed $newChar
|
||||
* @param bool $case = true
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function replace(string $string, $oldChar, $newChar = NULL, bool $case = true) : string
|
||||
{
|
||||
if( $case === true )
|
||||
{
|
||||
$function = 'str_replace';
|
||||
}
|
||||
else
|
||||
{
|
||||
$function = 'str_ireplace';
|
||||
}
|
||||
|
||||
return $function($oldChar ?? '', $newChar ?? '', $string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeat Complate
|
||||
*
|
||||
* @param string $string
|
||||
* @param int $completeCount
|
||||
* @param string $completeSymbol = '0'
|
||||
* @param string $direction = 'left' - options[left|right]
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function repeatComplete(string $string, int $completeCount, string $completeSymbol = '0', string $direction = 'left') : string
|
||||
{
|
||||
$length = strlen($string);
|
||||
|
||||
$diff = $completeCount - $length;
|
||||
|
||||
if( $direction === 'left' )
|
||||
{
|
||||
$end = $string;
|
||||
}
|
||||
else
|
||||
{
|
||||
$start = $string;
|
||||
}
|
||||
|
||||
if( $diff > 0 )
|
||||
{
|
||||
$fix = str_repeat($completeSymbol, $diff);
|
||||
}
|
||||
else
|
||||
{
|
||||
$fix = '';
|
||||
}
|
||||
|
||||
return $start . $fix . $end;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
<?php namespace ZN\DataTypes\Strings;
|
||||
/**
|
||||
* ZN PHP Web Framework
|
||||
*
|
||||
* "Simplicity is the ultimate sophistication." ~ Da Vinci
|
||||
*
|
||||
* @package ZN
|
||||
* @license MIT [http://opensource.org/licenses/MIT]
|
||||
* @author Ozan UYKUN [ozan@znframework.com]
|
||||
*/
|
||||
|
||||
use ZN\Base;
|
||||
|
||||
class Trim
|
||||
{
|
||||
/**
|
||||
* Middle
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function middle(string $str) : string
|
||||
{
|
||||
$str = preg_replace
|
||||
(
|
||||
['/\s+/', '/ /', "/\n/", "/\r/", "/\t/"],
|
||||
['', '', '', '', ''],
|
||||
$str
|
||||
);
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Slashes
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function slashes(string $str) : string
|
||||
{
|
||||
$str = trim($str, "/");
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an expression in begin of a string.,
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $fix = '/'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function removePrefix(?string $data = NULL, string $fix = '/') : string
|
||||
{
|
||||
return Base::removePrefix($data, $fix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an expression in begin of a string.,
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $fix = '/'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function removeSuffix(?string $data = NULL, string $fix = '/') : string
|
||||
{
|
||||
return Base::removeSuffix($data, $fix);
|
||||
}
|
||||
|
||||
/**
|
||||
* It removes an expression from both sides of a string.
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $fix = '/'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function removePresuffix(?string $data = NULL, string $fix = '/') : string
|
||||
{
|
||||
return Base::removePresuffix($data, $fix);
|
||||
}
|
||||
|
||||
/**
|
||||
* suffix
|
||||
*
|
||||
* It is used to append a suffix to any string.
|
||||
*
|
||||
* @param string = NULL
|
||||
* @param string = $fix = '/'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function suffix(?string $data = NULL, string $fix = '/') : string
|
||||
{
|
||||
return Base::suffix($data, $fix);
|
||||
}
|
||||
|
||||
/**
|
||||
* prefix
|
||||
*
|
||||
* It is used to append a prefix to any string.
|
||||
*
|
||||
* @param string = NULL
|
||||
* @param string = $fix = '/'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function prefix(?string $data = NULL, string $fix = '/') : string
|
||||
{
|
||||
return Base::prefix($data, $fix);
|
||||
}
|
||||
|
||||
/**
|
||||
* prefix
|
||||
*
|
||||
* Used to append both suffixes and prefixes to any string.
|
||||
*
|
||||
* @param string = NULL
|
||||
* @param string = $fix = '/'
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function presuffix(?string $data = NULL, string $fix = '/') : string
|
||||
{
|
||||
return Base::presuffix($data, $fix);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user