$success = false; } if ($success) { echo "Success! Identifier: {$ret->getIdentifier()}\n"; } else { echo "Failure...\n"; } unset($ret); echo " Add To Module Identity Path (path5, subModule4) -- \n"; $success = true; $granchild2 = null; try { echo " Instantiate subModule4 -> "; $grandchild2 = new Loader\Module('path/to/last/module', 'subModule4'); echo "Success!\n"; echo " Add to Path (firstModule/subModule2) -> "; Loader\Module::addToModuleIdentityPath($top, 'firstModule/subModule2', $grandchild2, $grandchild2->getIdentifier()); } catch (\Exception $e) { $success = false; } if ($success) { echo "Success!\n\n"; } else { echo "Failure...\n\n"; } $paths = Loader\Module::getModuleIdentityPaths($top); echo "Identity Paths: \n"; foreach ($paths as $path) { echo " {$path}\n"; } echo "\n";
/** * Takes a Module path that's allegedly in the library, and adds * the given Module there * * @param string $modulePath The path to the Module (not the associated path) * @param Falcraft\Data\Components\File\Resource\DirectoryInterface $module The Module to add * */ public function addModule($modulePath, ModuleInterface $module) { $branch = Loader\Module::addToModuleIdentityPath($this->libraries, $modulePath, $module); }