src/Sulu/Bundle/ContactBundle/Contact/AbstractContactManager.php
private function hasMain($arrayCollection, &$mainEntity = null)
    {
        if ($arrayCollection && !$arrayCollection->isEmpty()) {
            return $arrayCollection->exists(
                function($index, $entity) {
                    $mainEntity = $entity;

                    return true === $entity->getMain();
                }
            );
        }

        return false;
    }
private function hasMain($arrayCollection, &$mainEntity = null)
    {
        if ($arrayCollection && !$arrayCollection->isEmpty()) {
            return $arrayCollection->exists(
                function($index, $entity) {
                    $mainEntity = $entity;

                    return true === $entity->getMain();
                }
            );
        }

        return false;
    }
private function hasMain ( $ arrayCollection , & $ mainEntity = null ) { if ( $ arrayCollection && ! $ arrayCollection -> isEmpty ( ) ) { return $ arrayCollection -> exists ( function ( $ index , $ entity ) { $ mainEntity = $ entity ; return true === $ entity -> getMain ( ) ; } ) ; } return false ; }
checks if a collection for main attribute.

@param $arrayCollection
@param $mainEntity will be set, if found

@return mixed
checks if a collection for main attribute .