src/Core/Collection/AbstractNamedCollection.php
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;
    }
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;
    }
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 ; }
Get element by name

@param string $name
@param bool   $throwException

@throws Exception\CollectionException
@throws Exception\NotFoundException

@return Element\NamedElement|null
Get element by name