![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/laminas/laminas-config/src/ |
<?php namespace Laminas\Config; use Psr\Container\ContainerInterface; use function array_keys; use function array_values; use function class_exists; use function in_array; use function sprintf; use function strtolower; class StandaloneReaderPluginManager implements ContainerInterface { /** @var array<string, class-string> */ private $knownPlugins = [ 'ini' => Reader\Ini::class, 'json' => Reader\Json::class, 'xml' => Reader\Xml::class, 'yaml' => Reader\Yaml::class, 'javaproperties' => Reader\JavaProperties::class, ]; /** * @param string $plugin * @return bool */ public function has($plugin) { if (in_array($plugin, array_values($this->knownPlugins), true)) { return true; } return in_array(strtolower($plugin), array_keys($this->knownPlugins), true); } /** * @param string $plugin * @return Reader\ReaderInterface * @throws Exception\PluginNotFoundException */ public function get($plugin) { if (! $this->has($plugin)) { throw new Exception\PluginNotFoundException(sprintf( 'Config reader plugin by name %s not found', $plugin )); } if (! class_exists($plugin)) { $plugin = $this->knownPlugins[strtolower($plugin)]; } return new $plugin(); } }