loadJSON($filename); self::$storage[$scopeName] = $grammar; return $grammar; } } return false; } /** * Retrieves whether a grammar exists in the registry or not. * * @param string $scopeName - The scope name (eg: text.html.php) of the grammar that is being requested * @return bool */ public static function has(string $scopeName): bool { $result = array_key_exists($scopeName, self::$storage); return $result ?: file_exists(__DIR__ . "/../data/$scopeName.json"); } /** * Sets a grammar in the registry. * * @param string $scopeName - The scope name (eg: text.html.php) of the grammar that is being set * @param MensBeam\Lit\Grammar - The grammar to be put into the registry */ public static function set(string $scopeName, Grammar $grammar) { self::$storage[$scopeName] = $grammar; } }