public function getByName($name, $throwException = true)
    {
        foreach ($this as $element) {

            if (!$element instanceof Element\NamedElement) {
                throw new Exception\CollectionException();
            }

            if ($element->getName() === $name) {
                return $element;
            }
        }

        if ($throwException) {
            throw new Exception\NotFoundException();
        }

        return null;
    }