private function getData()

in src/hh-apidoc-extensions/PageSections/FrontMatter.php [27:75]


  private function getData(): YAMLMeta {
    $def = $this->definition;
    $data = shape(
      'name' => $def->getName(),
      'namespace' => $def->getNamespaceName(),
      'sources' => Vec\map(
        $this->documentable['sources'],
        $source ==> Str\strip_prefix($source, LocalConfig::ROOT.'/'),
      ),
    );

    $class = $this->parent;
    if ($class) {
      $data['class'] = $class->getName();
    } else if ($def is ScannedClassish) {
      $data['class'] = $def->getName();
    }

    $top_level_def = $class ?? $def;

    if (
      (
        $top_level_def->getNamespaceName() === "HH\\Lib" ||
        Str\starts_with($top_level_def->getNamespaceName(), "HH\\Lib\\")
      ) &&
      !C\any($data['sources'], $s ==> Str\starts_with($s, 'api-sources/hsl-experimental'))
    ) {
      $data['fbonly messages'] ??= vec[];
      $data['fbonly messages'][] = Str\format(
        '%s is available as `%s` in the www repository.',
        $class is nonnull ? 'The containing class' : 'This',
        Str\strip_prefix($top_level_def->getName(), 'HH\\Lib\\'),
      );
    } else if (
      C\any(
        $data['sources'],
        $s ==> Str\starts_with($s, 'api-sources/hsl-experimental/'),
      )
    ) {
      $data['lib'] = shape(
        'name' => 'the Hack Standard Library - Experimental Additions',
        'github' => 'hhvm/hsl-experimental',
        'composer' => 'hhvm/hsl-experimental',
      );
    }


    return $data;
  }