Skip to content

Commit de84512

Browse files
committed
fixed bug undefined function str()
1 parent 457a6d8 commit de84512

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

src/Common/Helpers.php

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Illuminate\Support\Str;
26

37
if (!function_exists('batch')) {
48
/**
@@ -11,3 +15,31 @@ function batch()
1115
return app('Mavinoo\Batch\Batch');
1216
}
1317
}
18+
19+
if (!function_exists('str')) {
20+
/**
21+
* Get a new stringable object from the given string.
22+
*
23+
* @param string|null $string
24+
*
25+
* @return \Illuminate\Support\Stringable|mixed
26+
*/
27+
function str($string = null)
28+
{
29+
if (func_num_args() === 0) {
30+
return new class {
31+
public function __call($method, $parameters)
32+
{
33+
return Str::$method(...$parameters);
34+
}
35+
36+
public function __toString()
37+
{
38+
return '';
39+
}
40+
};
41+
}
42+
43+
return Str::of($string);
44+
}
45+
}

0 commit comments

Comments
 (0)