private static function extractOnly(array $parsed, array $params)
{
$result = [];
foreach ($params as $key) {
if (array_key_exists($key, $parsed)) {
$result[$key] = $parsed[$key];
continue;
}
throw new \ErrorException('Key "' . $key . '" do not exists in array');
}
return $result;
}