Source of file AnnotateClassInfo.php
Size: 1,315 Bytes - Last Modified: 2021-12-23T10:24:49+00:00
/var/www/docs.ssmods.com/process/src/src/Helpers/AnnotateClassInfo.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 | <?php namespace SilverLeague\IDEAnnotator\Helpers; use ReflectionClass; use ReflectionException; use SilverStripe\Control\Director; use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Manifest\ModuleManifest; /** * Class AnnotateClassInfo * We will need this for phpDocumentor as well. */ class AnnotateClassInfo { /** * @var string */ protected $className = ''; /** * @var ReflectionClass */ protected $reflector; /** * AnnotateClassInfo constructor. * * @param $className * @throws ReflectionException */ public function __construct($className) { $this->className = $className; $this->reflector = new ReflectionClass($className); } /** * Where module name is a folder in the webroot. * * @return string */ public function getModuleName() { /** @var ModuleManifest $moduleManifest */ $moduleManifest = Injector::inst()->createWithArgs(ModuleManifest::class, [Director::baseFolder()]); $module = $moduleManifest->getModuleByPath($this->reflector->getFileName()); return $module->getName(); } /** * @return string */ public function getClassFilePath() { return $this->reflector->getFileName(); } } |