public static function find($collection, $id)
    {
        $id = intval($id);
        foreach ($collection as $entity) {
            if ($id === $entity->getId()) {
                return $entity;
            }
        }

        return null;
    }
public static function find($collection, $id)
    {
        $id = intval($id);
        foreach ($collection as $entity) {
            if ($id === $entity->getId()) {
                return $entity;
            }
        }

        return null;
    }
public static function find ( $ collection , $ id ) { $ id = intval ( $ id ) ; foreach ( $ collection as $ entity ) { if ( $ id === $ entity -> getId ( ) ) { return $ entity ; } } return null ; }
Find By Id

@param Collection|array $collection
@param int              $id

@return null|object
Find By Id