/** * Try to resolve the name of the service using the custom resolve closure. If a resolve function is not defined * then the {@link self::getDottedClassname()} method is used. * * @return string */ public function resolveClassname() { $resolver = $this->smd->getNameResolver(); if ($resolver && is_callable($resolver)) { return call_user_func_array($resolver, [$this]); } return $this->getDottedClassname(); }
/** * Search for the files in the directory passed as an argument. * * @param string $path The directory full of services * @param string $ns The namespace prefix */ protected function indexServicePath($path, $ns = null) { if (!is_null($ns)) { $ns_path = str_replace('\\', DIRECTORY_SEPARATOR, $ns); $path .= DIRECTORY_SEPARATOR . $ns_path; } $files = $this->listServiceFilesIn($path); foreach ($files as $key => $file) { $classname = $this->filenameToClassname($file, $ns); $this->throwIfClassNotExist($classname, $file); $this->smd->addClass($classname); } }