protected function clean(array $services = array())
{
if (empty($services)) {
return array();
}
if (!empty($this->config['allow'])) {
$allow = array_map('strtolower', (array) $this->config['allow']);
$services = array_filter($services, function ($arr) use($allow) {
$serviceName = strtolower(basename(str_replace('\\', '/', get_class($arr))));
return in_array($serviceName, $allow);
});
}
if (!empty($services) && !empty($this->config['deny'])) {
$deny = array_map('strtolower', (array) $this->config['deny']);
$services = array_filter($services, function ($arr) use($deny) {
$serviceName = strtolower(basename(str_replace('\\', '/', get_class($arr))));
return !in_array($serviceName, $deny);
});
}
return (array) $services;
}