SplClassInfo::getFileInfo

Gets class file info metadata.

@return \O2System\Spl\Info\SplNamespaceInfo
354502
public function getNamespaceInfo()
    {
        if (empty($this->name)) {
            throw new \RuntimeException('Internal error: SplClassInfo failed to retrieve the reflection object');
        }

        return new SplNamespaceInfo($this->name, $this->getFileName());
    }
355261
function classDisplayInfo()
    {
        $classAttribute = $this->contentClassAttribute();
        if ( !$classAttribute->DisplayInfo )
        {
            $dataType = $this->dataType();
            if ( $dataType )
            {
                $classAttribute->DisplayInfo = $dataType->classDisplayInformation( $classAttribute, false );
            }
        }
        return $classAttribute->DisplayInfo;
    }
164620
public function getFileInfo()
    {
        $upload = new eZContentUpload();
        $errors = array();
        $mimeData = $file = '';
        $result = $upload->fetchHTTPFile( 'UploadFile', $errors, $file, $mimeData );

        if ( $result === false )
        {
            throw new RuntimeException(
                ezpI18n::tr(
                    'extension/ezjscore/ajaxuploader',
                    'Unable to retrieve the uploaded file: %message',
                    null, array( '%message' => $errors[0]['description'] )
                )
            );
        }
        return array(
            'file' => $file,
            'mime' => $mimeData
        );
    }
118233
public function getFileInfo()
    {
        $fullName = str_replace('source/','',$this->fullName);
        return [
            "msg"    => $this->stateInfo,
            "code" => $this->stateInfo == "SUCCESS" ? 0 : $this->stateInfo,
            "data"=>[
                "src"=>$this->imgDomain.$fullName,
                'title'=>$fullName,
            ],
            "type"     => $this->fileType,
            "size"     => $this->fileSize
        ];
    }
1047802
public function getPrivateFile() : ?\SplFileInfo
    {
        $path = self::PRIVATE_ABSOLUTE_PATH . $this->destination . $this->privateFileName;

        if (!$this->privateFileName || !file_exists($path))
        {
            return NULL;
        }

        return new \SplFileInfo($path);
    }
1192760
public function getFiles()
    {
        if (empty($this->files)) {
            foreach ($this->path as $path) {
                if (is_dir($path)) {
                    $this->files = array_merge($this->files, $this->getFilesFromDir($path));
                } elseif (is_file($path)) {
                    $this->files[$path] = new SplFileInfo($path, $path, $path);
                }
            }
        }

        return $this->files;
    }
385685
public function getFileInfo()
    {
        $prefix = str_replace(yii::getAlias(yii::getAlias('@frontend/web')), '', yii::getAlias('@ueditor'));
        return array(
            "state" => $this->stateInfo,
            "url" => $prefix . $this->fullName,
            "title" => $this->fileName,
            "original" => $this->oriName,
            "type" => $this->fileType,
            "size" => $this->fileSize
        );
    }
989129
public function getInfo($class, $action)
    {
        $action_doc = [];
        if($class && class_exists($class)){
            $reflection = new \ReflectionClass($class);
            $doc_str = $reflection->getDocComment();
            $doc = new DocParser();
            $class_doc = $doc->parse($doc_str);
            $class_doc['header'] = isset($class_doc['header'])? $class_doc['header'] : [];
            $class_doc['param'] = isset($class_doc['param']) ? $class_doc['param'] : [];
            if($reflection->hasMethod($action)) {
                $method = $reflection->getMethod($action);
                $doc = new DocParser();
                $action_doc = $doc->parse($method->getDocComment());
                $action_doc['name'] = $class."::".$method->name;
                $action_doc['header'] = isset($action_doc['header']) ? array_merge($class_doc['header'], $action_doc['header']) : $class_doc['header'];
                $action_doc['param'] = isset($action_doc['param']) ? array_merge($class_doc['param'], $action_doc['param']) : $class_doc['param'];
            }
        }
        return $action_doc;
    }
