|
1 | 1 | <?php |
2 | | - |
3 | 2 | declare(strict_types=1); |
4 | 3 |
|
5 | 4 | use PhpStringHelpers\utility\StrUtility as strHelpers; |
| 5 | + |
| 6 | +if (!function_exists('toCamelCase')) { |
| 7 | + function toCamelCase(string $words): string |
| 8 | + { |
| 9 | + return strHelpers::toCamelCase($words); |
| 10 | + } |
| 11 | +} |
| 12 | + |
| 13 | +if (!function_exists('toPascalCase')) { |
| 14 | + function toPascalCase(string $words): string |
| 15 | + { |
| 16 | + return strHelpers::toPascalCase($words); |
| 17 | + } |
| 18 | +} |
| 19 | + |
| 20 | +if (!function_exists('toKebabCase')) { |
| 21 | + function toKebabCase(string $words): string |
| 22 | + { |
| 23 | + return strHelpers::toKebabCase($words); |
| 24 | + } |
| 25 | +} |
| 26 | + |
| 27 | +if (!function_exists('toTitleCase')) { |
| 28 | + function toTitleCase(string $words): string |
| 29 | + { |
| 30 | + return strHelpers::toTitleCase($words); |
| 31 | + } |
| 32 | +} |
| 33 | + |
| 34 | +if (!function_exists('toConstant')) { |
| 35 | + function toConstant(string $words): string |
| 36 | + { |
| 37 | + return strHelpers::toConstant($words); |
| 38 | + } |
| 39 | +} |
| 40 | + |
| 41 | +if (!function_exists('toSnakeCase')) { |
| 42 | + function toSnakeCase(string $words): string |
| 43 | + { |
| 44 | + return strHelpers::toSnakeCase($words); |
| 45 | + } |
| 46 | +} |
| 47 | + |
| 48 | +if (!function_exists('toPathCase')) { |
| 49 | + function toPathCase(string $words): string |
| 50 | + { |
| 51 | + return strHelpers::toPathCase($words); |
| 52 | + } |
| 53 | +} |
| 54 | + |
| 55 | +if (!function_exists('toAdaCase')) { |
| 56 | + function toAdaCase(string $words): string |
| 57 | + { |
| 58 | + return strHelpers::toAdaCase($words); |
| 59 | + } |
| 60 | +} |
| 61 | + |
| 62 | +if (!function_exists('dotNotation')) { |
| 63 | + function dotNotation(string $words): string |
| 64 | + { |
| 65 | + return strHelpers::dotNotation($words); |
| 66 | + } |
| 67 | +} |
| 68 | + |
| 69 | +if (!function_exists('entitiesWrapper')) { |
| 70 | + function entitiesWrapper(string | int $data): string |
| 71 | + { |
| 72 | + return strHelpers::entitiesWrapper($data); |
| 73 | + } |
| 74 | +} |
| 75 | + |
| 76 | +if (!function_exists('toSlug')) { |
| 77 | + function toSlug(string $string): string |
| 78 | + { |
| 79 | + return strHelpers::toSlug($string); |
| 80 | + } |
| 81 | +} |
| 82 | + |
| 83 | +if (!function_exists('rmAllBlank')) { |
| 84 | + function rmAllBlank(string $words): string |
| 85 | + { |
| 86 | + return strHelpers::rmAllBlank($words); |
| 87 | + } |
| 88 | +} |
| 89 | + |
| 90 | +if (!function_exists('alternate')) { |
| 91 | + function alternate(?string $string, string $alternate = null): string |
| 92 | + { |
| 93 | + return strHelpers::alternate($string, $alternate); |
| 94 | + } |
| 95 | +} |
| 96 | + |
| 97 | +if (!function_exists('translate')) { |
| 98 | + function translate(string $key, string $replace = '', string $fileName = 'en'): string |
| 99 | + { |
| 100 | + return strHelpers::translate($key, $replace, $fileName); |
| 101 | + } |
| 102 | +} |
| 103 | + |
| 104 | +if (!function_exists('wrapper')) { |
| 105 | + function wrapper(int|string $string, int|string $wrapper = '*'): string |
| 106 | + { |
| 107 | + return strHelpers::wrapper($string, $wrapper); |
| 108 | + } |
| 109 | +} |
| 110 | + |
| 111 | +if (!function_exists('path')) { |
| 112 | + function path(string $path, string $pathExtension = 'php'): string |
| 113 | + { |
| 114 | + return strHelpers::path($path, $pathExtension); |
| 115 | + } |
| 116 | +} |
| 117 | + |
| 118 | +if (!function_exists('generatePin')) { |
| 119 | + function generatePin(int $length = 4): int |
| 120 | + { |
| 121 | + return strHelpers::generatePin($length); |
| 122 | + } |
| 123 | +} |
| 124 | + |
| 125 | +if (!function_exists('clearString')) { |
| 126 | + function clearString(string $data): string |
| 127 | + { |
| 128 | + return strHelpers::clearString($data); |
| 129 | + } |
| 130 | +} |
| 131 | + |
| 132 | +if (!function_exists('pureString')) { |
| 133 | + function pureString(string $data): string |
| 134 | + { |
| 135 | + return strHelpers::pureString($data); |
| 136 | + } |
| 137 | +} |
| 138 | + |
| 139 | +if (!function_exists('randomWords')) { |
| 140 | + function randomWords(int $size = 5): string |
| 141 | + { |
| 142 | + return strHelpers::randomWords($size); |
| 143 | + } |
| 144 | +} |
| 145 | + |
| 146 | +if (!function_exists('randomWords')) { |
| 147 | + function randomWords(int $size = 5): string |
| 148 | + { |
| 149 | + return strHelpers::randomWords($size); |
| 150 | + } |
| 151 | +} |
| 152 | + |
| 153 | +if (!function_exists('randomHex')) { |
| 154 | + function randomHex(): string |
| 155 | + { |
| 156 | + return strHelpers::randomHex(); |
| 157 | + } |
| 158 | +} |
| 159 | + |
| 160 | +if (!function_exists('randomRgb')) { |
| 161 | + function randomRgb(): string |
| 162 | + { |
| 163 | + return strHelpers::randomRgb(); |
| 164 | + } |
| 165 | +} |
| 166 | + |
| 167 | +if (!function_exists('rmLink')) { |
| 168 | + function rmLink(string $string): string |
| 169 | + { |
| 170 | + return strHelpers::rmLink($string); |
| 171 | + } |
| 172 | +} |
| 173 | + |
| 174 | +if (!function_exists('limitChar')) { |
| 175 | + function limitChar(string|int $string, int $length): string |
| 176 | + { |
| 177 | + return strHelpers::limitChar($string, $length); |
| 178 | + } |
| 179 | +} |
| 180 | + |
| 181 | +if (!function_exists('generateId')) { |
| 182 | + function generateId( |
| 183 | + string|int $prefix = '', |
| 184 | + string|int $suffix = '', |
| 185 | + bool $moreEntropy = false |
| 186 | + ): string { |
| 187 | + return strHelpers::generateId($prefix, $suffix, $moreEntropy); |
| 188 | + } |
| 189 | +} |
| 190 | + |
| 191 | +if (!function_exists('rmNumbers')) { |
| 192 | + function rmNumbers(string $string): string |
| 193 | + { |
| 194 | + return strHelpers::rmNumbers($string); |
| 195 | + } |
| 196 | +} |
| 197 | + |
| 198 | +if (!function_exists('rmCharacters')) { |
| 199 | + function rmCharacters(string $string): string |
| 200 | + { |
| 201 | + return strHelpers::rmCharacters($string); |
| 202 | + } |
| 203 | +} |
| 204 | + |
| 205 | +if (!function_exists('rmExtraBlank')) { |
| 206 | + function rmExtraBlank(string $string): string |
| 207 | + { |
| 208 | + return strHelpers::rmExtraBlank($string); |
| 209 | + } |
| 210 | +} |
| 211 | + |
| 212 | +if (!function_exists('hexToRgb')) { |
| 213 | + function hexToRgb(string $color): ?string |
| 214 | + { |
| 215 | + return strHelpers::hexToRgb($color); |
| 216 | + } |
| 217 | +} |
| 218 | + |
| 219 | +if (!function_exists('rgbToHex')) { |
| 220 | + function rgbToHex(string $color): ?string |
| 221 | + { |
| 222 | + return strHelpers::rgbToHex($color); |
| 223 | + } |
| 224 | +} |
| 225 | + |
| 226 | +if (!function_exists('generateAnchor')) { |
| 227 | + function generateAnchor(string|int $content, string $href): string |
| 228 | + { |
| 229 | + return strHelpers::generateAnchor($content, $href); |
| 230 | + } |
| 231 | +} |
| 232 | + |
| 233 | +if (!function_exists('getEncoding')) { |
| 234 | + function getEncoding(string $string): string |
| 235 | + { |
| 236 | + return strHelpers::getEncoding($string); |
| 237 | + } |
| 238 | +} |
| 239 | + |
| 240 | +if (!function_exists('isUtf8')) { |
| 241 | + function isUtf8(string|array $string): bool |
| 242 | + { |
| 243 | + return strHelpers::isUtf8($string); |
| 244 | + } |
| 245 | +} |
| 246 | + |
| 247 | +if (!function_exists('rmDuplicateWords')) { |
| 248 | + function rmDuplicateWords(string $string): string |
| 249 | + { |
| 250 | + return strHelpers::rmDuplicateWords($string); |
| 251 | + } |
| 252 | +} |
| 253 | + |
| 254 | +if (!function_exists('rmRightChar')) { |
| 255 | + function rmRightChar(string $words, int $num): string |
| 256 | + { |
| 257 | + return strHelpers::rmRightChar($words, $num); |
| 258 | + } |
| 259 | +} |
| 260 | + |
| 261 | +if (!function_exists('rmLeftChar')) { |
| 262 | + function rmLeftChar(string $words, int $num): string |
| 263 | + { |
| 264 | + return strHelpers::rmLeftChar($words, $num); |
| 265 | + } |
| 266 | +} |
| 267 | + |
| 268 | +if (!function_exists('rmChar')) { |
| 269 | + function rmChar(string $words, int $num): string |
| 270 | + { |
| 271 | + return strHelpers::rmChar($words, $num); |
| 272 | + } |
| 273 | +} |
| 274 | + |
| 275 | +if (!function_exists('isJson')) { |
| 276 | + function isJson(mixed $data): bool |
| 277 | + { |
| 278 | + return strHelpers::isJson($data); |
| 279 | + } |
| 280 | +} |
| 281 | + |
| 282 | +if (!function_exists('isContains')) { |
| 283 | + function isContains(string $string, string $search, bool $caseSensitive = false): bool |
| 284 | + { |
| 285 | + return strHelpers::isContains($string, $search, $caseSensitive); |
| 286 | + } |
| 287 | +} |
| 288 | + |
| 289 | +if (!function_exists('isStartWith')) { |
| 290 | + function isStartWith(string $string, string $search, bool $caseSensitive = false): bool |
| 291 | + { |
| 292 | + return strHelpers::isStartWith($string, $search, $caseSensitive); |
| 293 | + } |
| 294 | +} |
| 295 | + |
| 296 | +if (!function_exists('lastWord')) { |
| 297 | + function lastWord(string $string): string |
| 298 | + { |
| 299 | + return strHelpers::lastWord($string); |
| 300 | + } |
| 301 | +} |
| 302 | + |
| 303 | +if (!function_exists('firstWord')) { |
| 304 | + function firstWord(string $string): string |
| 305 | + { |
| 306 | + return strHelpers::firstWord($string); |
| 307 | + } |
| 308 | +} |
| 309 | + |
| 310 | +if (!function_exists('getFirstNumbers')) { |
| 311 | + function getFirstNumbers(string $string): string |
| 312 | + { |
| 313 | + return strHelpers::getFirstNumbers($string); |
| 314 | + } |
| 315 | +} |
| 316 | + |
| 317 | +if (!function_exists('getLastNumbers')) { |
| 318 | + function getLastNumbers(string $string): string |
| 319 | + { |
| 320 | + return strHelpers::getLastNumbers($string); |
| 321 | + } |
| 322 | +} |
| 323 | + |
| 324 | +if (!function_exists('rmBeginningNumbers')) { |
| 325 | + function rmBeginningNumbers(string $string): string |
| 326 | + { |
| 327 | + return strHelpers::rmBeginningNumbers($string); |
| 328 | + } |
| 329 | +} |
| 330 | + |
| 331 | +if (!function_exists('rmFinalNumbers')) { |
| 332 | + function rmFinalNumbers(string $string): string |
| 333 | + { |
| 334 | + return strHelpers::rmFinalNumbers($string); |
| 335 | + } |
| 336 | +} |
| 337 | + |
| 338 | +if (!function_exists('convertToUtf8')) { |
| 339 | + function convertToUtf8(string $string): string |
| 340 | + { |
| 341 | + return strHelpers::convertToUtf8($string); |
| 342 | + } |
| 343 | +} |
| 344 | + |
| 345 | +if (!function_exists('incrementBy')) { |
| 346 | + function incrementBy(string $string, ?string $separator = null): string |
| 347 | + { |
| 348 | + return strHelpers::incrementBy($string, $separator); |
| 349 | + } |
| 350 | +} |
| 351 | + |
| 352 | +if (!function_exists('decrementBy')) { |
| 353 | + function decrementBy(string $string, ?string $separator = null): string |
| 354 | + { |
| 355 | + return strHelpers::decrementBy($string, $separator); |
| 356 | + } |
| 357 | +} |
0 commit comments