|
5 | 5 | namespace Yiisoft\Db\Helper; |
6 | 6 |
|
7 | 7 | use function is_float; |
8 | | -use function mb_strrpos; |
9 | | -use function mb_strtolower; |
10 | | -use function mb_substr; |
11 | 8 | use function preg_match; |
12 | 9 | use function preg_replace; |
13 | | -use function rtrim; |
14 | 10 | use function str_replace; |
15 | | -use function trim; |
16 | 11 |
|
17 | 12 | /** |
18 | 13 | * String manipulation methods. |
19 | 14 | */ |
20 | 15 | final class DbStringHelper |
21 | 16 | { |
22 | | - /** |
23 | | - * Returns the trailing name part of a path. |
24 | | - * |
25 | | - * This method is similar to the php function `basename()` except that it will treat both \ and / as directory |
26 | | - * separators, independent of the operating system. |
27 | | - * |
28 | | - * This method was mainly created to work on php namespaces. When working with real file paths, PHP's `basename()` |
29 | | - * should work fine for you. |
30 | | - * |
31 | | - * Note: this method isn't aware of the actual filesystem, or path components such as "..". |
32 | | - * |
33 | | - * @param string $path A path string. |
34 | | - * |
35 | | - * @return string The trailing name part of the given path. |
36 | | - * |
37 | | - * @link https://www.php.net/manual/en/function.basename.php |
38 | | - */ |
39 | | - public static function baseName(string $path): string |
40 | | - { |
41 | | - $path = rtrim(str_replace('\\', '/', $path), '/'); |
42 | | - $position = mb_strrpos($path, '/'); |
43 | | - |
44 | | - if ($position !== false) { |
45 | | - return mb_substr($path, $position + 1); |
46 | | - } |
47 | | - |
48 | | - return $path; |
49 | | - } |
50 | | - |
51 | 17 | /** |
52 | 18 | * Returns a value indicating whether an SQL statement is for read purpose. |
53 | 19 | * |
@@ -78,20 +44,4 @@ public static function normalizeFloat(float|string $value): string |
78 | 44 | /** @var string */ |
79 | 45 | return preg_replace('/\.(?=.*\.)/', '', $value); |
80 | 46 | } |
81 | | - |
82 | | - /** |
83 | | - * Converts a PascalCase name into an ID in lowercase. |
84 | | - * |
85 | | - * Words in the ID may be concatenated using '_'. For example, 'PostTag' will be converted to 'post_tag'. |
86 | | - * |
87 | | - * @param string $input The string to be converted. |
88 | | - * |
89 | | - * @return string The resulting ID. |
90 | | - */ |
91 | | - public static function pascalCaseToId(string $input): string |
92 | | - { |
93 | | - /** @var string $result */ |
94 | | - $result = preg_replace('/(?<=\p{L})(?<!\p{Lu})(\p{Lu})/u', '_\1', $input); |
95 | | - return mb_strtolower(trim($result, '_')); |
96 | | - } |
97 | 47 | } |
0 commit comments