src/Predef/ComposerPackagesOrderCompiler.php
private function getComposer($fileOrPackage) {
        if(isset($this->jsonCache[$fileOrPackage]))
            return $this->jsonCache[$fileOrPackage];

        if($file = $this->files[$fileOrPackage] ?? NULL) {
            return $this->getComposer($file);
        }

        if(is_dir($fileOrPackage))
            $fileOrPackage .= "/composer.json";

        if(is_file($fileOrPackage)) {
            $json = json_decode( file_get_contents($fileOrPackage), true );
            $name = $json["name"];
            $this->jsonCache[$name] = $json;
            $this->files[$name] = $fileOrPackage;
            return $json;
        }
        return NULL;
    }
private function getComposer($fileOrPackage) {
        if(isset($this->jsonCache[$fileOrPackage]))
            return $this->jsonCache[$fileOrPackage];

        if($file = $this->files[$fileOrPackage] ?? NULL) {
            return $this->getComposer($file);
        }

        if(is_dir($fileOrPackage))
            $fileOrPackage .= "/composer.json";

        if(is_file($fileOrPackage)) {
            $json = json_decode( file_get_contents($fileOrPackage), true );
            $name = $json["name"];
            $this->jsonCache[$name] = $json;
            $this->files[$name] = $fileOrPackage;
            return $json;
        }
        return NULL;
    }
Reads the composer.json file directly or from directory and adds it to cache.

@param $fileOrPackage
@return mixed|null