| Server IP : 104.21.84.107 / Your IP : 104.23.197.209 Web Server : Apache/2.4.63 (Ubuntu) System : Linux adminpruebas-Virtual-Machine 6.14.0-37-generic #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 8.4.5 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/idiomas/libraries/vendor/joomla/language/src/ |
Upload File : |
<?php
/**
* Part of the Joomla Framework Language Package
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Language;
/**
* Registry of file parsers
*
* @since 2.0
*/
class ParserRegistry
{
/**
* A map of the registered parsers
*
* @var ParserInterface[]
* @since 2.0
*/
private $parserMap = [];
/**
* Register a parser, overridding a previously registered parser for the given type
*
* @param ParserInterface $parser The parser to registery
*
* @return void
*
* @since 2.0
*/
public function add(ParserInterface $parser): void
{
$this->parserMap[$parser->getType()] = $parser;
}
/**
* Get the parser for a given type
*
* @param string $type The parser type to retrieve
*
* @return ParserInterface
*
* @since 2.0
*/
public function get(string $type): ParserInterface
{
if (!$this->has($type)) {
throw new \InvalidArgumentException(sprintf('There is not a parser registered for the `%s` type.', $type));
}
return $this->parserMap[$type];
}
/**
* Check if a parser is registered for the given type
*
* @param string $type The parser type to check (typically the file extension)
*
* @return boolean
*
* @since 2.0
*/
public function has(string $type): bool
{
return isset($this->parserMap[$type]);
}
}