public function __construct()

in src/build/PHPDocsIndexReader.php [20:62]


  public function __construct(string $content) {
    $old_index = \json_decode($content);

    foreach ($old_index as $entry) {
      list($name, $id, $type) = $entry;
      if (!$type) {
        continue;
      }

      if ($type === 'example') {
        continue;
      }

      $name = \html_entity_decode($name);

      if ($type === 'phpdoc:classref') {
        $name = \explode('<', $name)[0]; // remove generics
        $this->classes[$name] = $id;
        continue;
      }

      if ($type === 'refentry') {
        $parts = (new Vector(\explode('::', $name)))
          ->map($x ==> \explode('<', $x)[0]);

        if (\count($parts) === 1) {
          $this->functions[$parts[0]] = $id;
          continue;
        }

        invariant(
          \count($parts) === 2,
          "Definition %s has %d parts",
          $name,
          \count($parts),
        );
        $this->methods[\implode('::', $parts)] = $id;
        continue;
      }

      $this->articles[$id] = $id;
    }
  }