private function parameterBuilder($parameters)
    {
        foreach (get_object_vars($this) as $variable => $value)
        {
            // Except these variables
            if (!in_array($variable, $this->exceptions))
            {
                // Assuming it's not null
                if ($value !== null)
                {
                    // Converts boolean to string
                    if (is_bool($value))
                    {
                        $value = $value ? 'true' : 'false';
                    }

                    switch ($variable)
                    {
                        // Allows LatLng to be passed as an array
                        case 'location':
                            if (is_array($value))
                            {
                                // Just in case it's an associative array
                                $value = array_values($value);
                                $value = $value[0] . ',' . $value[1];
                            }
                            break;

                        // Checks that it's a value rank by value
                        case 'rankby':
                            $value = strtolower($value);

                            if (!in_array($value, array('prominence', 'distance')))
                            {
                                throw new \Exception('Invalid rank by value, please specify either "prominence" or "distance".');
                            }
                            break;

                        // Allows types to be passed as an array
                        case 'types':
                            if (is_array($value))
                            {
                                $value = implode('|', $value);
                            }
                            break;
                    }

                    $parameters[$variable] = $value;
                }
            }
        }
        return $parameters;
    }
private function parameterBuilder($parameters)
    {
        foreach (get_object_vars($this) as $variable => $value)
        {
            // Except these variables
            if (!in_array($variable, $this->exceptions))
            {
                // Assuming it's not null
                if ($value !== null)
                {
                    // Converts boolean to string
                    if (is_bool($value))
                    {
                        $value = $value ? 'true' : 'false';
                    }

                    switch ($variable)
                    {
                        // Allows LatLng to be passed as an array
                        case 'location':
                            if (is_array($value))
                            {
                                // Just in case it's an associative array
                                $value = array_values($value);
                                $value = $value[0] . ',' . $value[1];
                            }
                            break;

                        // Checks that it's a value rank by value
                        case 'rankby':
                            $value = strtolower($value);

                            if (!in_array($value, array('prominence', 'distance')))
                            {
                                throw new \Exception('Invalid rank by value, please specify either "prominence" or "distance".');
                            }
                            break;

                        // Allows types to be passed as an array
                        case 'types':
                            if (is_array($value))
                            {
                                $value = implode('|', $value);
                            }
                            break;
                    }

                    $parameters[$variable] = $value;
                }
            }
        }
        return $parameters;
    }
private function parameterBuilder ( $ parameters ) { foreach ( get_object_vars ( $ this ) as $ variable => $ value ) { // Except these variables if ( ! in_array ( $ variable , $ this -> exceptions ) ) { // Assuming it's not null if ( $ value !== null ) { // Converts boolean to string if ( is_bool ( $ value ) ) { $ value = $ value ? 'true' : 'false' ; } switch ( $ variable ) { // Allows LatLng to be passed as an array case 'location' : if ( is_array ( $ value ) ) { // Just in case it's an associative array $ value = array_values ( $ value ) ; $ value = $ value [ 0 ] . ',' . $ value [ 1 ] ; } break ; // Checks that it's a value rank by value case 'rankby' : $ value = strtolower ( $ value ) ; if ( ! in_array ( $ value , array ( 'prominence' , 'distance' ) ) ) { throw new \ Exception ( 'Invalid rank by value, please specify either "prominence" or "distance".' ) ; } break ; // Allows types to be passed as an array case 'types' : if ( is_array ( $ value ) ) { $ value = implode ( '|' , $ value ) ; } break ; } $ parameters [ $ variable ] = $ value ; } } } return $ parameters ; }
Loops through all of our variables to make a parameter list
Loops through all of our variables to make a parameter list