On 24 February 2011 12:43, Richard Quadling <rquadl...@gmail.com> wrote:
> Hi.
>
> Brain being a little slow today.
>
> My objective is to enforce a parameter to a method to be an array of a
> specific class (or null).
>
> The specific class is LatLng.
>
> I want to be able to pass an array of LatLngs to a method.
>
> I know I can hint this as ...
>
> function(array $LatLngs) {...}
>
> and then in the array processing loop, use ...
>
> if ($element instanceof LatLng) {...}
>
> But I have a LOT of different types that can exist in arrays and I
> want to enforce the commonality of the type.
>
>
> I think I need a class of LatLngs and this has to implement an
> Traversable and ArrayAccess interfaces.
>
> But I'm not sure.
>
> Anyone got any clues / reading?
>
> Thanks.
>
> Richard.
>
> --
> Richard Quadling
> Twitter : EE : Zend
> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>

And it seems that ArrayObject is my start point.

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to