MMO\core\paths
MMO\core\paths ยท 24 symbols ยท generated 30 Sep 2026
absolute
paths.php:293Make $path absolute, prefixing it with $root when it's relative (NOTE: the result is NOT simplified -- any ../. end up literally in the merged result; run it through simplify() yourself if you need that).
- Namespace
MMO\core\paths
| $path | array | string | an absolute or relative path |
| $root | array | string | an absolute path |
| $force = false | bool | if false (default) and $path is already absolute, $path is returned as-is and $root is ignored entirely; if true, $root is always applied -- an already absolute $path is rewritten as $root/relative($path, $root) instead |
| $join = true | bool | if true, return a joined string; if false, return the segments array |
| returns | array | string | false | false only possible when $force is true and $path can't be related to $root at all |
Call graph
Uses (5)
absoluteFilename
paths.php:538Same as absolute(), but drive-aware (via isAbsoluteFilename()/relativeFilename() when $isWindows).
- Namespace
MMO\core\paths
| $path | array | string | an absolute or relative path |
| $root | array | string | an absolute path |
| $force = false | bool | if true, $root always applies, even to an already-absolute $path (absolute()) |
| $join = true | bool | if true, return a joined string; if false, return the segments array |
| $isWindows = MMO\core\paths\IS_WINDOWS | bool | |
| returns | array | string | false |
Call graph
adrive
paths.php:380Get the "drive" of an already-split path (segments array): / for a unix path (a leading empty segment), or the drive letter (e.g. c:) for a Windows one. The array-form counterpart of drive().
- Namespace
MMO\core\paths
| $path | array | a split path (splitFilename()) |
| $isWindows = MMO\core\paths\IS_WINDOWS | bool | |
| returns | string | false | false if $path isn't absolute (has no drive/leading empty segment) |
Call graph
Uses (1)
Used by (2)
basename
paths.php:448Extract the filename (last path segment) of a path -- almost the same as PHP's own \basename(), except that in $strict mode it returns false rather than the segment itself when that segment doesn't actually look like a "filename" (no extension, or a leading/trailing dot only -- e.g. a bare directory name, or a dotfile).
- Namespace
MMO\core\paths
| $path | string | |
| $removeExtension = false | bool | if true, the extension (and its '.') is stripped from the result |
| $strict = false | bool | if true, return false instead of the last segment when it has no real extension |
| returns | string | false |
Call graph
dirname
paths.php:478Extract the directory of a path (same as PHP's \dirname(), but normalizes \ to / first when $isWindows).
- Namespace
MMO\core\paths
drive
paths.php:396Get the "drive" of a path string: / for a unix path, or the drive letter (e.g. c:) for a Windows one.
- Namespace
MMO\core\paths
| $path | string | |
| $isWindows = MMO\core\paths\IS_WINDOWS | bool | if false, a c:-style prefix is NOT recognized as a drive at all |
| returns | string | false | false if $path isn't absolute |
Call graph
Uses (1)
Used by (2)
escape
paths.php:78Escape ~ and / inside a single path segment, so it can safely be joined with / without being mistaken for a path separator (RFC 6902 JSON Pointer escaping: ~ -> ~0, / -> ~1).
- Namespace
MMO\core\paths
Call graph
Used by (1)
extension
paths.php:466Extract the extension of a path (the part after the LAST '.' in its last segment), without the leading '.'.
- Namespace
MMO\core\paths
Call graph
Used by (1)
isAbsolute
paths.php:141Tells if a path is absolute (starts with '/'; for the split/array form, has at least 2 segments and an empty leading one, per split()'s '/' => ['', ''] convention).
- Namespace
MMO\core\paths
isAbsoluteFilename
paths.php:427Same as isAbsolute(), but for a real filename: also recognizes a Windows drive, and (for a string path) a URI authority (scheme://host/... or //host/...) as making the path absolute.
- Namespace
MMO\core\paths
| $path | array | string | |
| $isWindows = MMO\core\paths\IS_WINDOWS | bool | if $path is a string that doesn't actually look like a Windows path (isWindowsFilename()), this is forced to false regardless of what's passed |
| returns | bool |
isWindowsFilename
paths.php:329Heuristically tell if a path looks like a Windows path: either it uses \ and no / at all, or it starts with a valid drive letter immediately followed by a separator (or nothing else).
- Namespace
MMO\core\paths
Call graph
Uses (1)
join
paths.php:104Join an array of path segments (as produced by split()) back into a path string, escaping each segment.
- Namespace
MMO\core\paths
joinFilename
paths.php:365Same as join(), but converts every / to \ afterwards when $isWindows is true.
- Namespace
MMO\core\paths
Call graph
Uses (1)
matchMask
paths.php:31Try to match a path against a mask made of plain segments, {name:type} moustache templates (matchTemplate), and wildcards: * matches exactly one segment, ** matches any number of trailing segments (and must be the mask's last segment).
- Namespace
MMO\core\paths
| $mask | array | string | the mask to match against |
| $path | array | string | the path to test |
| $matches = null | null | array | |
| $schemas = null | null | array | the schemas to use to coerce/validate a template's :type |
| returns | int | true | true if $path matches. Else, the index of the first mask segment that failed to match. |
Call graph
Used by (2)
merge
paths.php:212Concatenate several paths (segment arrays or path strings) into one, dropping the trailing empty segment of a path when the next one continues it (so joining doesn't produce a doubled /), and skipping empty inputs.
- Namespace
MMO\core\paths
| ...$paths | array | string | |
| returns | array | the resulting segments (not joined into a string -- pass through join() for that) |
Call graph
Uses (1)
normalizeFilename
paths.php:343Replace every \ with /, turning a Windows-style path into a plain one split()/join() can handle.
- Namespace
MMO\core\paths
relative
paths.php:245Express $path relative to $root (both simplified first, so ../. in either are resolved).
- Namespace
MMO\core\paths
| $path | array | string | an absolute path |
| $root | array | string | an absolute path |
| $strict = false | bool | if true, $path MUST be a descendant of $root (no leading .. allowed in the result) -- returns false instead if it isn't |
| $join = true | bool | if true, return a joined string; if false, return the segments array |
| returns | array | string | false | false if $path shares no common ancestor with $root (or, in strict mode, isn't a descendant) |
Call graph
relativeFilename
paths.php:517Same as relative(), but drive-aware (via simplifyFilename() when $isWindows is true).
- Namespace
MMO\core\paths
| $path | array | string | |
| $root | array | string | |
| $strict = false | bool | relative() |
| $join = true | bool | if true, return a joined string; if false, return the segments array |
| $isWindows = MMO\core\paths\IS_WINDOWS | bool | |
| returns | array | string | false |
simplify
paths.php:160Simplify a path by resolving . and .. segments and dropping empty ones, without touching the filesystem (a leading .. past the root is dropped for an absolute path -- you can't go above / -- but is kept for a relative one, since there's nothing to resolve it against).
- Namespace
MMO\core\paths
| $path | array | string | |
| $join = true | bool | if true, return a joined string; if false, return the segments array |
| returns | array | string | the new path |
Call graph
simplifyFilename
paths.php:494Same as simplify(), but drive-aware: a Windows drive is protected from being simplified away (c:\.. stays c:\, it never turns into just \, since going "above" the drive doesn't mean anything).
- Namespace
MMO\core\paths
| $path | array | string | |
| $join = true | bool | if true, return a joined string; if false, return the segments array |
| $isWindows = MMO\core\paths\IS_WINDOWS | bool | |
| returns | array | string |
Call graph
split
paths.php:125Split a path string by / into segments, unescaping each one. The exact reverse of join().
- Namespace
MMO\core\paths
Call graph
Used by (23)
- delete
- push
- set
- walk
- aEntity::HiddenPath
- aEntity::isHiddenPath
- tArrayProperties::HiddenPath
- tArrayProperties::isHiddenPath
- RepositoryController::routePatch
- Query::loopRequiredCollection
- Path::addPath
- Path::set
- Path::setBasepath
- Path::setRelpath
- absolute
- matchMask
- merge
- relative
- simplify
- simplifyFilename
- splitFilename
- Schema::walkSchemaFor
- Validator::toError
splitFilename
paths.php:354Same as split(), but normalizes \ to / first when $isWindows is true.
- Namespace
MMO\core\paths
Call graph
unescape
paths.php:88Reverse of escape().
- Namespace
MMO\core\paths
validWindowsDrive
paths.php:411Tells if a string is a syntactically valid Windows drive designation (a name made of characters allowed in a Windows filename, followed by :).
- Namespace
MMO\core\paths