public function load() { $composer = json_decode($this->filesystem->get('composer.json')->read(), true); if (!isset($composer['autoload']['psr-4']) || empty($composer['autoload']['psr-4'])) { throw new RuntimeException('Unable to detect namespace. Ensure you have PSR4 autoloading setup in your composer.json'); } $namespace = array_keys($composer['autoload']['psr-4'])[0]; $path = $composer['autoload']['psr-4'][$namespace]; $this->namespace = Utils::removeTrailingSlashes($namespace); $this->path = Utils::removeTrailingSlashes($path); }