load composer.json file
return composer.json psr-4 setting
@throws AnnotationException
@return array
762416
protected function getComposePsrNamespaceList() : array {
        $jsonFilePath = $this->annotationConfig->getConfig()['composerFilePath'];
        if ( !file_exists($jsonFilePath)) throw new AnnotationException('Build Annotation error , composer.json file not found ' . $jsonFilePath);
        return json_decode(file_get_contents($jsonFilePath) , true);
    }
1299765
protected function loadClassAnnotations()
    {
        if (empty($this->targetClass)) {
            throw new \RuntimeException("Runtime Error: Any class was defined as target to annotations handling.");
        }

        $annotationsObjects = array();
        $this->annotations['_class_'] = $this->getClassAnnotationsObjects($this->targetClass);
    }
933236
protected function setComposerJson() {
    if (file_exists($this->getConfigValue('repo.root') . '/composer.json')) {
      $composer_json = json_decode(file_get_contents($this->getConfigValue('repo.root') . '/composer.json'), TRUE);
      $this->composerJson = $composer_json;

      return $composer_json;
    }

    return [];
  }
903703
public static function getComposerJsonDecoded(string $path = null): array
    {
        $path     = $path ?? self::getProjectRootDirectory() . '/composer.json';
        $contents = (string)\file_get_contents($path);
        if ('' === $contents) {
            throw new \RuntimeException('composer.json is empty');
        }
        $decoded = \json_decode($contents, true);
        if (JSON_ERROR_NONE !== \json_last_error()) {
            throw new \RuntimeException('Failed loading composer.json: ' . \json_last_error_msg());
        }

        return $decoded;
    }
230877
protected function loadJsonParameters()
    {
        $reflectionObject = new \ReflectionObject($this);
        $componentFile    = $reflectionObject->getFileName();
        $parameterFile    = dirname($componentFile).DIRECTORY_SEPARATOR.pathinfo(
                $componentFile,
                PATHINFO_FILENAME
            ).'.json';
        if (is_readable($parameterFile)) {
            $jsonParameters = file_get_contents($parameterFile);
            if (strlen($jsonParameters)) {
                $jsonParameterObj = @json_decode($jsonParameters);
                if ($jsonParameterObj && is_object($jsonParameterObj)) {
                    foreach ($jsonParameterObj as $name => $value) {
                        $this->setParameter($name, $value);
                    }
                }
            }
        }
    }
1209814
protected function getJson()
    {
        if ($this->json) {
            return $this->json;
        }
        $composer = Util::joinPaths($this->getPath(), 'composer.json');
        $file = new JsonFile($composer);
        $this->json = $file->read();
        return $this->json;
    }
165576
private static function getBaseNamespace()
    {
        // try to determine the namespace of the
        $composerFile = PSX_PATH_SRC . '/../composer.json';
        $composer = \json_decode(\file_get_contents($composerFile), true);

        if (isset($composer['autoload'])) {
            $paths = $composer['autoload']['psr-4'] ?? [];
            $base  = trim(key($paths), '\\');

            if (!empty($base)) {
                return $base;
            }
        }

        throw new \RuntimeException('Could not determine the base namespace');
    }
1196140
public function getLocalPackages() {
		$composer = $this->getComposer();
		$dispatcher = new EventDispatcher($composer, $this->io);
		$autoloadGenerator = new \Composer\Autoload\AutoloadGenerator($dispatcher);
		
		if ($this->selfEdit) {
			chdir(__DIR__."/../../..");
			\putenv('COMPOSER=composer-mouf.json');
		} else {
			chdir(__DIR__."/../../../../../..");
		}
		//TODO: this call is strange because it will return the same isntance as above.
		$composer = $this->getComposer();
				
		$localRepos = new CompositeRepository(array($composer->getRepositoryManager()->getLocalRepository()));
		$package = $composer->getPackage();
		$packagesList = $localRepos->getPackages();
		$packagesList[] = $package;
		
		return $packagesList;
	}
