Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
Remove usage of str_before
Browse files Browse the repository at this point in the history
  • Loading branch information
calebporzio committed Oct 19, 2019
1 parent 7ce6656 commit eea2e88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/AwesomeHelpersServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function boot()
continue;
}

$function = str_before($helperFile, '.php');
$function = Str::before($helperFile, '.php');

if (function_exists($function)) {
continue;
Expand Down
6 changes: 4 additions & 2 deletions src/helpers/tinker.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use Illuminate\Support\Str;

function tinker(...$args)
{
if (empty($args)) {
Expand All @@ -22,14 +24,14 @@ function tinker(...$args)
return file($filePath)[$lineNumber - 1];
// " tinker($post, new User);"
})->map(function ($carry) {
return str_before(str_after($carry, 'tinker('), ');');
return Str::before(Str::after($carry, 'tinker('), ');');
// "$post, new User"
})->flatMap(function ($carry) {
return array_map('trim', explode(',', $carry));
// ["post", "new User"]
})->map(function ($carry, $index) {
return strpos($carry, '$') === 0
? str_after($carry, '$')
? Str::after($carry, '$')
: 'temp' . $index;
// ["post", "temp1"]
})
Expand Down

0 comments on commit eea2e88

Please sign in to comment.