994610
public function getObjectInfo()
	{
		$info	= array(
			'name'		=> $this->getClass(),
			'parent'	=> $this->getParent(),
			'methods'	=> $this->getMethods(),
			'vars'		=> $this->getVars(),
		);
		return $info;
	}
1113978
private function getReflectionClassFromFile(SplFileInfo $file)
    {
        $namespace = null;
        if (preg_match('#^namespace\s+(.+?);$#sm', $file->getContents(), $matches)) {
            $namespace = $matches[1];
        }

        $controller = null;
        if ($namespace) {
            $name = substr($file->getRelativePathname(), 0, -4);
            $controller = sprintf('%s\\%s', $namespace, $name);
        }

        if ($controller) {
            return new \ReflectionClass($controller);
        }

        throw new RuntimeException(sprintf('File "%s" is not contain any class.', $file->getFilename()));
    }
46838
public function getTypeObject()
    {
        $app = Application::getFacadeApplication();
        $fh = $app->make('helper/file');
        $ext = $fh->getExtension($this->fvFilename);
        $ftl = FileTypeList::getType($ext);

        return $ftl;
    }
990981
public function getDescription(): string
    {
        $fileName = pathinfo($this->getFilePath(), PATHINFO_FILENAME);
        $testName = $fileName;

        if ($testName[0] === '_') {
            $testName = substr($testName, 1);
        }
        if (strtoupper($testName) === 'README') {
            $testName = basename(dirname($this->getFilePath())) . ': Readme';
        }

        return sprintf(
            '%s "%s"',
            $this->getType(),
            str_replace(
                '  ',
                ' ',
                ucwords(
                    ltrim(strtolower(preg_replace('/[A-Z]/', ' $0', $testName)))
                )
            )
        );
    }
5596
final public static function getEditionInfo():\stdClass
    {
        $file = JL::open(FEnv::get("framework.config.core.config.file"));
        JL::close(FEnv::get("framework.config.core.config.file"));
        self::$edition = $file;
        return ($file);
    }
525085
public function getFileClassNamespace($file)
    {
        $filenameBlock = explode(DIRECTORY_SEPARATOR, $file);
        $filename = explode('.', end($filenameBlock), 2);
        $filename = reset($filename);

        preg_match('/\snamespace\s+(.+?);/s', file_get_contents($file), $match);

        return    is_array($match) && isset($match[1])
                ? $match[1] . '\\' . $filename
                : false;
    }
1082672
protected function getModuleClassName(SplFileInfo $fileInfo)
    {
        $name = str_replace('.php', '', $fileInfo->getBasename());

        $path = trim(str_replace(
            app_path(),
            '',
            dirname($fileInfo->getPathname())
        ), DIRECTORY_SEPARATOR);

        $location = str_replace('/', '\\', $path);

        return app()->getNamespace()."{$location}\\{$name}";
    }
132373
protected function getSystemMemoryInfo()
    {
        $meminfo = array();

        if (file_exists(static::MEMINFO_PATH)) {
            $data = explode("\n", file_get_contents(static::MEMINFO_PATH));
            $meminfo = array();
            foreach ($data as $line) {
                if (!empty($line)) {
                    list($key, $val) = explode(":", $line);

                    $meminfo[$key] = intval($val);
                }
            }
        }

        return $meminfo;
    }
414798
function info()
    {
        if (empty($this->_info)){
            $file = $this->getDir().'/'.$this->file;
            if (is_file($file) && ($info = getimagesize($file))){
                $ext = array(1 => 'gif', 2 => 'jpg', 3 => 'png', 4 => 'swf', 5 => 'psd', 6 => 'bmp', 7 => 'tiff', 8 => 'tiff',
                       9 => 'jpc', 10 => 'jp2', 11 => 'jpx', 12 => 'jb2', 13 => 'swc', 14 => 'iff', 15 => 'wbmp', 16 => 'xbmp'
                );
                $this->_info = array(
                    'width' => $info[0],
                    'height' => $info[1],
                    'ext' => $ext[$info[2]],
                    'quality' => 100
                );
                if (empty($this->_convert)) $this->_convert = $ext[$info[2]];
            }
        }
        return $this->_info;
    }