$ret = null; try { $ret = Loader\Module::pathBelongsTo($path2, $top); } catch (\Exception $e) { $success = false; } if ($success) { echo "Success! Identifier: {$ret}\n"; } else { echo "Failure...\n"; } echo " Retrieve Using Data (path3) -> "; $success = true; $ret = null; try { $ret = Loader\Module::pathBelongsTo($path3, $top); } catch (\Exception $e) { $success = false; } if ($success) { echo "Success! Identifier: {$ret}\n"; } else { echo "Failure...\n"; } echo " Get From Path (firstModule/subModule2) -> "; $success = true; unset($ret); $ret = null; try { $ret = Loader\Module::getFromModuleIdentityPath($top, 'firstModule/subModule2'); } catch (\Exception $e) {
/** * Given a particular existing path or identifier, determines if its tied to a Module * * This returns true if a given existing path is not tied to any Module. * * @param string|int $pathOrIdentifier * * @return boolean * */ public function isIndependent($pathOrIdentifier) { if ($this->isPath($pathOrIdentifier)) { $pathOrIdentifier = $this->getIdentifier($pathOrIdentifier); } if (!$this->isIdentifier($pathOrIdentifier)) { return false; } if (Loader\Module::pathBelongsTo($pathOrIdentifier, $this->libraries) == 'libraries/') { return true; } return false; }