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.');
  }
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.');
  }
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.' ) ; }
Reads the root package's composer.json.

This will be the composer.json closest to the current working directory
that contains a dependency on Open Social.

@return JsonFile
File wrapper around the root package's composer.json.
Reads the root package s composer . json .