private function validate(ModuleInterface $module) { foreach ($module->dependencies() as $name => $version) { if (!$this->has($name)) { throw new Exception\ModuleDependencyRequred(['name' => $name, 'dependant' => $module->name()]); } $version = new Version\SemVer($version); if (!$version->is($this->get($name)->version())) { throw new Exception\ModuleVersionRequired(['name' => $name, 'version' => $this->get($name)->version(), 'requiredVersion' => $version, 'dependant' => $module->name()]); } } }
private function validate(ModuleInterface $module) { foreach ($module->dependencies() as $name => $version) { if (!$this->has($name)) { Exception::toss('The module "%s" is required by the module "%s".', $name, $module->name()); } $version = new SemVer($version); if (!$version->is($this->get($name)->version())) { Exception::toss('The module "%s", currently at version "%s", is required to be at version "%s" by the module "%s".', $name, $this->get($name)->version(), $version, $module->name()); } } }