public function getAttributes(array $attribute_names = [], array $types = [])
    {
        $attribute_map = [];

        if (empty($attribute_names)) {
            $attribute_map = $this->attribute_map->getItems();
        } else {
            foreach ($attribute_names as $attribute_name) {
                $attribute_map[$attribute_name] = $this->getAttribute($attribute_name);
            }
        }

        if (!empty($types)) {
            $attribute_map = array_filter(
                $attribute_map,
                function ($attribute) use ($types) {
                    return in_array(get_class($attribute), $types);
                }
            );
        }

        return new AttributeMap($attribute_map);
    }