private function methodChecker($parameters, $method)
    {
        if (!isset($parameters['pagetoken']))
        {
            switch ($method)
            {
                case 'nearbysearch':
                    if (!isset($parameters['location']))
                    {
                        throw new \Exception('You must specify a location before calling nearbysearch().');
                    }
                    elseif (isset($parameters['rankby']))
                    {
                        switch ($parameters['rankby'])
                        {
                            case 'distance':
                                if (!isset($parameters['keyword'])
                                    && !isset($parameters['name'])
                                    && !isset($parameters['types']))
                                {
                                    throw new \Exception('You much specify at least one of the following: "keyword", "name", "types".');
                                }

                                if (isset($parameters['radius']))
                                {
                                    unset($this->radius, $parameters['radius']);
                                }
                                break;

                            case 'prominence':
                                if (!isset($parameters['radius']))
                                {
                                    throw new \Exception('You must specify a radius.');
                                }
                                break;
                        }
                    }

                    break;

                case 'radarsearch':
                    if (!isset($parameters['location']))
                    {
                        throw new \Exception('You must specify a location before calling radarsearch().');
                    }
                    elseif (!isset($parameters['radius']))
                    {
                        throw new \Exception('You must specify a radius.');
                    }
                    elseif (empty($parameters['keyword'])
                        && empty($parameters['name'])
                        && empty($parameters['types']))
                    {
                        throw new \Exception('You much specify at least one of the following: "keyword", "name", "types".');
                    }

                    if (isset($parameters['rankby']))
                    {
                        unset($this->rankby, $parameters['rankby']);
                    }

                    break;

                case 'details':
                    if (!(isset($parameters['reference'])
                        ^ isset($parameters['placeid'])))
                    {
                        throw new \Exception('You must specify either a "placeid" or a "reference" (but not both) before calling details().');
                    }

                    if (isset($parameters['rankby']))
                    {
                        unset($this->rankby, $parameters['rankby']);
                    }

                    break;
            }
        }

        return $parameters;
    }
private function methodChecker($parameters, $method)
    {
        if (!isset($parameters['pagetoken']))
        {
            switch ($method)
            {
                case 'nearbysearch':
                    if (!isset($parameters['location']))
                    {
                        throw new \Exception('You must specify a location before calling nearbysearch().');
                    }
                    elseif (isset($parameters['rankby']))
                    {
                        switch ($parameters['rankby'])
                        {
                            case 'distance':
                                if (!isset($parameters['keyword'])
                                    && !isset($parameters['name'])
                                    && !isset($parameters['types']))
                                {
                                    throw new \Exception('You much specify at least one of the following: "keyword", "name", "types".');
                                }

                                if (isset($parameters['radius']))
                                {
                                    unset($this->radius, $parameters['radius']);
                                }
                                break;

                            case 'prominence':
                                if (!isset($parameters['radius']))
                                {
                                    throw new \Exception('You must specify a radius.');
                                }
                                break;
                        }
                    }

                    break;

                case 'radarsearch':
                    if (!isset($parameters['location']))
                    {
                        throw new \Exception('You must specify a location before calling radarsearch().');
                    }
                    elseif (!isset($parameters['radius']))
                    {
                        throw new \Exception('You must specify a radius.');
                    }
                    elseif (empty($parameters['keyword'])
                        && empty($parameters['name'])
                        && empty($parameters['types']))
                    {
                        throw new \Exception('You much specify at least one of the following: "keyword", "name", "types".');
                    }

                    if (isset($parameters['rankby']))
                    {
                        unset($this->rankby, $parameters['rankby']);
                    }

                    break;

                case 'details':
                    if (!(isset($parameters['reference'])
                        ^ isset($parameters['placeid'])))
                    {
                        throw new \Exception('You must specify either a "placeid" or a "reference" (but not both) before calling details().');
                    }

                    if (isset($parameters['rankby']))
                    {
                        unset($this->rankby, $parameters['rankby']);
                    }

                    break;
            }
        }

        return $parameters;
    }
private function methodChecker ( $ parameters , $ method ) { if ( ! isset ( $ parameters [ 'pagetoken' ] ) ) { switch ( $ method ) { case 'nearbysearch' : if ( ! isset ( $ parameters [ 'location' ] ) ) { throw new \ Exception ( 'You must specify a location before calling nearbysearch().' ) ; } elseif ( isset ( $ parameters [ 'rankby' ] ) ) { switch ( $ parameters [ 'rankby' ] ) { case 'distance' : if ( ! isset ( $ parameters [ 'keyword' ] ) && ! isset ( $ parameters [ 'name' ] ) && ! isset ( $ parameters [ 'types' ] ) ) { throw new \ Exception ( 'You much specify at least one of the following: "keyword", "name", "types".' ) ; } if ( isset ( $ parameters [ 'radius' ] ) ) { unset ( $ this -> radius , $ parameters [ 'radius' ] ) ; } break ; case 'prominence' : if ( ! isset ( $ parameters [ 'radius' ] ) ) { throw new \ Exception ( 'You must specify a radius.' ) ; } break ; } } break ; case 'radarsearch' : if ( ! isset ( $ parameters [ 'location' ] ) ) { throw new \ Exception ( 'You must specify a location before calling radarsearch().' ) ; } elseif ( ! isset ( $ parameters [ 'radius' ] ) ) { throw new \ Exception ( 'You must specify a radius.' ) ; } elseif ( empty ( $ parameters [ 'keyword' ] ) && empty ( $ parameters [ 'name' ] ) && empty ( $ parameters [ 'types' ] ) ) { throw new \ Exception ( 'You much specify at least one of the following: "keyword", "name", "types".' ) ; } if ( isset ( $ parameters [ 'rankby' ] ) ) { unset ( $ this -> rankby , $ parameters [ 'rankby' ] ) ; } break ; case 'details' : if ( ! ( isset ( $ parameters [ 'reference' ] ) ^ isset ( $ parameters [ 'placeid' ] ) ) ) { throw new \ Exception ( 'You must specify either a "placeid" or a "reference" (but not both) before calling details().' ) ; } if ( isset ( $ parameters [ 'rankby' ] ) ) { unset ( $ this -> rankby , $ parameters [ 'rankby' ] ) ; } break ; } } return $ parameters ; }
takes the parameters and method to throw exceptions or modify parameters as needed
@todo Method to sanity check passed types
takes the parameters and method to throw exceptions or modify parameters as needed