Retrieves the manifest file from package file.

@return array|string
@throws \DreamFactory\Core\Exceptions\InternalServerErrorException
@throws \DreamFactory\Core\Exceptions\BadRequestException
545849
protected function getManifestFromZipFile()
    {
        $this->zip = new \ZipArchive();
        if (true !== $this->zip->open($this->zipFile)) {
            throw new InternalServerErrorException('Failed to open imported zip file.');
        }

        $password = $this->getPassword();
        if (!empty($password)) {
            $this->zip->setPassword($password);
        }

        $manifest = $this->zip->getFromName('package.json');
        if (false === $manifest) {
            throw new BadRequestException('Cannot read package manifest. A valid password is required if this is a secured package.');
        }
        $manifest = DataFormatter::jsonToArray($manifest);

        return $manifest;
    }
514031
public function loadManifest()
	{
		// The service manifest is a file containing a JSON representation of every
		// service provided by the application and whether its provider is using
		// deferred loading or should be eagerly loaded on each request to us.
		if ($this->files->exists($this->manifestPath))
		{
			$manifest = json_decode($this->files->get($this->manifestPath), true);

			return array_merge(['when' => []], $manifest);
		}
	}
467942
public function getPackages()
    {
        $filename = $this->vendorPath . '/composer/installed.json';
        if (!file_exists($filename)) {
            throw new Exception($filename . ' not exists!');
        }
        $packages = [];
        foreach (json_decode(file_get_contents($filename), true) as $package) {
            if ($package['type'] === 'teamelf-extension') {
                $packages[] = $package;
            }
        }
        return $packages;
    }
152819
protected function getPackageDir() {
		
		$baseDir    = realpath(getcwd()).DIRECTORY_SEPARATOR;
		$configDir  = (is_dir($baseDir."_config")) ? "_config" : "config";
		$configFile = $baseDir.$configDir.DIRECTORY_SEPARATOR."config.yml";
		
		if (file_exists($configFile)) {
			$configData = file_get_contents($configFile);
			preg_match("/packagesDir:([ ]+)?([\"'])?([A-z0-9-]{1,})([\"'])?([ ]+)?/",$configData,$matches);
			$packageDir = (isset($matches[3])) ? $matches[3] : "packages"; // provide an expected default just in case
		} else {
			$packageDir = "vendor";
		}
		
		return $packageDir;
		
	}
1339044
protected function getWebpackAssets()
    {
        $assets = public_path('builds/manifest.json');
        $assets = file_get_contents($assets);
        $assets = json_decode($assets, true);

        return $assets;
    }
232919
public function getManifestContents()
    {
        $manifest = $this->getManifestPath();
        if ($this->files->has($manifest)) {
            return $this->files->read($manifest);
        }
    }
760195
public function loadManifest()
    {
        if ($this->files->exists($this->manifestPath)) {
            $manifest = $this->files->getRequire($this->manifestPath);

            if ($manifest) {
                return array_merge(['when' => []], $manifest);
            }
        }
    }
1123389
protected function getFile()
    {
        $file = new SplFileObject($this->reflection->getFileName());

        $file->seek($this->reflection->getStartLine() - 1);

        return $file;
    }
1174467
public function files()
    {
        $files = Collection::make($this->disk->allFiles($this->path))->filter(function ($file) {
            return $this->disk->extension($file) == 'php';
        });

        $filesByFile = $files->groupBy(function ($file) {
            $fileName = $file->getBasename('.'.$file->getExtension());

            if (Str::contains($file->getPath(), 'vendor')) {
                $fileName = str_replace('.php', '', $file->getFileName());

                $packageName = basename(dirname($file->getPath()));

                return "{$packageName}::{$fileName}";
            } else {
                return $fileName;
            }
        })->map(function ($files) {
            return $files->keyBy(function ($file) {
                return basename($file->getPath());
            })->map(function ($file) {
                return $file->getRealPath();
            });
        });

        // If the path does not contain "vendor" then we're looking at the
        // main language files of the application, in this case we will
        // neglect all vendor files.
        if (! Str::contains($this->path, 'vendor')) {
            $filesByFile = $this->neglectVendorFiles($filesByFile);
        }

        return $filesByFile;
    }
