Pickle\Package\PHP\Command\Release\Windows\Binary::readPackage PHP Method

readPackage() protected method

protected readPackage ( $path )
    protected function readPackage($path)
    {
        $jsonLoader = new Package\Util\JSON\Loader(new Package\Util\Loader());
        $package = null;
        if (file_exists($path . DIRECTORY_SEPARATOR . 'composer.json')) {
            $package = $jsonLoader->load($path . DIRECTORY_SEPARATOR . 'composer.json');
        }
        if (null === $package && $this->noConvert) {
            throw new \RuntimeException('XML package are not supported. Please convert it before install');
        }
        if (null === $package) {
            try {
                $loader = new Package\PHP\Util\XML\Loader(new Package\Util\Loader());
                $pkgXml = new PackageXml($path);
                $pkgXml->dump();
                $jsonPath = $pkgXml->getJsonPath();
                $package = $jsonLoader->load($jsonPath);
            } catch (Exception $e) {
                /* pass for now, be compatible */
            }
        }
        if (null == $package) {
            /* Just ensure it's correct, */
            throw new \Exception("Couldn't read package info at '{$path}'");
        }
        $package->setRootDir(realpath($path));
        $this->composerJsonBak($package);
        /* For the binary release, json badly need the version informatio
           to show the meta info. If there's ever a binary release support
           for other platforms, this will need to be done, probably. */
        (new Header\Version($package))->updateJSON();
        return $package;
    }