@@ -21,31 +21,31 @@ final class TurboStream
2121 */
2222 public static function append (string $ target , string $ html ): string
2323 {
24- return self ::wrap ('append ' , $ target , $ html );
24+ return self ::custom ('append ' , $ target , $ html );
2525 }
2626
2727 /**
2828 * Prepends to the element(s) designated by the target CSS selector.
2929 */
3030 public static function prepend (string $ target , string $ html ): string
3131 {
32- return self ::wrap ('prepend ' , $ target , $ html );
32+ return self ::custom ('prepend ' , $ target , $ html );
3333 }
3434
3535 /**
3636 * Replaces the element(s) designated by the target CSS selector.
3737 */
3838 public static function replace (string $ target , string $ html , bool $ morph = false ): string
3939 {
40- return self ::wrap ('replace ' , $ target , $ html , $ morph ? ['method="morph" ' ] : []);
40+ return self ::custom ('replace ' , $ target , $ html , $ morph ? ['method="morph" ' ] : []);
4141 }
4242
4343 /**
4444 * Updates the content of the element(s) designated by the target CSS selector.
4545 */
4646 public static function update (string $ target , string $ html , bool $ morph = false ): string
4747 {
48- return self ::wrap ('update ' , $ target , $ html , $ morph ? ['method="morph" ' ] : []);
48+ return self ::custom ('update ' , $ target , $ html , $ morph ? ['method="morph" ' ] : []);
4949 }
5050
5151 /**
@@ -61,15 +61,15 @@ public static function remove(string $target): string
6161 */
6262 public static function before (string $ target , string $ html ): string
6363 {
64- return self ::wrap ('before ' , $ target , $ html );
64+ return self ::custom ('before ' , $ target , $ html );
6565 }
6666
6767 /**
6868 * Inserts after the element(s) designated by the target CSS selector.
6969 */
7070 public static function after (string $ target , string $ html ): string
7171 {
72- return self ::wrap ('after ' , $ target , $ html );
72+ return self ::custom ('after ' , $ target , $ html );
7373 }
7474
7575 /**
@@ -87,19 +87,9 @@ public static function refresh(?string $requestId = null): string
8787 }
8888
8989 /**
90- * Custom Action.
91- *
9290 * @param array<string> $attr
9391 */
9492 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
10393 {
10494 // Join array elements with a space and prepend a leading space
10595 $ atrrString = empty ($ attr ) ? '' : ' ' .implode (' ' , $ attr );
0 commit comments