/**
* Returns the current class name, exclusively taking into account namespaces, e.g
* 'Swingline\Stapler' will become Swingline.
*
* @param Attachment $attachment
* @param string $styleName
* @return string
*/
protected function getNamespace(Attachment $attachment, $styleName = '')
{
$classComponents = explode('\\', $attachment->getInstanceClass());
return implode('/', array_slice($classComponents, 0, count($classComponents) - 1));
}