public static function toNamedArray(array $data, array $names)
    {
        $tmp = [];
        if (count($data) !== count($names)) {
            throw new \RuntimeException("data and names lengths do not match");
        }
        $i = 0;
        foreach ($names as $name) {
            if (!isset($data[$i])) {
                throw new \RuntimeException("data is not indexed form 0,1, ... Index $i is missing!");
            }
            $tmp[$name] = $data[$i];
            ++$i;
        }
        return $tmp;
    }