<commit_before><?php
declare(strict_types = 1);

namespace LanguageServer;

use PhpParser\{Error, Comment, Node, ParserFactory, NodeTraverser, Lexer};
use PhpParser\PrettyPrinter\Standard as PrettyPrinter;
use PhpParser\NodeVisitor\NameResolver;

class Project
{
    /**
     * An associative array [string => PhpDocument]
     * that maps URIs to loaded PhpDocuments
     *
     * @var PhpDocument[]
     */
    private $documents = [];

    /**
     * An associative array [string => PhpDocument]
     * that maps fully qualified symbol names to loaded PhpDocuments
     *
     * @var PhpDocument[]
     */
    private $definitions = [];

    /**
     * Instance of the PHP parser
     *
     * @var ParserAbstract
     */
    private $parser;

    /**
     * Reference to the language server client interface
     *
     * @var LanguageClient
     */
    private $client;

    public function __construct(LanguageClient $client)
    {
        $this->client = $client;

        $lexer = new Lexer(['usedAttributes' => ['comments', 'startLine', 'endLine', 'startFilePos', 'endFilePos']]);
        $this->parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7, $lexer, ['throwOnError' => false]);
    }

    /**
     * Returns the document indicated by uri. Instantiates a new document if none exists.
     *
     * @param string $uri
     * @return LanguageServer\PhpDocument
     */
    public function getDocument(string $uri)
    {
        $uri = urldecode($uri);
        if (!isset($this->documents[$uri])) {
            $this->documents[$uri] = new PhpDocument($uri, $this, $this->client, $this->parser);
        }
        return $this->documents[$uri];
    }

    /**
     * Adds a document as the container for a specific symbol
     *
     * @param string $fqn The fully qualified name of the symbol
     * @return void
     */
    public function addDefinitionDocument(string $fqn, PhpDocument $document)
    {<commit_msg>Don't %-decode the document URI<commit_after><?php
declare(strict_types = 1);

namespace LanguageServer;

use PhpParser\{Error, Comment, Node, ParserFactory, NodeTraverser, Lexer};
use PhpParser\PrettyPrinter\Standard as PrettyPrinter;
use PhpParser\NodeVisitor\NameResolver;

class Project
{
    /**
     * An associative array [string => PhpDocument]
     * that maps URIs to loaded PhpDocuments
     *
     * @var PhpDocument[]
     */
    private $documents = [];

    /**
     * An associative array [string => PhpDocument]
     * that maps fully qualified symbol names to loaded PhpDocuments
     *
     * @var PhpDocument[]
     */
    private $definitions = [];

    /**
     * Instance of the PHP parser
     *
     * @var ParserAbstract
     */
    private $parser;

    /**
     * Reference to the language server client interface
     *
     * @var LanguageClient
     */
    private $client;

    public function __construct(LanguageClient $client)
    {
        $this->client = $client;

        $lexer = new Lexer(['usedAttributes' => ['comments', 'startLine', 'endLine', 'startFilePos', 'endFilePos']]);
        $this->parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7, $lexer, ['throwOnError' => false]);
    }

    /**
     * Returns the document indicated by uri. Instantiates a new document if none exists.
     *
     * @param string $uri
     * @return LanguageServer\PhpDocument
     */
    public function getDocument(string $uri)
    {
        if (!isset($this->documents[$uri])) {
            $this->documents[$uri] = new PhpDocument($uri, $this, $this->client, $this->parser);
        }
        return $this->documents[$uri];
    }

    /**
     * Adds a document as the container for a specific symbol
     *
     * @param string $fqn The fully qualified name of the symbol
     * @return void
     */
    public function addDefinitionDocument(string $fqn, PhpDocument $document)
    {
{'fraction_non_alphanumeric': 0.12073422957600827, 'fraction_numerical': 0.001034126163391934, 'mean_word_length': 2.681255946717412, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2706380', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1095, 'n_words': 312}