571989
public function getSupportedPackages()
    {
        try {
            return $this->getSupportedAddonsLoader()->getAddonNames() ?: [];
        } catch (RuntimeException $exception) {
            echo $exception->getMessage() . PHP_EOL;
        }

        return null;
    }
970014
public function getMigrationsFiles()
    {
        $files = [];
        foreach ($this->orm->getComponents(true) as $component) {
            if ($component instanceof AppInterface) {
                $fileHandler = FileHandler::createObject(
                    [
                        'path' => $component->getMigrationsPath(),
                    ]
                );

                $files[$component->getName()] = $fileHandler->getPathFiles();
            }
        }

        return $files;
    }
236048
protected function getFiles()
    {
        $this->mirrorDir();
        $this->prepareMirrorDir();
        $this->printTaskInfo('Retrieving files to package.');
        $mirrorFinder = new Finder();
        $mirrorFinder->ignoreDotFiles(false);
        $add = [];
        $mirrorFinder
            ->in($this->tmpDir)
            ->depth(0);
        foreach ($mirrorFinder as $file) {
            $add[substr($file->getRealPath(), strlen(realpath($this->tmpDir)) + 1)] = $file->getRealPath();
        }
        return $add;
    }
550684
public static function getLicenseFile()

    {
        if (!isset(self::$file)) {
            $path = Grav::instance()['locator']->findResource('user-data://') . '/licenses.yaml';
            if (!file_exists($path)) {
                touch($path);
            }
            self::$file = CompiledYamlFile::instance($path);
        }

        return self::$file;
    }
633229
public function getCommands()
    {
        $name     = $this->getController()->getIdentifier()->name;
        $package  = $this->getIdentifier()->package;
        $manifest = JPATH_ADMINISTRATOR.'/components/com_'.$package.'/'.$package.'.xml';

        if(file_exists($manifest))
        {
            $xml = simplexml_load_file($manifest);

            if(isset($xml->administration->submenu))
            {
                foreach($xml->administration->submenu->children() as $menu)
                {
                    $view = (string)$menu['view'];

                    $this->addCommand((string)$menu, array(
                        'href'   => 'option=com_'.$package.'&view='.$view,
                        'active' => ($name == KStringInflector::singularize($view))
                    ));
                }
            }
        }

        return parent::getCommands();
    }
636550
public function getFile()
    {
        if (!$this->hasGetParameter('uri')) {
            throw new \common_exception_Error('invalid media identifier');
        }
        $uri = urldecode($this->getGetParameter('uri'));

        $mediaSource = new MediaSource(array());
        $fileInfo = $mediaSource->getFileInfo($uri);

        $fileManagement = $this->getServiceLocator()->get(FileManagement::SERVICE_ID);
        $stream = $fileManagement->getFileStream($fileInfo['link']);
        if ($fileInfo['mime'] === 'application/qti+xml') {
            $this->response = $this->getPsrResponse()->withBody($stream);
        } elseif ($this->hasGetParameter('xml')) {
            $this->returnJson(htmlentities((string)$stream));
        } else {
            $this->setContentHeader($fileInfo['mime']);
            $this->response = $this->getPsrResponse()->withBody($stream);
        }
    }
1318166
protected function loadManifest()
    {
        $manifestPath = Paths::assets('manifest.json');

        if (file_exists($manifestPath))
        {
            return json_decode(file_get_contents($manifestPath), true);
        }

        return null;
    }
1048337
protected function findPackage()
    {
        if ($this->package !== null) {
            return;
        }

        $file = $this->getFile();

        $parts = explode(DIRECTORY_SEPARATOR, $file);

        $key = array_search('src', array_reverse($parts, true), true);
        if ($key === false) {
            $this->package = new \stdClass();
            return;
        }

        $composerFile = implode(DIRECTORY_SEPARATOR, array_slice($parts, 0, $key)).DIRECTORY_SEPARATOR.'composer.json';
        if (!file_exists($composerFile)) {
            $this->package = new \stdClass();
            return;
        }

        $composerContent = file_get_contents($composerFile);
        if ($composerContent === false) {
            $this->package = new \stdClass();
            return;
        }

        $this->package = json_decode($composerContent);
        if ($this->package === null) {
            $this->package = new \stdClass();
        }
    }