345625
public static function fromPackageFile($composerJson)
    {
        if (file_exists($composerJson) === false) {
            throw new ComposerJsonNotFoundException("File {$composerJson} not found.");
        }

        $config = Config::load($composerJson);
        $autoload = $config->get('autoload.psr-4');

        $composerJsonDirectory = dirname($composerJson);

        $keys = array_keys($autoload);
        $namespace = array_shift($keys);

        $values = array_values($autoload);
        $namespaceDirectory = array_shift($values);
        $namespaceDirectory = realpath($composerJsonDirectory . '/' . $namespaceDirectory);

        return new self($namespace, $namespaceDirectory);
    }
1071577
protected static function getRootPackage() {
    $file = new JsonFile('composer.json');

    // Split the current working directory into an array, accounting for leading
    // and trailing directory separators.
    $dir = explode(DIRECTORY_SEPARATOR, trim(getcwd(), DIRECTORY_SEPARATOR));

    do {
      if ($file->exists()) {
        $info = $file->read();

        if (isset($info['require']['goalgorilla/open_social'])) {
          return $file;
        }
      }
      chdir('..');
      array_pop($dir);
    }
    while ($dir);

    throw new \RuntimeException('Could not locate the root package.');
  }
866338
protected function loadComposerData($composerFile)
    {
        if (!is_readable($composerFile))
        {
            throw new ExceptionPackageInfo('Could not read composer data.');
        }

        $this->composerJson = json_decode(file_get_contents($composerFile), true);
    }
717839
public function findExtensions(): Extensions
    {
        $extensions = new Extensions();


        foreach ($this->configRepository->getPaths() as $path) {
            $composerPattern = $this->configRepository->getRootPath() . '/' . $path . '/composer.json';

            $composerFiles = $this->filesystem->glob($composerPattern);



            if ($composerFiles === false) {
                throw new ExtensionException('Error occurs when looking for extensions in the [' . $composerPattern . '] path.');
            }

            foreach ($composerFiles as $composerFile) {
                $package = $this->extensionFactory->getComposerPackage($composerFile);

                if (!in_array($package->getType(), self::$validTypes, true)) {
                    continue;
                }

                $extension = $this->extensionFactory->create($composerFile);

                if (!$this->extensionValidator->isValid($extension)) {
                    throw new ExtensionException('The extension [' . $extension->getPackage()->getName() . '] is not valid.');
                }

                $extensions->push($extension);
            }
        }

        return $extensions;
    }
378584
public function createFromComposerJson($composer)
    {
        $sections = $this->getAutoloadSectionNames($composer);

        if (empty($sections)) {
            return array();
        }

        $validators = array();
        foreach ($sections as $section) {
            $validators[] = $this->createValidatorsFromSection($section, $composer[$section]);
        }

        return call_user_func_array('array_merge', $validators);
    }
805249
private function initializeRepos()
    {
        $composer = $this->getComposer(false);

        if ($composer) {
            return array(
                $composer->getRepositoryManager()->getLocalRepository(),
                new CompositeRepository($composer->getRepositoryManager()->getRepositories())
            );
        }

        $defaultRepos = Factory::createDefaultRepositories($this->getIO());

        return array(new CompositeRepository($defaultRepos));
    }
208620
public function load()
    {
        if (self::$json === null) {
            self::$json = array();
            if (!empty($this->extSettings['json'])) {
                $file = MaskUtility::getFileAbsFileName($this->extSettings['json']);
                if (file_exists($file)) {
                    self::$json = json_decode(file_get_contents($file), true);
                }
            }
        }
        return self::$json;
    }
492786
public static function getComposerJsonFileAndManipulator(): array
    {
        $json        = new JsonFile(Factory::getComposerFile());
        $manipulator = new JsonManipulator(\file_get_contents($json->getPath()));

        return [$json, $manipulator];
    }
152710
public function getAnnotationArray() {
		// lazy instantiation of the annotations array
		if (empty($this->annotations)) {
			// custom parser?
			if (self::$parser) {
				$parser = new self::$parser($this->docs);
				$this->annotations = $parser->getAnnotationArray();
			}
			// use built in parser
			else
				$this->parse();
		}
		return $this->annotations;
	}