public function getAttributes($names = null) {
        $attributes = parent::getAttributes($names);
        if (is_array($names)) {
            $flags = $this->cachedFlags();
            $flagNames = array_intersect(array_keys($flags), $names);
            foreach ($flagNames as $name) {
                $attributes[$name] = $this->getFlag($flags[$name]);
            }
        }
        return $attributes;
    }