php-extension-check/src/Extension/ExtensionMap.php

70 wiersze
1.6 KiB
PHP
Czysty Zwykły widok Historia

2021-05-08 22:50:26 +00:00
<?php
namespace Fbrinker\ExtensionCheck\Extension;
class ExtensionMap
{
/** @var array<string,string> */
public $classes;
/** @var array<string,string> */
public $functions;
/** @var array<string,string> */
public $constants;
/** @var array<string,array<string,string[]>> */
public $dependencies;
/** @var string[] */
public $unchecked;
/**
* @param array<string,string> $classes
* @param array<string,string> $functions
* @param array<string,string> $constants
* @param array<string,array<string,string[]>> $dependencies
* @param string[] $unchecked
*/
public function __construct(
array $classes = [],
array $functions = [],
array $constants = [],
array $dependencies = [],
array $unchecked = []
) {
$this->classes = $classes;
$this->functions = $functions;
$this->constants = $constants;
$this->dependencies = $dependencies;
$this->unchecked = $unchecked;
}
2021-05-08 23:57:02 +00:00
public function checkClass(string $class): ?string
{
return $this->classes[$class] ?? null;
}
public function checkFunction(string $function): ?string
{
return $this->functions[$function] ?? null;
}
public function checkConstant(string $constant): ?string
{
return $this->constants[$constant] ?? null;
}
/**
* @return string[]
*/
public function checkRequiredDependency(string $extension): array
{
if (!isset($this->dependencies[$extension]['required'])) {
return [];
}
return $this->dependencies[$extension]['required'];
}
2021-05-08 22:50:26 +00:00
}