Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
tamedevelopers committed Jul 4, 2024
1 parent f328a33 commit 413372f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ static public function formatString($string, $number = 4, $seperator = '-')
{
return implode($seperator, str_split(self::trim($string), $number));
}

/**
* Clean phone string
*
Expand Down Expand Up @@ -946,7 +946,7 @@ static public function padString(string $value, int $length, string $padChar = '
*
* @return string The string with converted case
*/
private static function convertCase($string = null, string|null $type)
private static function convertCase($string = null, $type = null)
{
return match (self::lower($type)) {
'upper', 'uppercase', 'upper_case' => self::upper($string),
Expand Down
9 changes: 4 additions & 5 deletions Tests/str.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@


dd(
// $changeArrayKeys,
// $removeArrayKeys,
$changeArrayKeys,
$removeArrayKeys,

Str::convertArrayCase(
data: $arrayCollection,
value: 'lower'
),

Str::formatString('892892982982', 5),
Str::snake('Peterso More'),
Str::camel('peterson more'),
Str::studly('peterson more'),
Expand All @@ -54,8 +53,8 @@
Str::randomWords(10),
Str::mask('[email protected]', 2, 'left'),
Str::shorten('【2023最新】香港郵政本地平郵郵費計算、基本郵費一覽', 20),
Str::html('<span class="pul-text pul-text--bold smb-web-view-dynamic-list-item-title">google.com <script></script></span>'),
Str::text('<span class="pul-text pul-text--bold smb-web-view-dynamic-list-item-title">google.com <script></script></span>'),
Str::html('<span class="pul-text pul-text--bold smb-web-view-dynamic-list-item-title">lhkexpressvps.com <script></script></span>'),
Str::text('<span class="pul-text pul-text--bold smb-web-view-dynamic-list-item-title">lhkexpressvps.com <script></script></span>'),
Str::encrypt('hoping for more'),
Str::decrypt('{"k":"dadb5dd1a0558257","e":"7ZMcZv6tALEVq4k7MHpJCQ==","s":"cUFmY0ZwRlpobVJ6bGxTYUJrVDdydz09"}'),
Str::phone('+234 (90) 012-234'),
Expand Down
35 changes: 18 additions & 17 deletions helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,28 @@ function TameTime($time = null, $timezone = null)
}
}

if (! function_exists('Str')) {

if (! function_exists('TameCollect')) {
/**
* Collection of data
*
* @param array $items
*
* @return \Tamedevelopers\Support\Collections\Collection
*/
function TameCollect($items = [])
{
return new Collection($items);
}
}

if (! function_exists('TameStr')) {
/**
* Str
* Tame Str
*
* @return \Tamedevelopers\Support\Str
*/
function Str()
function TameStr()
{
return new Str();
}
Expand Down Expand Up @@ -176,20 +191,6 @@ function server()
}
}

if (! function_exists('collect')) {
/**
* Collection of data
*
* @param array $items
*
* @return \Tamedevelopers\Support\Collections\Collection
*/
function collect($items = [])
{
return new Collection($items);
}
}

if (! function_exists('autoload_register')) {
/**
* Autoload function to load class and files in a given folder
Expand Down

0 comments on commit 413372f

Please sign in to comment.