Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create str_limit #10

Merged
merged 3 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ a709fafb67d0f1ee38b072390385ec486416aa3e
c0c6bf6fb1c3ad80ff54b7420853ecc9096ee576
d637c653da4a72e3b2b1132c1f0a4af3e0135387
de3cddf99b38b4504132eb7449c2b7a20aee5cc3
ad93f3bac4b6e6937e0e9a1a709afe31e66c5f54
2 changes: 1 addition & 1 deletion .idea/laravel-idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions compass.yml

This file was deleted.

10 changes: 8 additions & 2 deletions src/ObjectHelpers/str_helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ function str_concat_space(mixed ...$str): string
}

if (!function_exists('str_enum_val')) {
/**@param mixed $enum */
function str_enum_val(mixed $enum): string
{
return Str::toString($enum->value);
Expand All @@ -47,8 +46,15 @@ function stringify(mixed $str): string
}
}

if (!function_exists('str_limit')) {
function str_limit(string $str, int $limit = 100): string
{
return Str::limit($str, $limit);
}
}

if (!function_exists('str_lower')) {
function str_lower(mixed $str): string
function str_lower(string $str): string
{
return Str::lower($str);
}
Expand Down