From 413372feae553a4e700861f31d3b6aa3bd577784 Mon Sep 17 00:00:00 2001 From: Fredrick Peter Date: Thu, 4 Jul 2024 03:45:47 +0100 Subject: [PATCH] update --- Str.php | 4 ++-- Tests/str.php | 9 ++++----- helpers.php | 35 ++++++++++++++++++----------------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Str.php b/Str.php index 4d35ead..c7e4470 100644 --- a/Str.php +++ b/Str.php @@ -339,7 +339,7 @@ static public function formatString($string, $number = 4, $seperator = '-') { return implode($seperator, str_split(self::trim($string), $number)); } - + /** * Clean phone string * @@ -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), diff --git a/Tests/str.php b/Tests/str.php index a82629c..33b68af 100644 --- a/Tests/str.php +++ b/Tests/str.php @@ -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'), @@ -54,8 +53,8 @@ Str::randomWords(10), Str::mask('tamedevelopers@gmail.com', 2, 'left'), Str::shorten('【2023最新】香港郵政本地平郵郵費計算、基本郵費一覽', 20), - Str::html('google.com '), - Str::text('google.com '), + Str::html('lhkexpressvps.com '), + Str::text('lhkexpressvps.com '), Str::encrypt('hoping for more'), Str::decrypt('{"k":"dadb5dd1a0558257","e":"7ZMcZv6tALEVq4k7MHpJCQ==","s":"cUFmY0ZwRlpobVJ6bGxTYUJrVDdydz09"}'), Str::phone('+234 (90) 012-234'), diff --git a/helpers.php b/helpers.php index 5317c6a..2ea0c1c 100644 --- a/helpers.php +++ b/helpers.php @@ -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(); } @@ -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