@@ -1540,6 +1540,16 @@ Reload rereads config files for future EasyLibrary operations. It does not:
15401540 ` PluginCdnResourcePackTrait` and `components\utils\ResourcePacks`.
15411541- The unused `HttpUtils` and `FunctionUtils` helpers were removed from
15421542 ` components\utils ` .
1543+ - The remaining pure legacy utility helpers were removed from
1544+ `components\utils` as well :
1545+ ` ArrayUtils` , `Text`, `Number`, `TimeUtils` and `ValidationUtils`.
1546+ Their 3.x replacement is LibCommons, using focused namespaces such as
1547+ ` imperazim\c ommons\c ollection` , `imperazim\commons\text`,
1548+ ` imperazim\c ommons\n umber` , `imperazim\commons\time` and
1549+ ` imperazim\c ommons\v alidation` .
1550+ - The old SQL-like `ArrayUtils::query`, `select`, `insert`, `update` and
1551+ ` delete` helpers were intentionally not ported to LibCommons. Use LibDB or
1552+ explicit collection code instead.
15431553- ` imperazim\c omponents\f ilesystem\F ile` no longer depends on the removed
15441554 Config wrapper. New code should pass a directory string and file metadata, or
15451555 use PocketMine `Config` directly for normal config files.
@@ -1596,6 +1606,21 @@ need PocketMine lifecycle, filesystem state and server resource-pack handling.
15961606work belongs in `LibHttp`; delayed callbacks should use PocketMine scheduler or
15971607a plugin-owned service.
15981608
1609+ The remaining pure utility classes were moved out of the core because
1610+ EasyLibrary 3.x is a manager, not a general-purpose utility bundle. Keeping
1611+ ` ArrayUtils` , `Text`, `Number`, `TimeUtils` and `ValidationUtils` in the core
1612+ would recreate the old full-bundle expectation in a smaller shape. LibCommons
1613+ is the correct owner for these helpers because it can be installed as a normal
1614+ official package, versioned independently and reused by standalone libraries
1615+ without implying that EasyLibrary core owns every helper API.
1616+
1617+ The SQL-like `ArrayUtils` methods were not moved because their behavior looked
1618+ database-shaped but operated on arbitrary arrays through regex parsing. That is
1619+ too surprising for a commons package and too weak for real persistence. In 3.x,
1620+ database-shaped data should use LibDB, while in-memory array transformations
1621+ should be written explicitly with `Arr::pluck`, `Arr::groupBy`,
1622+ ` Arr::sortBy` , `array_filter`, `array_map` or small local domain code.
1623+
15991624The filesystem area is different : ` File` and `Path` are actively useful to the
16001625core and remain part of the EasyLibrary direction. They may be renamed, moved or
16011626hardened, but the idea should stay available.
@@ -1668,6 +1693,59 @@ task through the plugin scheduler directly:
16681693$this->getScheduler()->scheduleDelayedTask($task, 20);
16691694` ` `
16701695
1696+ If old code used the remaining `components\utils` classes, install LibCommons
1697+ and import the focused replacement :
1698+
1699+ ` ` ` php
1700+ use imperazim\c ommons\c ollection\A rr;
1701+ use imperazim\c ommons\n umber\N umber;
1702+ use imperazim\c ommons\t ext\T ext;
1703+ use imperazim\c ommons\t ime\C lock;
1704+ use imperazim\c ommons\t ime\D uration;
1705+ use imperazim\c ommons\v alidation\V alidator;
1706+
1707+ $names = Arr::pluck($users, "name");
1708+ $message = Text::colorize("&aOnline");
1709+ $coins = Number::compact(15320);
1710+ $now = Clock::time();
1711+ $seconds = Duration::parse("10m");
1712+ $validName = Validator::minecraftUsername("Steve_01");
1713+ ` ` `
1714+
1715+ Common method migrations :
1716+
1717+ | 2.x helper | 3.x direction |
1718+ |---|---|
1719+ | `ArrayUtils::pluck($rows, "name")` | `Arr::pluck($rows, "name")` |
1720+ | `ArrayUtils::flatten($array)` | `Arr::flatten($array)` |
1721+ | `ArrayUtils::groupBy($rows, "rank")` | `Arr::groupBy($rows, "rank")` |
1722+ | `Text::insertLineBreaks($text, 36)` | `Text::wrapWords($text, 36)` |
1723+ | `Text::removeExtraSpaces($text)` | `Text::normalizeSpaces($text)` |
1724+ | `Text::toUpperCase($text)` | `Text::upper($text)` |
1725+ | `Text::toLowerCase($text)` | `Text::lower($text)` |
1726+ | `Text::titleCase($text)` | `Text::title($text)` |
1727+ | `Text::slugify($text)` | `Text::slug($text)` |
1728+ | `Text::colorize($text)` | `Text::colorize($text)` |
1729+ | `Number::formatAsCurrency($value)` | `Number::currency($value)` |
1730+ | `Number::formatAsPercentage($ratio)` | `Number::percent($ratio)` |
1731+ | `Number::format($length, $number)` | `Number::pad($number, $length)` |
1732+ | `Number::max($numbers)` | `Number::maxOrNull($numbers)` |
1733+ | `Number::min($numbers)` | `Number::minOrNull($numbers)` |
1734+ | `TimeUtils::GetCurrentTime()` | `Clock::time()` |
1735+ | `TimeUtils::GetCurrentDate()` | `Clock::date()` |
1736+ | `TimeUtils::IsWeekend()` | `Clock::isWeekend()` |
1737+ | `TimeUtils::IsLeapYear()` | `Clock::isLeapYear()` |
1738+ | `ValidationUtils::isEmail($value)` | `Validator::email($value)` |
1739+ | `ValidationUtils::isUrl($value)` | `Validator::url($value)` |
1740+ | `ValidationUtils::isInteger($value)` | `Validator::integer($value)` |
1741+ | `ValidationUtils::isMinecraftUsername($value)` | `Validator::minecraftUsername($value)` |
1742+ | `ValidationUtils::isIpAddress($value)` | `Validator::ip($value)` |
1743+
1744+ The phone-number validator and generic `Text::substring`, `Text::reverse` or
1745+ ` Text::stripHtmlTags` style helpers were not copied as-is. Use native PHP
1746+ functions or plugin-local validation for those cases unless they become common
1747+ enough to justify a focused LibCommons addition later.
1748+
16711749Recommended mindset :
16721750
16731751` ` ` text
0 commit comments