Skip to content

Commit 2146e4e

Browse files
authored
Create str_limit (#10)
Co-authored-by: onairmarc <[email protected]>
1 parent 00992fd commit 2146e4e

File tree

5 files changed

+10
-30
lines changed

5 files changed

+10
-30
lines changed

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ a709fafb67d0f1ee38b072390385ec486416aa3e
44
c0c6bf6fb1c3ad80ff54b7420853ecc9096ee576
55
d637c653da4a72e3b2b1132c1f0a4af3e0135387
66
de3cddf99b38b4504132eb7449c2b7a20aee5cc3
7+
ad93f3bac4b6e6937e0e9a1a709afe31e66c5f54

.idea/laravel-idea.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compass.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/ObjectHelpers/str_helpers.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ function str_concat_space(mixed ...$str): string
3333
}
3434

3535
if (!function_exists('str_enum_val')) {
36-
/**@param mixed $enum */
3736
function str_enum_val(mixed $enum): string
3837
{
3938
return Str::toString($enum->value);
@@ -47,8 +46,15 @@ function stringify(mixed $str): string
4746
}
4847
}
4948

49+
if (!function_exists('str_limit')) {
50+
function str_limit(string $str, int $limit = 100): string
51+
{
52+
return Str::limit($str, $limit);
53+
}
54+
}
55+
5056
if (!function_exists('str_lower')) {
51-
function str_lower(mixed $str): string
57+
function str_lower(string $str): string
5258
{
5359
return Str::lower($str);
5460
}

0 commit comments

Comments
 (0)