@@ -21,31 +21,31 @@ final class TurboStream
21
21
*/
22
22
public static function append (string $ target , string $ html ): string
23
23
{
24
- return self ::wrap ('append ' , $ target , $ html );
24
+ return self ::custom ('append ' , $ target , $ html );
25
25
}
26
26
27
27
/**
28
28
* Prepends to the element(s) designated by the target CSS selector.
29
29
*/
30
30
public static function prepend (string $ target , string $ html ): string
31
31
{
32
- return self ::wrap ('prepend ' , $ target , $ html );
32
+ return self ::custom ('prepend ' , $ target , $ html );
33
33
}
34
34
35
35
/**
36
36
* Replaces the element(s) designated by the target CSS selector.
37
37
*/
38
38
public static function replace (string $ target , string $ html , bool $ morph = false ): string
39
39
{
40
- return self ::wrap ('replace ' , $ target , $ html , $ morph ? ['method="morph" ' ] : []);
40
+ return self ::custom ('replace ' , $ target , $ html , $ morph ? ['method="morph" ' ] : []);
41
41
}
42
42
43
43
/**
44
44
* Updates the content of the element(s) designated by the target CSS selector.
45
45
*/
46
46
public static function update (string $ target , string $ html , bool $ morph = false ): string
47
47
{
48
- return self ::wrap ('update ' , $ target , $ html , $ morph ? ['method="morph" ' ] : []);
48
+ return self ::custom ('update ' , $ target , $ html , $ morph ? ['method="morph" ' ] : []);
49
49
}
50
50
51
51
/**
@@ -61,15 +61,15 @@ public static function remove(string $target): string
61
61
*/
62
62
public static function before (string $ target , string $ html ): string
63
63
{
64
- return self ::wrap ('before ' , $ target , $ html );
64
+ return self ::custom ('before ' , $ target , $ html );
65
65
}
66
66
67
67
/**
68
68
* Inserts after the element(s) designated by the target CSS selector.
69
69
*/
70
70
public static function after (string $ target , string $ html ): string
71
71
{
72
- return self ::wrap ('after ' , $ target , $ html );
72
+ return self ::custom ('after ' , $ target , $ html );
73
73
}
74
74
75
75
/**
@@ -87,19 +87,9 @@ public static function refresh(?string $requestId = null): string
87
87
}
88
88
89
89
/**
90
- * Custom Action.
91
- *
92
90
* @param array<string> $attr
93
91
*/
94
92
public static function custom (string $ action , string $ target , string $ html , array $ attr = []): string
95
- {
96
- return self ::wrap ($ action , $ target , $ html , $ attr );
97
- }
98
-
99
- /**
100
- * @param array<string> $attr
101
- */
102
- private static function wrap (string $ action , string $ target , string $ html , array $ attr = []): string
103
93
{
104
94
// Join array elements with a space and prepend a leading space
105
95
$ atrrString = empty ($ attr ) ? '' : ' ' .implode (' ' , $ attr );
0 commit comments