Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3750622
D2283.id5753.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D2283.id5753.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D2283: Switch to OmniString::explode implementation
Attached
Detach File
Event Timeline
Log In to Comment