Page MenuHomeDevCentral

D2283.id5753.diff
No OneTemporary

D2283.id5753.diff

diff --git a/src/Collections/OmniArray.php b/src/Collections/OmniArray.php
--- a/src/Collections/OmniArray.php
+++ b/src/Collections/OmniArray.php
@@ -32,8 +32,10 @@
}
}
- public static function explode (string $delimiter, string $string, int $limit = PHP_INT_MAX) : self {
- return new OmniArray(explode($delimiter, $string, $limit));
+ public static function explode (string $delimiter, string $string,
+ int $limit = PHP_INT_MAX) : self {
+ return (new OmniString($string))
+ ->explode($delimiter, $limit);
}
///
diff --git a/tests/Collections/OmniArrayTest.php b/tests/Collections/OmniArrayTest.php
--- a/tests/Collections/OmniArrayTest.php
+++ b/tests/Collections/OmniArrayTest.php
@@ -32,4 +32,16 @@
$this->assertEquals("abc", $actual);
}
+ public function testExplode() : void {
+ $actual = OmniArray::explode(".", "a.b.c");
+
+ $this->assertEquals(["a", "b", "c"], $actual->toArray());
+ }
+
+ public function testExplodeWithoutDelimiter() : void {
+ $actual = OmniArray::explode("", "a.b.c");
+
+ $this->assertEquals(["a.b.c"], $actual->toArray());
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 02:01 (21 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2249914
Default Alt Text
D2283.id5753.diff (1 KB)

Event Timeline