public function render(StreetViewControl $streetViewControl)
    {
        return $this->jsonBuilder
            ->reset()
            ->setValue(
                '[position]',
                $this->controlPositionHelper->render($streetViewControl->getControlPosition()),
                false
            )
            ->build();
    }

public function render ( StreetViewControl $ streetViewControl ) { return $ this -> jsonBuilder -> reset ( ) -> setValue ( '[position]' , $ this -> controlPositionHelper -> render ( $ streetViewControl -> getControlPosition ( ) ) , false ) -> build ( ) ; }

Renders the street view control

@param Ivory\GoogleMapBundle\Model\Controls\StreetViewControl $streetViewControl
@return string HTML output


public function normalize($value, bool $compress = false)
    {
        if (is_array($value) || is_object($value)) {
            foreach ($value as $_key => &$_value) {
                $_value = $this->normalize($_value, $compress);
            } // unset($_key, $_value);
            return $value;
        }
        if (!($string = (string) $value)) {
            return $string; // Nothing to do.
        }
        $string = str_replace(["\r\n", "\r"], "\n", $string);
        $string = $compress ? preg_replace('/'."\n".'{3,}/u', "\n\n", $string) : $string;

        return $string;
    }

public
function
normalize
(
$
value
,
bool
$
compress
=
false
)
{
if
(
is_array
(
$
value
)
||
is_object
(
$
value
)
)
{
foreach
(
$
value
as
$
_key
=>
&
$
_value
)
{
$
_value
=
$
this
->
normalize
(
$
_value
,
$
compress
)
;
}
// unset($_key, $_value);
return
$
value
;
}
if
(
!
(
$
string
=
(
string
)
$
value
)
)
{
return
$
string
;
// Nothing to do.
}
$
string
=
str_replace
(
[
"\r\n"
,
"\r"
]
,
"\n"
,
$
string
)
;
$
string
=
$
compress
preg_replace
(
'/'
.
"\n"
.
'{3,}/u'
,
"\n\n"
,
$
string
)
:
$
string
;
return
$
string
;
}

Normalizes end of line chars deeply.

@since 150424 Initial release.

@param mixed $value    Any input value.
@param bool  $compress Compress `\n{3,}` into `\n\n`?

@return string|array|object With normalized end of line chars deeply.


public function in(string $regex, $value, bool $collect_key_props = false)
    {
        if (!$regex) { // Empty regex?
            return $collect_key_props ? [] : false;
        }
        $matching_key_props = []; // Initialize.

        if (is_array($value) || is_object($value)) {
            foreach ($value as $_key_prop => $_value) {
                if (is_array($_value) || is_object($_value)) {
                    if (($_matching_key_props = $this->in($regex, $_value, $collect_key_props))) {
                        if ($collect_key_props) {
                            $matching_key_props[] = [$_key_prop => $_matching_key_props];
                        } else {
                            return true;
                        }
                    }
                } else {
                    $_value = (string) $_value;
                    if (preg_match($regex, $_value)) {
                        if ($collect_key_props) {
                            $matching_key_props[] = $_key_prop;
                        } else {
                            return true;
                        }
                    }
                }
            } // unset($_key_prop, $_value, $_matching_key_props);
        } elseif (!$collect_key_props) {
            $value = (string) $value;
            if (preg_match($regex, $value)) {
                return true;
            }
        }
        return $collect_key_props ? $matching_key_props : false;
    }

Match a regex pattern against other values.

@since 150424 Initial release.

@param string $regex             A regular expression.
@param mixed  $value             Any value can be converted into a string before comparison.
Actually, objects can't, but this recurses into objects.
@param bool   $collect_key_props Collect array keys and/or object properties?

@return bool|array Will return `true` if regex pattern finds a match.
If `$collect_key_props` is `true`; returns array.

Match a regex pattern against other values .


public function normalize($value, bool $compress = false)
    {
        if (is_array($value) || is_object($value)) {
            foreach ($value as $_key => &$_value) {
                $_value = $this->normalize($_value, $compress);
            } // unset($_key, $_value);
            return $this->c::normalizeEols($value, $compress);
        }
        if (!($string = (string) $value)) {
            return $string; // Nothing to do.
        }
        if (($whitespace = &$this->cacheKey(__FUNCTION__.'_whitespace')) === null) {
            $whitespace = implode('|', $this::HTML_WHITESPACE);
        }
        if ($compress) { // NOTE: This is the only task at the moment. It could change in the future.
            $string = preg_replace('/('.$whitespace.')('.$whitespace.')('.$whitespace.')+/u', '${1}${2}', $string);
        }
        return $this->c::normalizeEols($string, $compress);
    }

Normalizes HTML whitespace deeply.

@since 150424 Initial release.

@param mixed $value    Any input value.
@param bool  $compress Compress `\n{3,}` into 2?

@return string|array|object With normalized HTML whitespace deeply.


public function bracketSpecialChars($value, bool $will_force_match_all = false)
    {
        if (is_array($value) || is_object($value)) {
            foreach ($value as $_key => &$_value) {
                $_value = $this->bracketSpecialChars($_value, $will_force_match_all);
            } // unset($_key, $_value); // Housekeeping.
            return $value;
        }
        if (!($string = (string) $value)) {
            return $string; // Empty.
        }
        if (!$will_force_match_all) {
            $string = preg_replace('/[*?[\]!{},\^$]/u', '[${0}]', $string);
        } else { // `^` and `$` are not special characters.
            $string = preg_replace('/[*?[\]!{},]/u', '[${0}]', $string);
        }
        return $string;
    }

Bracket special chars.

@since 170124.74961 New name. Old name `bracket()`.
@since 170124.74961 Adding `$will_force_match_all` param.

@param mixed $value                Input value(s) to bracket here.
@param bool  $will_force_match_all If true, don't treat `^$` as special chars.

@return string|array|object Bracketed value(s).


public function urlToUriPattern($value, bool $will_force_match_all = false)
    {
        // Note: We must allow for `0` here.
        // It will parse as `[path => '0']`, which is valid.

        if (is_array($value) || is_object($value)) {
            foreach ($value as $_key => &$_value) {
                $_value = $this->urlToUriPattern($_value, $will_force_match_all);
            } // unset($_key, $_value); // Housekeeping.
            return $value;
        }
        $url_uri_qsl = (string) $value; // Force string.

        if (!isset($url_uri_qsl[0])) {
            return ''; // Not possible.
        } elseif (!($parts = $this->c::parseUrl($url_uri_qsl))) {
            return ''; // Not possible.
        }
        $uri_no_fragment     = $parts['uri_no_fragment'] ?? '';
        $uri_no_fragment_lts = $uri_no_fragment ? $this->c::mbTrim($uri_no_fragment, '/') : $uri_no_fragment;
        $uri_pattern         = $uri_no_fragment_lts ? $this->bracketSpecialChars($uri_no_fragment_lts, $will_force_match_all) : $uri_no_fragment_lts;

        if (!isset($uri_pattern[0])) { // Treat as root URI.
            return '{/**,}'; // Any path [/endpoints] & query string.
            //
        } elseif (mb_strpos($uri_pattern, '[?]') !== false) {
            $uri_pattern        = preg_replace('/(^|[^\/])\[\?\]/u', '${1}{/**,}[?]', $uri_pattern);
            $uri_pattern        = preg_replace('/&/u', '{&**&,&}', $this->c::mbRTrim($uri_pattern, '&'));
            $uri_pattern        = preg_replace('/\[\?\]/u', '[?]{**&,}', $uri_pattern); // After `&` replacements.

            if (mb_strpos($uri_pattern, '{/**,}') === 0) {
                return $uri_pattern = $uri_pattern.'{&**,}'; // Any path [/endpoints] w/ the query string.
            } else {
                return $uri_pattern = '/'.$uri_pattern.'{&**,}'; // Specific path [/endpoints] w/ the query string.
            }
        } else {
            return $uri_pattern = '/'.$uri_pattern.'{/**,}'; // Specific path [/endpoints] & query string.
        }
    }

URL to WRegx URI pattern.

@since 160428 Watered-down regex.
@since 170124.74961 Adding `$will_force_match_all` param.
@since 170124.74961 Fixing bug in query string wildcard pattern.

@param mixed $value                Input value(s) containing:
URLs, URIs, or query strings w/ a leading `?`.
@param bool  $will_force_match_all If true, don't treat `^$` as special chars.

@return string WRegx URI pattern, else an empty string if unable to parse.

- This considers all possible `/endpoints` after the base.
Including the possibility of there being `index.php/path/info/`.

- If a URI contains multiple query string variables,
the best we can do is `{&**&,&}` (searching in the order given).

- In the case of a root URI or empty path, this returns a pattern
matching any path [/endpoints] & query string; i.e., matches all URIs.
This will also be true if only a query string is given. Path is empty.


public function setWidthUnit($widthUnit)
    {
        if (!is_string($widthUnit) && ($widthUnit !== null)) {
            throw BaseException::invalidSizeWidthUnit();
        }

        $this->widthUnit = $widthUnit;
    }

public function setWidthUnit ( $ widthUnit ) { if ( ! is_string ( $ widthUnit ) && ( $ widthUnit !== null ) ) { throw BaseException :: invalidSizeWidthUnit ( ) ; } $ this -> widthUnit = $ widthUnit ; }

Sets the width unit size.

@param string $widthUnit The width unit size.

@throws \Ivory\GoogleMap\Exception\BaseException If the width unit is not valid.


public function setHeightUnit($heightUnit)
    {
        if (!is_string($heightUnit) && ($heightUnit !== null)) {
            throw BaseException::invalidSizeHeightUnit();
        }

        $this->heightUnit = $heightUnit;
    }

public function setHeightUnit ( $ heightUnit ) { if ( ! is_string ( $ heightUnit ) && ( $ heightUnit !== null ) ) { throw BaseException :: invalidSizeHeightUnit ( ) ; } $ this -> heightUnit = $ heightUnit ; }

Sets the height unit size.

@param string $heightUnit The height unit size.

@throws \Ivory\GoogleMap\Exception\BaseException If the height unit is not valid.


public function keygen(): string
    {
        try { // Catch Defuse exceptions.
            if (!($key = Key::createNewRandomKey()->saveToAsciiSafeString())) {
                throw new Exception('Defuse keygen failure.');
            }
        } catch (\Throwable $Exception) {
            throw $this->c::issue($Exception->getMessage());
        }
        return $key;
    }

public
function
keygen
(
)
:
string
{
try
{
// Catch Defuse exceptions.
if
(
!
(
$
key
=
Key
::
createNewRandomKey
(
)
->
saveToAsciiSafeString
(
)
)
)
{
throw
new
Exception
(
'Defuse keygen failure.'
)
;
}
}
catch
(
\
Throwable
$
Exception
)
{
throw
$
this
->
c
::
issue
(
$
Exception
->
getMessage
(
)
)
;
}
return
$
key
;
}

Defuse keygen.

@since 170309.60830 Defuse.

@return string Defuse key.
@note Keys begin w/ `def00000`.


public function is($value): bool
    {
        if (!$value) {
            return false;
        } elseif (!is_string($value)) {
            return false;
        } elseif (strlen($value) !== 64) {
            return false;
        } elseif (!ctype_xdigit($value)) {
            return false;
        }
        return true;
    }

public function is ( $ value ) : bool { if ( ! $ value ) { return false ; } elseif ( ! is_string ( $ value ) ) { return false ; } elseif ( strlen ( $ value ) !== 64 ) { return false ; } elseif ( ! ctype_xdigit ( $ value ) ) { return false ; } return true ; }

Is a SHA-256 hash?

@since 17xxxx SHA-1 utils.

@param mixed $value Value.

@return bool True if a SHA-256 hash.


public function strip(string $url_uri_qsl): string
    {
        if (!$qs_url_uri) {
            return $qs_url_uri; // Possible `0`.
        }
        if (mb_strpos($url_uri_qsl, '?') !== false) {
            $url_uri_qsl = mb_strstr($url_uri_qsl, '?', true);
        }
        return $url_uri_qsl;
    }

public
function
strip
(
string
$
url_uri_qsl
)
:
string
{
if
(
!
$
qs_url_uri
)
{
return
$
qs_url_uri
;
// Possible `0`.
}
if
(
mb_strpos
(
$
url_uri_qsl
,
'?'
)
!==
false
)
{
$
url_uri_qsl
=
mb_strstr
(
$
url_uri_qsl
,
'?'
,
true
)
;
}
return
$
url_uri_qsl
;
}

Stripe query string.

@since 150424 Initial release.

@param string $url_uri_qsl Input URL, URI, or query string w/ a leading `?`.

@return string Input `$url_uri_qsl` without a query string.


public function parse(string $qs_url_uri): array
    {
        $qs = $this->string($qs_url_uri);

        parse_str($qs, $args); // Possible `0`.
        // Note that `0` becomes `[0 => '']`.

        return $args;
    }

public
function
parse
(
string
$
qs_url_uri
)
:
array
{
$
qs
=
$
this
->
string
(
$
qs_url_uri
)
;
parse_str
(
$
qs
,
$
args
)
;
// Possible `0`.
// Note that `0` becomes `[0 => '']`.
return
$
args
;
}

Array from query vars.

@since 150424 Initial release.

@param string $qs_url_uri A query string (w/ or w/o a leading `?`), a URL, or URI.

@return array An array of args; based on the `$qs_url_uri` value.


public function build(array $args, string $numeric_prefix = '', string $arg_separator = '&', int $enc_type = PHP_QUERY_RFC1738): string
    {
        if (!isset($arg_separator[0])) {
            $arg_separator = ini_get('arg_separator.output');
        }
        $query = http_build_query($args, $numeric_prefix, $arg_separator, $enc_type);
        $query = $this->c::mbTrim(str_replace('=&', '&', $query), '=&');

        return $query;
    }

public function build ( array $ args , string $ numeric_prefix = '' , string $ arg_separator = '&' , int $ enc_type = PHP_QUERY_RFC1738 ) : string { if ( ! isset ( $ arg_separator [ 0 ] ) ) { $ arg_separator = ini_get ( 'arg_separator.output' ) ; } $ query = http_build_query ( $ args , $ numeric_prefix , $ arg_separator , $ enc_type ) ; $ query = $ this -> c :: mbTrim ( str_replace ( '=&' , '&' , $ query ) , '=&' ) ; return $ query ; }

Build a URL-encoded query string.

@since 150424 Initial release.

@param array       $args           Input array of query args.
@param null|string $numeric_prefix Defaults to an empty string.
@param string      $arg_separator  Defaults to `&`. Empty = INI `arg_separator.output`.
@param int         $enc_type       Defaults to {@link PHP_QUERY_RFC1738} indicating `urlencode()`.
Or, {@link PHP_QUERY_RFC3986} indicating `rawurlencode()`.

@return string A (possibly raw) URL-encoded query string (w/o a leading `?`).


public function addSha256Sig(string $url_uri_qsl, string $key = '', string $sig_var = ''): string
    {
        $sig_var     = $sig_var ?: $this::DEFAULT_SIG_VAR;
        $sig         = $this->sha256Sig($url_uri_qsl, $key, $sig_var);
        $url_uri_qsl = $this->addArgs([$sig_var => $sig], $url_uri_qsl);

        return $url_uri_qsl;
    }

public function addSha256Sig ( string $ url_uri_qsl , string $ key = '' , string $ sig_var = '' ) : string { $ sig_var = $ sig_var ? : $ this :: DEFAULT_SIG_VAR ; $ sig = $ this -> sha256Sig ( $ url_uri_qsl , $ key , $ sig_var ) ; $ url_uri_qsl = $ this -> addArgs ( [ $ sig_var => $ sig ] , $ url_uri_qsl ) ; return $ url_uri_qsl ; }

Adds a signature.

@since 150424 Initial release.

@param string $url_uri_qsl Input URL, URI, or query string w/ a leading `?`.
@param string $key         Encryption key (optional).
@param string $sig_var     Defaults to `sig`.

@return string The `$url_uri_qsl` w/ a signature var.


public function removeSha256Sig(string $url_uri_qsl, string $sig_var = ''): string
    {
        $sig_var     = $sig_var ?: $this::DEFAULT_SIG_VAR;
        $url_uri_qsl = $this->removeArgs([$sig_var], $url_uri_qsl);

        return $url_uri_qsl;
    }

public function removeSha256Sig ( string $ url_uri_qsl , string $ sig_var = '' ) : string { $ sig_var = $ sig_var ? : $ this :: DEFAULT_SIG_VAR ; $ url_uri_qsl = $ this -> removeArgs ( [ $ sig_var ] , $ url_uri_qsl ) ; return $ url_uri_qsl ; }

Removes a signature.

@since 150424 Initial release.

@param string $url_uri_qsl Input URL, URI, or query string w/ a leading `?`.
@param string $sig_var     Defaults to `sig`.

@return string The `$url_uri_qsl` w/o a signature.


public function sha256SigOk(string $qs_url_uri, string $key = '', string $sig_var = ''): bool
    {
        $sig_var = $sig_var ?: $this::DEFAULT_SIG_VAR;
        $args    = $this->parse($qs_url_uri);
        $sig     = $this->sha256Sig($qs_url_uri, $key, $sig_var);

        return !empty($args[$sig_var]) && $args[$sig_var] === $sig;
    }

public function sha256SigOk ( string $ qs_url_uri , string $ key = '' , string $ sig_var = '' ) : bool { $ sig_var = $ sig_var ? : $ this :: DEFAULT_SIG_VAR ; $ args = $ this -> parse ( $ qs_url_uri ) ; $ sig = $ this -> sha256Sig ( $ qs_url_uri , $ key , $ sig_var ) ; return ! empty ( $ args [ $ sig_var ] ) && $ args [ $ sig_var ] === $ sig ; }

Checks a signature.

@since 150424 Initial release.

@param string $qs_url_uri A query string (w/ or w/o a leading `?`), a URL, or URI.
@param string $key        Encryption key (optional).
@param string $sig_var    Defaults to `sig`.

@return bool True if a valid signature exists.


public function setCoordinates(array $coordinates)
    {
        switch (strtolower($this->type)) {
            case 'circle':
                if ((count($coordinates) === 3)
                    && is_numeric($coordinates[0])
                    && is_numeric($coordinates[1])
                    && is_numeric($coordinates[2])
                ) {
                    $this->coordinates = $coordinates;
                } else {
                    throw OverlayException::invalidMarkerShapeCircleCoordinates();
                }
                break;
            case 'poly':
                if ((count($coordinates) <= 0) || ((count($coordinates) % 2) !== 0)) {
                    throw OverlayException::invalidMarkerShapePolyCoordinates();
                }

                foreach ($coordinates as $coordinate) {
                    if (!is_numeric($coordinate)) {
                        throw OverlayException::invalidMarkerShapePolyCoordinates();
                    }
                }

                $this->coordinates = $coordinates;
                break;
            case 'rect':
                if ((count($coordinates) === 4)
                    && is_numeric($coordinates[0])
                    && is_numeric($coordinates[1])
                    && is_numeric($coordinates[2])
                    && is_numeric($coordinates[3])
                ) {
                    $this->coordinates = $coordinates;
                } else {
                    throw OverlayException::invalidMarkerShapeRectCoordinates();
                }
                break;
        }
    }

public function setCoordinates ( array $ coordinates ) { switch ( strtolower ( $ this -> type ) ) { case 'circle' : if ( ( count ( $ coordinates ) === 3 ) && is_numeric ( $ coordinates [ 0 ] ) && is_numeric ( $ coordinates [ 1 ] ) && is_numeric ( $ coordinates [ 2 ] ) ) { $ this -> coordinates = $ coordinates ; } else { throw OverlayException :: invalidMarkerShapeCircleCoordinates ( ) ; } break ; case 'poly' : if ( ( count ( $ coordinates ) <= 0 ) || ( ( count ( $ coordinates ) % 2 ) !== 0 ) ) { throw OverlayException :: invalidMarkerShapePolyCoordinates ( ) ; } foreach ( $ coordinates as $ coordinate ) { if ( ! is_numeric ( $ coordinate ) ) { throw OverlayException :: invalidMarkerShapePolyCoordinates ( ) ; } } $ this -> coordinates = $ coordinates ; break ; case 'rect' : if ( ( count ( $ coordinates ) === 4 ) && is_numeric ( $ coordinates [ 0 ] ) && is_numeric ( $ coordinates [ 1 ] ) && is_numeric ( $ coordinates [ 2 ] ) && is_numeric ( $ coordinates [ 3 ] ) ) { $ this -> coordinates = $ coordinates ; } else { throw OverlayException :: invalidMarkerShapeRectCoordinates ( ) ; } break ; } }

Sets the marker shape coordinates.

@param array $coordinates The marker shape coordinates.

@throws \Ivory\GoogleMap\Exception\OverlayException If the coordinates are not valid according to the type.


public function addPolyCoordinate($x, $y)
    {
        if ($this->type !== 'poly') {
            throw OverlayException::invalidMarkerShapeAddPolyCoordinateCall();
        }

        if (!is_numeric($x) || !is_numeric($y)) {
            throw OverlayException::invalidMarkerShapePolyCoordinate();
        }

        $this->coordinates[] = $x;
        $this->coordinates[] = $y;
    }

public function addPolyCoordinate ( $ x , $ y ) { if ( $ this -> type !== 'poly' ) { throw OverlayException :: invalidMarkerShapeAddPolyCoordinateCall ( ) ; } if ( ! is_numeric ( $ x ) || ! is_numeric ( $ y ) ) { throw OverlayException :: invalidMarkerShapePolyCoordinate ( ) ; } $ this -> coordinates [ ] = $ x ; $ this -> coordinates [ ] = $ y ; }

Adds a coordinate to the marker shape if the type is poly.

@param integer $x The X coordinate.
@param integer $y The Y coordinate.

@throws \Ivory\GoogleMap\Exception\OverlayException If the type is not poly or if the poly coordinate is not
valid.

Adds a coordinate to the marker shape if the type is poly .


public function customer($args)
    {
        if (is_string($args)) {
            $args = ['customer' => $args];
        } // Convert customer ID into args.

        $default_args = [
            'api_key'  => '', // Stripe API key.
            'customer' => '', // Existing customer ID.

            // Everything else is for a new customer, or for an update.
            // i.e., If `update_existing=true`, customer is updated to this info.
            // ~ Anything that is not passed in will not be changed in any way.
            'update_existing' => false, // Update if exists?

            'ip'    => '', // New customer IP address.
            'email' => '', // New customer email address.

            'fname' => '', // New customer first name.
            'lname' => '', // New customer last name.

            'source'            => '', // New customer source.
            'is_default_source' => true, // Is the default source?
            'description'       => '', // New customer description.

            'user_id'  => '', // New customer user ID.
            'metadata' => '', // New customer metadata.
        ];
        $args = (array) $args; // Force array.
        $args = array_merge($default_args, $args);
        $args = array_intersect_key($args, $default_args);
        extract($this->parseArgs(__FUNCTION__, $args));

        if (!$args['description']) { // Full name.
            $args['description'] = $this->c::mbTrim($args['fname'].' '.$args['lname']);
        }
        $Customer = null; // Initialize.

        if ($args['customer']) {
            try { // Acquire customer by ID.
                $Customer = Customer::retrieve($args['customer'], $opts);
            } catch (\Throwable $Exception) {
                return $this->exceptionError($Exception);
            }
            if ($Customer instanceof Customer && $args['update_existing']) {
                $Customer = $this->updateCustomer($args, $Customer);
            }
        } else { // Create a new customer.
            try {
                $new_customer_args = [
                    'email'       => $args['email'] ?: null,
                    'source'      => $args['source'] ?: null,
                    'description' => $args['description'] ?: null,

                    'metadata' => array_merge([
                        'ip'    => $args['ip'],
                        'email' => $args['email'],

                        'fname' => $args['fname'],
                        'lname' => $args['lname'],

                        'user_id' => $args['user_id'],
                    ], $args['metadata']),
                ];
                $new_customer_args = $this->c::removeNulls($new_customer_args);
                $Customer          = Customer::create($new_customer_args, $opts);
            } catch (\Throwable $Exception) {
                return $this->exceptionError($Exception);
            }
        }
        if (!($Customer instanceof Customer)) {
            $_error = sprintf('Failed to acquire customer.');
            return $this->exceptionError(new Exception($_error));
        }
        return $Customer;
    }

Get, update, or create customer.

@since 170329.13807 Stripe utils.

@param string|array $args ID or args.

@return Customer|Error Customer on success.


public function updateCustomer(array $args, Customer $Customer = null)
    {
        $default_args = [
            'api_key'  => '', // Stripe API key.
            'customer' => '', // Existing customer ID.

            // Everything else is optional (for update).
            // Anything not passed in will not be changed.

            'ip'    => '', // New IP address for customer.
            'email' => '', // New email address for customer.

            'fname' => '', // New first name for customer.
            'lname' => '', // New last name for customer.

            'source'            => '', // New source for customer.
            'is_default_source' => true, // Is the default source?
            'description'       => '', // New description for customer.

            'user_id'  => '', // New user ID for customer.
            'metadata' => '', // New metadata for customer.
        ];
        $args = (array) $args; // Force array.
        $args = array_merge($default_args, $args);
        $args = array_intersect_key($args, $default_args);
        extract($this->parseArgs(__FUNCTION__, $args));

        if (!$Customer && $args['customer']) {
            $Customer = $this->customer($args['customer']);
        }
        if (!($Customer instanceof Customer)) {
            $_error = sprintf('Failed to acquire customer for update.');
            return $this->exceptionError(new Exception($_error));
        }
        try { // Update.
            if ($args['email']) {
                $Customer->email = $args['email'];
            }
            if ($args['source']) {
                $Customer->source = $args['source'];

                if ($args['is_default_source']) {
                    $Customer->default_source = $args['source'];
                } // Update customer's default source.
            }
            if ($args['description']) {
                $Customer->description = $args['description'];
            }
            if ($args['ip']) {
                $Customer->metadata->ip = $args['ip'];
            }
            if ($args['email']) {
                $Customer->metadata->email = $args['email'];
            }
            if ($args['fname']) {
                $Customer->metadata->fname = $args['fname'];
            }
            if ($args['lname']) {
                $Customer->metadata->lname = $args['lname'];
            }
            if ($args['user_id']) {
                $Customer->metadata->user_id = $args['user_id'];
            }
            if ($args['metadata']) {
                foreach ($args['metadata'] as $_key => $_value) {
                    $Customer->metadata->{$_key} = $_value;
                } // unset($_key, $_value);
            }
            $Customer->save();
        } catch (\Throwable $Exception) {
            return $this->exceptionError($Exception);
        }
        return $Customer;
    }

Update existing customer.

@since 170329.13807 Stripe utils.

@param array         $args     Arguments.
@param Customer|null $Customer Instance (optional).

@return Customer|Error Customer on success.


protected function unitAmount(float $amount, string $currency): int
    {
        switch (mb_strtoupper($currency)) {
            case 'BIF':
            case 'DJF':
            case 'JPY':
            case 'KRW':
            case 'PYG':
            case 'VND':
            case 'XAF':
            case 'XPF':
            case 'CLP':
            case 'GNF':
            case 'KMF':
            case 'MGA':
            case 'RWF':
            case 'VUV':
            case 'XOF':
                return (int) $amount;

            default: // In cents.
                return (int) ($amount * 100);
        }
    }

protected
function
unitAmount
(
float
$
amount
,
string
$
currency
)
:
int
{
switch
(
mb_strtoupper
(
$
currency
)
)
{
case
'BIF'
:
case
'DJF'
:
case
'JPY'
:
case
'KRW'
:
case
'PYG'
:
case
'VND'
:
case
'XAF'
:
case
'XPF'
:
case
'CLP'
:
case
'GNF'
:
case
'KMF'
:
case
'MGA'
:
case
'RWF'
:
case
'VUV'
:
case
'XOF'
:
return
(
int
)
$
amount
;
default
:
// In cents.
return
(
int
)
(
$
amount
*
100
)
;
}
}

Smallest currency unit.

@since 170329.13807 Stripe utils.

@param float  $amount   Amount.
@param string $currency Currency code.

@return int Amount represented as an integer (always).

@see Units explained here <http://jas.xyz/2meM1pO>


public function getScopeEntityByIdentifier($identifier)
    {
        if (!empty($this::SCOPES[$identifier])) {
            return $this->App->Di->get(ScopeEntity::class, ['identifier' => $identifier]);
        }
    }

public function getScopeEntityByIdentifier ( $ identifier ) { if ( ! empty ( $ this :: SCOPES [ $ identifier ] ) ) { return $ this -> App -> Di -> get ( ScopeEntity :: class , [ 'identifier' => $ identifier ] ) ; } }

Get scope entity.

@since 17xxxx OAuth scope repository.

@param string $identifier Identifier.

@return ScopeEntity|null Scope entity.


public function render(ScaleControl $scaleControl)
    {
        return $this->jsonBuilder
            ->reset()
            ->setValue('[position]', $this->controlPositionHelper->render($scaleControl->getControlPosition()), false)
            ->setValue('[style]', $this->scaleControlStyleHelper->render($scaleControl->getScaleControlStyle()), false)
            ->build();
    }

public function render ( ScaleControl $ scaleControl ) { return $ this -> jsonBuilder -> reset ( ) -> setValue ( '[position]' , $ this -> controlPositionHelper -> render ( $ scaleControl -> getControlPosition ( ) ) , false ) -> setValue ( '[style]' , $ this -> scaleControlStyleHelper -> render ( $ scaleControl -> getScaleControlStyle ( ) ) , false ) -> build ( ) ; }

Renders a scale control.

@param \Ivory\GoogleMap\Controls\ScaleControl $scaleControl The scale control.

@return string The JS output.


protected function generateUrl(GeocoderRequest $geocoderRequest)
    {
        $httpQuery = array();

        if ($geocoderRequest->hasAddress()) {
            $httpQuery['address'] = $geocoderRequest->getAddress();
        } else {
            $httpQuery['latlng'] = sprintf(
                '%s,%s',
                $geocoderRequest->getCoordinate()->getLatitude(),
                $geocoderRequest->getCoordinate()->getLongitude()
            );
        }

        if ($geocoderRequest->hasBound()) {
            $httpQuery['bound'] = sprintf(
                '%s,%s|%s,%s',
                $geocoderRequest->getBound()->getSouthWest()->getLatitude(),
                $geocoderRequest->getBound()->getSouthWest()->getLongitude(),
                $geocoderRequest->getBound()->getNorthEast()->getLatitude(),
                $geocoderRequest->getBound()->getNorthEast()->getLongitude()
            );
        }

        if ($geocoderRequest->hasRegion()) {
            $httpQuery['region'] = $geocoderRequest->getRegion();
        }

        if ($geocoderRequest->hasLanguage()) {
            $httpQuery['language'] = $geocoderRequest->getLanguage();
        }

        $httpQuery['sensor'] = $geocoderRequest->hasSensor() ? 'true' : 'false';

        $url = sprintf('%s/%s?%s', $this->getUrl(), $this->getFormat(), http_build_query($httpQuery));

        return $this->signUrl($url);
    }

protected function generateUrl ( GeocoderRequest $ geocoderRequest ) { $ httpQuery = array ( ) ; if ( $ geocoderRequest -> hasAddress ( ) ) { $ httpQuery [ 'address' ] = $ geocoderRequest -> getAddress ( ) ; } else { $ httpQuery [ 'latlng' ] = sprintf ( '%s,%s' , $ geocoderRequest -> getCoordinate ( ) -> getLatitude ( ) , $ geocoderRequest -> getCoordinate ( ) -> getLongitude ( ) ) ; } if ( $ geocoderRequest -> hasBound ( ) ) { $ httpQuery [ 'bound' ] = sprintf ( '%s,%s|%s,%s' , $ geocoderRequest -> getBound ( ) -> getSouthWest ( ) -> getLatitude ( ) , $ geocoderRequest -> getBound ( ) -> getSouthWest ( ) -> getLongitude ( ) , $ geocoderRequest -> getBound ( ) -> getNorthEast ( ) -> getLatitude ( ) , $ geocoderRequest -> getBound ( ) -> getNorthEast ( ) -> getLongitude ( ) ) ; } if ( $ geocoderRequest -> hasRegion ( ) ) { $ httpQuery [ 'region' ] = $ geocoderRequest -> getRegion ( ) ; } if ( $ geocoderRequest -> hasLanguage ( ) ) { $ httpQuery [ 'language' ] = $ geocoderRequest -> getLanguage ( ) ; } $ httpQuery [ 'sensor' ] = $ geocoderRequest -> hasSensor ( ) ? 'true' : 'false' ; $ url = sprintf ( '%s/%s?%s' , $ this -> getUrl ( ) , $ this -> getFormat ( ) , http_build_query ( $ httpQuery ) ) ; return $ this -> signUrl ( $ url ) ; }

Generates geocoding URL according to the request.

@param \Ivory\GoogleMap\Services\Geocoding\GeocoderRequest $geocoderRequest The geocoder request.

@return string The generated URL.

Generates geocoding URL according to the request .


protected function buildGeocoderResponse(\stdClass $geocoderResponse)
    {
        $results = array();
        foreach ($geocoderResponse->results as $geocoderResult) {
            $results[] = $this->buildGeocoderResult($geocoderResult);
        }

        $status = $geocoderResponse->status;

        return new GeocoderResponse($results, $status);
    }

protected function buildGeocoderResponse ( \ stdClass $ geocoderResponse ) { $ results = array ( ) ; foreach ( $ geocoderResponse -> results as $ geocoderResult ) { $ results [ ] = $ this -> buildGeocoderResult ( $ geocoderResult ) ; } $ status = $ geocoderResponse -> status ; return new GeocoderResponse ( $ results , $ status ) ; }

Builds the geocoder results accordint to a normalized geocoding results.

@param \stdClass $geocoderResponse The normalized geocder response.

@return \Ivory\GoogleMap\Services\Geocoding\Result\GeocoderResponse The builded geocoder response.

Builds the geocoder results accordint to a normalized geocoding results .


protected function buildGeocoderResult(\stdClass $geocoderResult)
    {
        $addressComponents = $this->buildGeocoderAddressComponents($geocoderResult->address_components);
        $formattedAddress = $geocoderResult->formatted_address;
        $geometry = $this->buildGeocoderGeometry($geocoderResult->geometry);
        $types = $geocoderResult->types;
        $partialMatch = isset($geocoderResult->partial_match) ? $geocoderResult->partial_match : null;

        return new GeocoderResult($addressComponents, $formattedAddress, $geometry, $types, $partialMatch);
    }

protected function buildGeocoderResult ( \ stdClass $ geocoderResult ) { $ addressComponents = $ this -> buildGeocoderAddressComponents ( $ geocoderResult -> address_components ) ; $ formattedAddress = $ geocoderResult -> formatted_address ; $ geometry = $ this -> buildGeocoderGeometry ( $ geocoderResult -> geometry ) ; $ types = $ geocoderResult -> types ; $ partialMatch = isset ( $ geocoderResult -> partial_match ) ? $ geocoderResult -> partial_match : null ; return new GeocoderResult ( $ addressComponents , $ formattedAddress , $ geometry , $ types , $ partialMatch ) ; }

Builds a geocoder result according to a normalized geocoding result.

@param \stdClass $geocoderResult The normalized geocoder result.

@return \Ivory\GoogleMap\Services\Geocoding\Result\GeocoderResult The builded geocoder result.

Builds a geocoder result according to a normalized geocoding result .


protected function buildGeocoderAddressComponents(array $geocoderAddressComponents)
    {
        $results = array();

        foreach ($geocoderAddressComponents as $geocoderAddressComponent) {
            $results[] = $this->buildGeocoderAddressComponent($geocoderAddressComponent);
        }

        return $results;
    }

protected function buildGeocoderAddressComponents ( array $ geocoderAddressComponents ) { $ results = array ( ) ; foreach ( $ geocoderAddressComponents as $ geocoderAddressComponent ) { $ results [ ] = $ this -> buildGeocoderAddressComponent ( $ geocoderAddressComponent ) ; } return $ results ; }

Builds the gecoder address components according to a normalized geocoding address components.

@param array $geocoderAddressComponents The normalized geocoder address components.

@return array The builded geocoder address components.

Builds the gecoder address components according to a normalized geocoding address components .


protected function buildGeocoderAddressComponent(\stdClass $geocoderAddressComponent)
    {
        $longName = $geocoderAddressComponent->long_name;
        $shortName = $geocoderAddressComponent->short_name;
        $types = $geocoderAddressComponent->types;

        return new GeocoderAddressComponent($longName, $shortName, $types);
    }

protected function buildGeocoderAddressComponent ( \ stdClass $ geocoderAddressComponent ) { $ longName = $ geocoderAddressComponent -> long_name ; $ shortName = $ geocoderAddressComponent -> short_name ; $ types = $ geocoderAddressComponent -> types ; return new GeocoderAddressComponent ( $ longName , $ shortName , $ types ) ; }

Builds a geocoder address component according to a normalized geocoding address component.

@param \stdClass $geocoderAddressComponent The normalized geocoder address component.

@return \Ivory\GoogleMap\Services\Geocoding\Result\GeocoderAddressComponent The builded geocoder address
component.

Builds a geocoder address component according to a normalized geocoding address component .


protected function buildGeocoderGeometry(\stdClass $geocoderGeometry)
    {
        $location = new Coordinate(
            $geocoderGeometry->location->lat,
            $geocoderGeometry->location->lng
        );

        $locationType = $geocoderGeometry->location_type;

        $viewport = new Bound(
            new Coordinate($geocoderGeometry->viewport->southwest->lat, $geocoderGeometry->viewport->southwest->lng),
            new Coordinate($geocoderGeometry->viewport->northeast->lat, $geocoderGeometry->viewport->northeast->lng)
        );

        $bound = null;
        if (isset($geocoderGeometry->bounds)) {
            $bound = new Bound(
                new Coordinate($geocoderGeometry->bounds->southwest->lat, $geocoderGeometry->bounds->southwest->lng),
                new Coordinate($geocoderGeometry->bounds->northeast->lat, $geocoderGeometry->bounds->northeast->lng)
            );
        }

        return new GeocoderGeometry($location, $locationType, $viewport, $bound);
    }

protected function buildGeocoderGeometry ( \ stdClass $ geocoderGeometry ) { $ location = new Coordinate ( $ geocoderGeometry -> location -> lat , $ geocoderGeometry -> location -> lng ) ; $ locationType = $ geocoderGeometry -> location_type ; $ viewport = new Bound ( new Coordinate ( $ geocoderGeometry -> viewport -> southwest -> lat , $ geocoderGeometry -> viewport -> southwest -> lng ) , new Coordinate ( $ geocoderGeometry -> viewport -> northeast -> lat , $ geocoderGeometry -> viewport -> northeast -> lng ) ) ; $ bound = null ; if ( isset ( $ geocoderGeometry -> bounds ) ) { $ bound = new Bound ( new Coordinate ( $ geocoderGeometry -> bounds -> southwest -> lat , $ geocoderGeometry -> bounds -> southwest -> lng ) , new Coordinate ( $ geocoderGeometry -> bounds -> northeast -> lat , $ geocoderGeometry -> bounds -> northeast -> lng ) ) ; } return new GeocoderGeometry ( $ location , $ locationType , $ viewport , $ bound ) ; }

Builds a geocoder geometry according to a normalized geocoding geometry.

@param \stdClass $geocoderGeometry The normalized geocoder geomety.

@return \Ivory\GoogleMap\Services\Geocoding\Result\GeocoderGeometry The builded geocoder geometry.

Builds a geocoder geometry according to a normalized geocoding geometry .


public function process()
    {
        $args = func_get_args();

        if (isset($args[0]) && ($args[0] instanceof DistanceMatrixRequest)) {
            $distanceMatrixRequest = $args[0];
        } elseif ((isset($args[0]) && is_array($args[0])) && (isset($args[1]) && is_array($args[1]))) {
            $distanceMatrixRequest = new DistanceMatrixRequest();

            $distanceMatrixRequest->setOrigins($args[0]);
            $distanceMatrixRequest->setDestinations($args[1]);
        } else {
            throw DistanceMatrixException::invalidDistanceMatrixRequestParameters();
        }

        if (!$distanceMatrixRequest->isValid()) {
            throw DistanceMatrixException::invalidDistanceMatrixRequest();
        }

        $response = $this->send($this->generateUrl($distanceMatrixRequest));
        $distanceMatrixResponse = $this->buildDistanceMatrixResponse($this->parse($response->getBody()));

        return $distanceMatrixResponse;
    }

public function process ( ) { $ args = func_get_args ( ) ; if ( isset ( $ args [ 0 ] ) && ( $ args [ 0 ] instanceof DistanceMatrixRequest ) ) { $ distanceMatrixRequest = $ args [ 0 ] ; } elseif ( ( isset ( $ args [ 0 ] ) && is_array ( $ args [ 0 ] ) ) && ( isset ( $ args [ 1 ] ) && is_array ( $ args [ 1 ] ) ) ) { $ distanceMatrixRequest = new DistanceMatrixRequest ( ) ; $ distanceMatrixRequest -> setOrigins ( $ args [ 0 ] ) ; $ distanceMatrixRequest -> setDestinations ( $ args [ 1 ] ) ; } else { throw DistanceMatrixException :: invalidDistanceMatrixRequestParameters ( ) ; } if ( ! $ distanceMatrixRequest -> isValid ( ) ) { throw DistanceMatrixException :: invalidDistanceMatrixRequest ( ) ; } $ response = $ this -> send ( $ this -> generateUrl ( $ distanceMatrixRequest ) ) ; $ distanceMatrixResponse = $ this -> buildDistanceMatrixResponse ( $ this -> parse ( $ response -> getBody ( ) ) ) ; return $ distanceMatrixResponse ; }

Processes the given request.

Available prototypes:
- function process(array $origins, array $destinations)
- function process(Ivory\GoogleMap\Services\DistanceMatrix\DistanceMatrixRequest $request)

@throws \Ivory\GoogleMap\Exception\DistanceMatrixException If the request is not valid (prototypes).


protected function generateUrl(DistanceMatrixRequest $distanceMatrixRequest)
    {
        $httpQuery = array(
            'origins'      => array(),
            'destinations' => array(),
        );

        foreach ($distanceMatrixRequest->getOrigins() as $origin) {
            if (is_string($origin)) {
                $httpQuery['origins'][] = $origin;
            } else {
                $httpQuery['origins'][] = sprintf(
                    '%s,%s',
                    $origin->getLatitude(),
                    $origin->getLongitude()
                );
            }
        }

        foreach ($distanceMatrixRequest->getDestinations() as $destination) {
            if (is_string($destination)) {
                $httpQuery['destinations'][] = $destination;
            } else {
                $httpQuery['destinations'][] = sprintf(
                    '%s,%s',
                    $destination->getLatitude(),
                    $destination->getLongitude()
                );
            }
        }

        $httpQuery['origins'] = implode('|', $httpQuery['origins']);
        $httpQuery['destinations'] = implode('|', $httpQuery['destinations']);

        if ($distanceMatrixRequest->hasTravelMode()) {
            $httpQuery['mode'] = strtolower($distanceMatrixRequest->getTravelMode());
        }

        if ($distanceMatrixRequest->hasAvoidTolls() && $distanceMatrixRequest->getAvoidTolls()) {
            $httpQuery['avoidTolls'] = true;
        }

        if ($distanceMatrixRequest->hasAvoidHighways() && $distanceMatrixRequest->getAvoidHighways()) {
            $httpQuery['avoidHighways'] = true;
        }

        if ($distanceMatrixRequest->hasUnitSystem()) {
            $httpQuery['units'] = strtolower($distanceMatrixRequest->getUnitSystem());
        }

        if ($distanceMatrixRequest->hasRegion()) {
            $httpQuery['region'] = $distanceMatrixRequest->getRegion();
        }

        if ($distanceMatrixRequest->hasLanguage()) {
            $httpQuery['language'] = $distanceMatrixRequest->getLanguage();
        }

        $httpQuery['sensor'] = $distanceMatrixRequest->hasSensor() ? 'true' : 'false';

        $url = sprintf('%s/%s?%s', $this->getUrl(), $this->getFormat(), http_build_query($httpQuery));

        return $this->signUrl($url);
    }

protected function generateUrl ( DistanceMatrixRequest $ distanceMatrixRequest ) { $ httpQuery = array ( 'origins' => array ( ) , 'destinations' => array ( ) , ) ; foreach ( $ distanceMatrixRequest -> getOrigins ( ) as $ origin ) { if ( is_string ( $ origin ) ) { $ httpQuery [ 'origins' ] [ ] = $ origin ; } else { $ httpQuery [ 'origins' ] [ ] = sprintf ( '%s,%s' , $ origin -> getLatitude ( ) , $ origin -> getLongitude ( ) ) ; } } foreach ( $ distanceMatrixRequest -> getDestinations ( ) as $ destination ) { if ( is_string ( $ destination ) ) { $ httpQuery [ 'destinations' ] [ ] = $ destination ; } else { $ httpQuery [ 'destinations' ] [ ] = sprintf ( '%s,%s' , $ destination -> getLatitude ( ) , $ destination -> getLongitude ( ) ) ; } } $ httpQuery [ 'origins' ] = implode ( '|' , $ httpQuery [ 'origins' ] ) ; $ httpQuery [ 'destinations' ] = implode ( '|' , $ httpQuery [ 'destinations' ] ) ; if ( $ distanceMatrixRequest -> hasTravelMode ( ) ) { $ httpQuery [ 'mode' ] = strtolower ( $ distanceMatrixRequest -> getTravelMode ( ) ) ; } if ( $ distanceMatrixRequest -> hasAvoidTolls ( ) && $ distanceMatrixRequest -> getAvoidTolls ( ) ) { $ httpQuery [ 'avoidTolls' ] = true ; } if ( $ distanceMatrixRequest -> hasAvoidHighways ( ) && $ distanceMatrixRequest -> getAvoidHighways ( ) ) { $ httpQuery [ 'avoidHighways' ] = true ; } if ( $ distanceMatrixRequest -> hasUnitSystem ( ) ) { $ httpQuery [ 'units' ] = strtolower ( $ distanceMatrixRequest -> getUnitSystem ( ) ) ; } if ( $ distanceMatrixRequest -> hasRegion ( ) ) { $ httpQuery [ 'region' ] = $ distanceMatrixRequest -> getRegion ( ) ; } if ( $ distanceMatrixRequest -> hasLanguage ( ) ) { $ httpQuery [ 'language' ] = $ distanceMatrixRequest -> getLanguage ( ) ; } $ httpQuery [ 'sensor' ] = $ distanceMatrixRequest -> hasSensor ( ) ? 'true' : 'false' ; $ url = sprintf ( '%s/%s?%s' , $ this -> getUrl ( ) , $ this -> getFormat ( ) , http_build_query ( $ httpQuery ) ) ; return $ this -> signUrl ( $ url ) ; }

Generates distance matrix URL API according to the request.

@param \Ivory\GoogleMap\Services\DistanceMatrix\DistanceMatrixRequest $distanceMatrixRequest The distance matrix request.

@return string The generated URL.

Generates distance matrix URL API according to the request .


protected function parse($response)
    {
        if ($this->format === 'json') {
            return $this->parseJSON($response);
        }

        return $this->parseXML($response);
    }

protected function parse ( $ response ) { if ( $ this -> format === 'json' ) { return $ this -> parseJSON ( $ response ) ; } return $ this -> parseXML ( $ response ) ; }

Parses & normalizes the distance matrix API result response.

@param string $response The distance matrix API response.

@return \stdClass The parsed & normalized distance matrix response.

Parses & normalizes the distance matrix API result response .


protected function buildDistanceMatrixResponse(\stdClass $distanceMatrixResponse)
    {
        $status = $distanceMatrixResponse->status;
        $destinations = $distanceMatrixResponse->destination_addresses;
        $origins = $distanceMatrixResponse->origin_addresses;
        $rows = $this->buildDistanceMatrixRows($distanceMatrixResponse->rows);

        return new DistanceMatrixResponse($status, $origins, $destinations, $rows);
    }

protected function buildDistanceMatrixResponse ( \ stdClass $ distanceMatrixResponse ) { $ status = $ distanceMatrixResponse -> status ; $ destinations = $ distanceMatrixResponse -> destination_addresses ; $ origins = $ distanceMatrixResponse -> origin_addresses ; $ rows = $ this -> buildDistanceMatrixRows ( $ distanceMatrixResponse -> rows ) ; return new DistanceMatrixResponse ( $ status , $ origins , $ destinations , $ rows ) ; }

Builds the distance matrix response according to the normalized distance matrix API results.

@param \stdClass $distanceMatrixResponse The normalized distance matrix response.

@return \Ivory\GoogleMap\Services\DistanceMatrix\DistanceMatrixResponse The built distance matrix response.

Builds the distance matrix response according to the normalized distance matrix API results .


protected function buildDistanceMatrixRows($rows)
    {
        $results = array();

        foreach ($rows as $row) {
            $results[] = $this->buildDistanceMatrixRow($row);
        }

        return $results;
    }

protected function buildDistanceMatrixRows ( $ rows ) { $ results = array ( ) ; foreach ( $ rows as $ row ) { $ results [ ] = $ this -> buildDistanceMatrixRow ( $ row ) ; } return $ results ; }

Builds the distance matrix response rows according to the normalized distance matrix API results.

@param array $rows The normalized distance matrix response rows.

@return array The built distance matrix response rows.

Builds the distance matrix response rows according to the normalized distance matrix API results .


protected function buildDistanceMatrixRow($row)
    {
        $elements = array();

        foreach ($row->elements as $element) {
            $elements[] = $this->buildDistanceMatrixResponseElement($element);
        }

        return new DistanceMatrixResponseRow($elements);
    }

protected function buildDistanceMatrixRow ( $ row ) { $ elements = array ( ) ; foreach ( $ row -> elements as $ element ) { $ elements [ ] = $ this -> buildDistanceMatrixResponseElement ( $ element ) ; } return new DistanceMatrixResponseRow ( $ elements ) ; }

Builds a distance matrix response row according to the normalized distance matrix API response row.

@param \stdClass $row The normalized distance matrix response row.

@return \Ivory\GoogleMap\Services\DistanceMatrix\DistanceMatrixResponseRow The built distance matrix response row.

Builds a distance matrix response row according to the normalized distance matrix API response row .


protected function buildDistanceMatrixResponseElement($element)
    {
        $status = $element->status;
        $distance = null;
        $duration = null;

        if ($element->status === DistanceMatrixElementStatus::OK) {
            $distance = new Distance($element->distance->text, $element->distance->value);
            $duration = new Duration($element->duration->text, $element->duration->value);
        }

        return new DistanceMatrixResponseElement($status, $distance, $duration);
    }

protected function buildDistanceMatrixResponseElement ( $ element ) { $ status = $ element -> status ; $ distance = null ; $ duration = null ; if ( $ element -> status === DistanceMatrixElementStatus :: OK ) { $ distance = new Distance ( $ element -> distance -> text , $ element -> distance -> value ) ; $ duration = new Duration ( $ element -> duration -> text , $ element -> duration -> value ) ; } return new DistanceMatrixResponseElement ( $ status , $ distance , $ duration ) ; }

Builds a distance matrix response element according to the normalized distance matrix API response elements.

@param \stdClass $element The normalized distance matrix response element.

@return \Ivory\GoogleMap\Services\DistanceMatrix\DistanceMatrixResponseElement The built distance matrix response element.

Builds a distance matrix response element according to the normalized distance matrix API response elements .


public function render(Point $point)
    {
        return sprintf(
            '%s = new google.maps.Point(%s, %s);'.PHP_EOL,
            $point->getJavascriptVariable(),
            $point->getX(),
            $point->getY()
        );
    }

public
function
render
(
Point
$
point
)
{
return
sprintf
(
'%s = new google.maps.Point(%s, %s);'
.
PHP_EOL
,
$
point
->
getJavascriptVariable
(
)
,
$
point
->
getX
(
)
,
$
point
->
getY
(
)
)
;
}

Renders a point.

@param \Ivory\GoogleMap\Base\Point $point The point.

@return string The JS output.


private function getParameterStrings(string $parameterString): array
    {
        $rawParameterStrings = explode(self::TYPE_PARAMETER_SEPARATOR, $parameterString);
        $parameterStrings = array();

        foreach ($rawParameterStrings as $rawParameterString) {
            if ($rawParameterString != '') {
                $parameterStrings[] = trim($rawParameterString);
            }
        }

        return $parameterStrings;
    }

private function getParameterStrings ( string $ parameterString ) : array { $ rawParameterStrings = explode ( self :: TYPE_PARAMETER_SEPARATOR , $ parameterString ) ; $ parameterStrings = array ( ) ; foreach ( $ rawParameterStrings as $ rawParameterString ) { if ( $ rawParameterString != '' ) { $ parameterStrings [ ] = trim ( $ rawParameterString ) ; } } return $ parameterStrings ; }

Get collection of string representations of each parameter

@param string $parameterString

@return string[]


private function getParameters($parameterStrings): array
    {
        $parameters = array();
        foreach ($parameterStrings as $parameterString) {
            $parameters[] = $this->parameterParser->parse($parameterString);
        }

        return $parameters;
    }

private function getParameters ( $ parameterStrings ) : array { $ parameters = array ( ) ; foreach ( $ parameterStrings as $ parameterString ) { $ parameters [ ] = $ this -> parameterParser -> parse ( $ parameterString ) ; } return $ parameters ; }

Get a collection of Parameter objects from a collection of string
representations of the same

@param array $parameterStrings

@return ParameterInterface[]

@throws AttributeParserException


public function current(): array
    {
        if (($headers = &$this->cacheKey(__FUNCTION__)) !== null) {
            return $headers; // Cached this already.
        }
        $headers = []; // Initialize.

        foreach ($_SERVER as $_header => $_value) {
            if (mb_stripos($_header, 'HTTP_') === 0) {
                $_header                          = preg_replace('/^HTTP_/ui', '', $_header);
                $_header                          = str_replace('_', '-', $_header);
                $headers[mb_strtolower($_header)] = $_value;
            }
        } // unset($_header, $_value); // Housekeeping.

        return $headers;
    }

Current request headers.

@since 170824.30708 Current request headers.

@return array Unique/associative array of all headers.


public function yesCacheSend(int $expires_after = self::SECONDS_IN_YEAR)
    {
        if (headers_sent()) {
            throw $this->c::issue('Headers already sent.');
        }
        header_remove('last-modified');

        foreach ($this->yesCache() as $_header => $_value) {
            header($_header.': '.$_value);
        } // unset($_header, $_value);
    }

public
function
yesCacheSend
(
int
$
expires_after
=
self
::
SECONDS_IN_YEAR
)
{
if
(
headers_sent
(
)
)
{
throw
$
this
->
c
::
issue
(
'Headers already sent.'
)
;
}
header_remove
(
'last-modified'
)
;
foreach
(
$
this
->
yesCache
(
)
as
$
_header
=>
$
_value
)
{
header
(
$
_header
.
': '
.
$
_value
)
;
}
// unset($_header, $_value);
}

Send yes-cache headers.

@since 17xxxx Yes-cache headers.

@param int $expires_after Expires after (seconds).


public function noCacheSend()
    {
        if (headers_sent()) {
            throw $this->c::issue('Headers already sent.');
        }
        header_remove('last-modified');

        foreach ($this->noCache() as $_header => $_value) {
            header($_header.': '.$_value);
        } // unset($_header, $_value);
    }

public
function
noCacheSend
(
)
{
if
(
headers_sent
(
)
)
{
throw
$
this
->
c
::
issue
(
'Headers already sent.'
)
;
}
header_remove
(
'last-modified'
)
;
foreach
(
$
this
->
noCache
(
)
as
$
_header
=>
$
_value
)
{
header
(
$
_header
.
': '
.
$
_value
)
;
}
// unset($_header, $_value);
}

Send no-cache headers.

@since 17xxxx No-cache headers.


public function getStatusSlug(int $status): string
    {
        return $this->c::nameToSlug($this->getStatusTitle($status));
    }

public function getStatusSlug ( int $ status ) : string { return $ this -> c :: nameToSlug ( $ this -> getStatusTitle ( $ status ) ) ; }

Get slug for status code.

@since 170824.30708 Adding status slug utility.

@param int $status The HTTP status code.

@return string Status slug for code.


public function getStatusMessage(int $status): string
    {
        return $this->c::mbUcFirst(mb_strtolower($this->getStatusTitle($status))).'.';
    }

public function getStatusMessage ( int $ status ) : string { return $ this -> c :: mbUcFirst ( mb_strtolower ( $ this -> getStatusTitle ( $ status ) ) ) . '.' ; }

Get message for status code.

@since 17xxxx Status message utility.

@param int $status The HTTP status code.

@return string Status message for code.


public function sendStatus(int $status, string $protocol = '')
    {
        if (headers_sent()) {
            throw $this->c::issue('Headers already sent.');
        }
        if (!$protocol && !($protocol = $_SERVER['SERVER_PROTOCOL'] ?? '')) {
            $protocol = 'HTTP/1.1'; // Default fallback.
        }
        header($protocol.' '.$status.' '.$this->getStatusTitle($status), true, $status);
    }

public
function
sendStatus
(
int
$
status
,
string
$
protocol
=
''
)
{
if
(
headers_sent
(
)
)
{
throw
$
this
->
c
::
issue
(
'Headers already sent.'
)
;
}
if
(
!
$
protocol
&&
!
(
$
protocol
=
$
_SERVER
[
'SERVER_PROTOCOL'
]
??
''
)
)
{
$
protocol
=
'HTTP/1.1'
;
// Default fallback.
}
header
(
$
protocol
.
' '
.
$
status
.
' '
.
$
this
->
getStatusTitle
(
$
status
)
,
true
,
$
status
)
;
}

Status header.

@since 151121 Header utilities.

@param int    $status   Status code.
@param string $protocol Protocol.


public function parse($value): array
    {
        $headers = []; // Initialize.

        if (is_array($value) || is_object($value)) {
            foreach ($value as $_key => $_value) {
                if ($_key && is_string($_key) && is_string($_value)) {
                    $headers = array_merge($headers, $this->parse($_key.': '.$_value));
                } else {
                    $headers = array_merge($headers, $this->parse($_value));
                }
            } // unset($_key, $_value);
            return $headers; // All done here.
        }
        $string = (string) $value; // Force string.

        foreach (explode("\r\n", $string) as $_rn_delimited_header) {
            if (mb_strpos($_rn_delimited_header, ':') === false) {
                continue; // Invalid header.
            }
            list($_header, $_value) = $this->c::mbTrim(explode(':', $_rn_delimited_header, 2));

            if (!$_header || !isset($_value[0])) {
                continue; // Invalid header.
            }
            $headers[mb_strtolower($_header)] = $_value;
        } // unset($_rn_delimited_header, $_header, $_value);

        return $headers;
    }

Parses headers.

@since 151121 Header utilities.

@param mixed $value Input value w/ headers.

@return array Unique/associative array of all headers.


public function tags($value)
    {
        if (is_array($value) || is_object($value)) {
            foreach ($value as $_key => &$_value) {
                $_value = $this->tags($_value);
            } // unset($_key, $_value);
            return $value;
        }
        if (!($string = (string) $value)) {
            return $string; // Empty.
        }
        $regex = // Search for PHP tags.
            '/'.// Open pattern delimiter.
            '(?:'.// Any of these.

                '\<\?php.*?\?\>|\<\?\=.*?\?\>|\<\?.*?\?\>|\<%.*?%\>'.
                '|\<script\s+[^>]*?language\s*\=\s*(["\'])?php\\1[^>]*\>.*?\<\s*\/\s*script\s*\>'.

            ')'.// Close 'any of these'.
            '/uis'; // End pattern.
        return preg_replace($regex, '', $string);
    }

Strips PHP tags.

@since 150424 Initial release.

@param mixed $value Any input value.

@return string|array|object Output value.


protected function registerMigrations()
    {
        if (is_dir($dir = $this->module->getPath('src/Database/Migrations'))
            || is_dir($dir = $this->module->getPath('database/migrations'))
        ) {
            $this->loadMigrationsFrom($dir);
        }
    }

protected function registerMigrations ( ) { if ( is_dir ( $ dir = $ this -> module -> getPath ( 'src/Database/Migrations' ) ) || is_dir ( $ dir = $ this -> module -> getPath ( 'database/migrations' ) ) ) { $ this -> loadMigrationsFrom ( $ dir ) ; } }


protected function registerTrans()
    {
        $path = base_path("resources/lang/modules/{$this->module->getName()}");

        if (is_dir($path)) {
            $this->loadTranslationsFrom($path, $this->module->getName());
        } else {
            $this->loadTranslationsFrom($this->module->getPath('resources/lang'), $this->module->getName());
        }
    }


public function setPixelOffset()
    {
        $args = func_get_args();

        if (isset($args[0]) && ($args[0] instanceof Size)) {
            $this->pixedOffset = $args[0];
        } elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1]))) {
            if ($this->pixedOffset === null) {
                $this->pixedOffset = new Size();
            }

            $this->pixedOffset->setWidth($args[0]);
            $this->pixedOffset->setHeight($args[1]);

            if (isset($args[2]) && is_string($args[2])) {
                $this->pixedOffset->setWidthUnit($args[2]);
            }

            if (isset($args[3]) && is_string($args[3])) {
                $this->pixedOffset->setHeightUnit($args[3]);
            }
        } elseif (!isset($args[0])) {
            $this->pixedOffset = null;
        } else {
            throw OverlayException::invalidInfoWindowPixelOffset();
        }
    }

public function setPixelOffset ( ) { $ args = func_get_args ( ) ; if ( isset ( $ args [ 0 ] ) && ( $ args [ 0 ] instanceof Size ) ) { $ this -> pixedOffset = $ args [ 0 ] ; } elseif ( ( isset ( $ args [ 0 ] ) && is_numeric ( $ args [ 0 ] ) ) && ( isset ( $ args [ 1 ] ) && is_numeric ( $ args [ 1 ] ) ) ) { if ( $ this -> pixedOffset === null ) { $ this -> pixedOffset = new Size ( ) ; } $ this -> pixedOffset -> setWidth ( $ args [ 0 ] ) ; $ this -> pixedOffset -> setHeight ( $ args [ 1 ] ) ; if ( isset ( $ args [ 2 ] ) && is_string ( $ args [ 2 ] ) ) { $ this -> pixedOffset -> setWidthUnit ( $ args [ 2 ] ) ; } if ( isset ( $ args [ 3 ] ) && is_string ( $ args [ 3 ] ) ) { $ this -> pixedOffset -> setHeightUnit ( $ args [ 3 ] ) ; } } elseif ( ! isset ( $ args [ 0 ] ) ) { $ this -> pixedOffset = null ; } else { throw OverlayException :: invalidInfoWindowPixelOffset ( ) ; } }

Sets the pixel offset.

Available prototypes:
- function setPixelOffset(Ivory\GoogleMap\Base\Size $scaledSize)
- function setPixelOffset(double $width, double $height, string $widthUnit = null, string $heightUnit = null)

@throws \Ivory\GoogleMap\Exception\OverlayException If the pixel offset is not valid (prototypes).


public function setOpenEvent($openEvent)
    {
        if (!in_array($openEvent, MouseEvent::getMouseEvents())) {
            throw OverlayException::invalidInfoWindowOpenEvent();
        }

        $this->openEvent = $openEvent;
    }

public function setOpenEvent ( $ openEvent ) { if ( ! in_array ( $ openEvent , MouseEvent :: getMouseEvents ( ) ) ) { throw OverlayException :: invalidInfoWindowOpenEvent ( ) ; } $ this -> openEvent = $ openEvent ; }

Sets the info window open event.

@param string $openEvent The info window open event.

@throws \Ivory\GoogleMap\Exception\OverlayException If the open event is not valid.


public function render(PanControl $panControl)
    {
        return $this->jsonBuilder
            ->reset()
            ->setValue('[position]', $this->controlPositionHelper->render($panControl->getControlPosition()), false)
            ->build();
    }

public function render ( PanControl $ panControl ) { return $ this -> jsonBuilder -> reset ( ) -> setValue ( '[position]' , $ this -> controlPositionHelper -> render ( $ panControl -> getControlPosition ( ) ) , false ) -> build ( ) ; }

Renders a pan control.

@param \Ivory\GoogleMap\Controls\PanControl $panControl The pan control.

@return string The JS output.


public static function getMouseEvents()
    {
        return array(
            self::CLICK,
            self::DBLCLICK,
            self::MOUSEUP,
            self::MOUSEDOWN,
            self::MOUSEOVER,
            self::MOUSEOUT,
        );
    }

public static function getMouseEvents ( ) { return array ( self :: CLICK , self :: DBLCLICK , self :: MOUSEUP , self :: MOUSEDOWN , self :: MOUSEOVER , self :: MOUSEOUT , ) ; }

Gets the available mouse events.

@return array The mouse events.


public function setMapTypeIds($mapTypeIds)
    {
        $this->mapTypeIds = array();

        foreach ($mapTypeIds as $mapTypeId) {
            $this->addMapTypeId($mapTypeId);
        }
    }

public function setMapTypeIds ( $ mapTypeIds ) { $ this -> mapTypeIds = array ( ) ; foreach ( $ mapTypeIds as $ mapTypeId ) { $ this -> addMapTypeId ( $ mapTypeId ) ; } }

Sets the map type IDs.

@param array $mapTypeIds The map type IDs.


public function addMapTypeId($mapTypeId)
    {
        if (!in_array($mapTypeId, MapTypeId::getMapTypeIds())) {
            throw ControlException::invalidMapTypeId();
        }

        if (!in_array($mapTypeId, $this->mapTypeIds)) {
            $this->mapTypeIds[] = $mapTypeId;
        }
    }

public function addMapTypeId ( $ mapTypeId ) { if ( ! in_array ( $ mapTypeId , MapTypeId :: getMapTypeIds ( ) ) ) { throw ControlException :: invalidMapTypeId ( ) ; } if ( ! in_array ( $ mapTypeId , $ this -> mapTypeIds ) ) { $ this -> mapTypeIds [ ] = $ mapTypeId ; } }

Add a map type ID.

@param string $mapTypeId The map type ID to add.

@throws \Ivory\GoogleMap\Exception\ControlException If the map type ID is not valid.


public function setMapTypeControlStyle($mapTypeControlStyle)
    {
        if (!in_array($mapTypeControlStyle, MapTypeControlStyle::getMapTypeControlStyles())) {
            throw ControlException::invalidMapTypeControlStyle();
        }

        $this->mapTypeControlStyle = $mapTypeControlStyle;
    }

public function setMapTypeControlStyle ( $ mapTypeControlStyle ) { if ( ! in_array ( $ mapTypeControlStyle , MapTypeControlStyle :: getMapTypeControlStyles ( ) ) ) { throw ControlException :: invalidMapTypeControlStyle ( ) ; } $ this -> mapTypeControlStyle = $ mapTypeControlStyle ; }

Sets the map type control style.

@param type $mapTypeControlStyle The map type control style.

@throws \Ivory\GoogleMap\Exception\ControlException If the map type control style is not valid.


public function setUe(
        string $name,
        string $value,
        int $expires_after = null,
        string $path = null,
        string $domain = null,
        bool $secure = null,
        bool $http_only = null
    ) {
        if (!$name) { // Must have a cookie name!
            throw $this->c::issue('Missing cookie name.');
        }
        $expires_after = max(0, $expires_after ?? 31556926);
        $expires       = $expires_after ? time() + $expires_after : 0;

        $path   = $path ?? '/'; // Entire site.
        $domain = $domain ?? $this->c::currentHost(false);
        $domain = $domain === 'root' ? '.'.$this->c::currentRootHost(false) : $domain;

        $secure    = $secure ?? $this->c::isSsl();
        $http_only = $http_only ?? true;

        if (headers_sent()) {
            throw $this->c::issue('Headers already sent.');
        }
        setcookie($name, $value, $expires, $path, $domain, $secure, $http_only);

        if (mb_stripos($name, '_test_') === false) {
            $_COOKIE[$name] = $value;
        }
    }

public
function
setUe
(
string
$
name
,
string
$
value
,
int
$
expires_after
=
,
string
$
path
=
,
string
$
domain
=
,
bool
$
secure
=
,
bool
$
http_only
=
)
{
if
(
!
$
name
)
{
// Must have a cookie name!
throw
$
this
->
c
::
issue
(
'Missing cookie name.'
)
;
}
$
expires_after
=
max
(
0
,
$
expires_after
??
31556926
)
;
$
expires
=
$
expires_after
time
(
)
+
$
expires_after
:
0
;
$
path
=
$
path
??
'/'
;
// Entire site.
$
domain
=
$
domain
??
$
this
->
c
::
currentHost
(
false
)
;
$
domain
=
$
domain
===
'root'
'.'
.
$
this
->
c
::
currentRootHost
(
false
)
:
$
domain
;
$
secure
=
$
secure
??
$
this
->
c
::
isSsl
(
)
;
$
http_only
=
$
http_only
??
true
;
if
(
headers_sent
(
)
)
{
throw
$
this
->
c
::
issue
(
'Headers already sent.'
)
;
}
setcookie
(
$
name
,
$
value
,
$
expires
,
$
path
,
$
domain
,
$
secure
,
$
http_only
)
;
if
(
mb_stripos
(
$
name
,
'_test_'
)
===
false
)
{
$
_COOKIE
[
$
name
]
=
$
value
;
}
}

Sets an unencrypted cookie.

@param string      $name          Name of the cookie.
@param string      $value         Cookie value (empty to delete).
@param int|null    $expires_after Time (in seconds) this cookie should last for.
@param string|null $path          Path to set the cookie for.
@param string|null $domain        Domain name to set the cookie for.
@param bool|null   $secure        Over SSL access only?
@param bool|null   $http_only     HTTP only access?


public function getUe(string $name): string
    {
        if (!$name) { // Must have a cookie name!
            throw $this->c::issue('Missing cookie name.');
        }
        if (isset($_COOKIE[$name]) && is_string($_COOKIE[$name])) {
            return $_COOKIE[$name];
        }
        return ''; // Missing cookie.
    }

public
function
getUe
(
string
$
name
)
:
string
{
if
(
!
$
name
)
{
// Must have a cookie name!
throw
$
this
->
c
::
issue
(
'Missing cookie name.'
)
;
}
if
(
isset
(
$
_COOKIE
[
$
name
]
)
&&
is_string
(
$
_COOKIE
[
$
name
]
)
)
{
return
$
_COOKIE
[
$
name
]
;
}
return
''
;
// Missing cookie.
}

Gets an unencrypted cookie value.

@param string $name Name of the cookie.

@return string Cookie value.


public function renderDomEvent(Event $domEvent)
    {
        return sprintf(
            '%s = google.maps.event.addDomListener(%s, "%s", %s, %s);'.PHP_EOL,
            $domEvent->getJavascriptVariable(),
            $domEvent->getInstance(),
            $domEvent->getEventName(),
            $domEvent->getHandle(),
            json_encode($domEvent->isCapture())
        );
    }

Renders a dom event.

@param \Ivory\GoogleMap\Events\Event $domEvent The dom event.

@return string The JS output.


public function renderDomEventOnce(Event $domEventOnce)
    {
        return sprintf(
            '%s = google.maps.event.addDomListenerOnce(%s, "%s", %s, %s);'.PHP_EOL,
            $domEventOnce->getJavascriptVariable(),
            $domEventOnce->getInstance(),
            $domEventOnce->getEventName(),
            $domEventOnce->getHandle(),
            json_encode($domEventOnce->isCapture())
        );
    }

Renders a dom event once.

@param \Ivory\GoogleMap\Events\Event $domEventOnce The dom event once.

@return string The JS output.


public function renderEvent(Event $event)
    {
        return sprintf(
            '%s = google.maps.event.addListener(%s, "%s", %s);'.PHP_EOL,
            $event->getJavascriptVariable(),
            $event->getInstance(),
            $event->getEventName(),
            $event->getHandle()
        );
    }

Renders an event.

@param \Ivory\GoogleMap\Events\Event $event The event.

@return string The JS output.


public function renderEventOnce(Event $eventOnce)
    {
        return sprintf(
            '%s = google.maps.event.addListenerOnce(%s, "%s", %s);'.PHP_EOL,
            $eventOnce->getJavascriptVariable(),
            $eventOnce->getInstance(),
            $eventOnce->getEventName(),
            $eventOnce->getHandle()
        );
    }

Renders an event once.

@param \Ivory\GoogleMap\Events\Event $eventOnce The event once.

@return string The JS output.


public function render($animation)
    {
        switch ($animation) {
            case Animation::BOUNCE:
            case Animation::DROP:
                return sprintf('google.maps.Animation.%s', strtoupper($animation));
            default:
                throw HelperException::invalidAnimation();
        }
    }

public function render ( $ animation ) { switch ( $ animation ) { case Animation :: BOUNCE : case Animation :: DROP : return sprintf ( 'google.maps.Animation.%s' , strtoupper ( $ animation ) ) ; default : throw HelperException :: invalidAnimation ( ) ; } }

Renders an animation.

@param string $animation The animation.

@throws \Ivory\GoogleMap\Exception\HelperException If the animation is not valid.

@return string The JS output.


public function render(ZoomControl $zoomControl)
    {
        return $this->jsonBuilder
            ->reset()
            ->setValue('[position]', $this->controlPositionHelper->render($zoomControl->getControlPosition()), false)
            ->setValue('[style]', $this->zoomControlStyleHelper->render($zoomControl->getZoomControlStyle()), false)
            ->build();
    }

public function render ( ZoomControl $ zoomControl ) { return $ this -> jsonBuilder -> reset ( ) -> setValue ( '[position]' , $ this -> controlPositionHelper -> render ( $ zoomControl -> getControlPosition ( ) ) , false ) -> setValue ( '[style]' , $ this -> zoomControlStyleHelper -> render ( $ zoomControl -> getZoomControlStyle ( ) ) , false ) -> build ( ) ; }

Renders a zoom control.

@param \Ivory\GoogleMap\Controls\ZoomControl $zoomControl The zoom control.

@return string The JS output.


public function max(int $max = null): int
    {
        if (isset($max) && $max >= 0) {
            @set_time_limit($max);
        }
        return (int) ini_get('max_execution_time');
    }

public function max ( int $ max = null ) : int { if ( isset ( $ max ) && $ max >= 0 ) { @ set_time_limit ( $ max ) ; } return ( int ) ini_get ( 'max_execution_time' ) ; }

Max execution time.

@since 150424 Initial release.

@param int|null $max Max execution time.

@return int Max execution time; in seconds.


public function checkSlug(string $slug, array $args = []): bool
    {
        $text = mb_strtolower($slug);
        $text = preg_replace('/[^\p{L}\p{N}]/ui', ' ', $text);
        $text = preg_replace('/\s+/u', ' ', $text);

        return $this->check($text, $args);
    }

public
function
checkSlug
(
string
$
slug
,
array
$
args
=
[
]
)
:
bool
{
$
text
=
mb_strtolower
(
$
slug
)
;
$
text
=
preg_replace
(
'/[^\p{L}\p{N}]/ui'
,
' '
,
$
text
)
;
$
text
=
preg_replace
(
'/\s+/u'
,
' '
,
$
text
)
;
return
$
this
->
check
(
$
text
,
$
args
)
;
}

Check a slug for bad words.

@since 150424 Badwords checker.

@param string $slug Input slug to check.
@param array  $args Any additional args.

@return bool True if slug contains bad words.


public function getAddressComponents($type = null)
    {
        if ($type === null) {
            return $this->addressComponents;
        }

        $addressComponents = array();

        foreach ($this->addressComponents as $addressComponent) {
            if (in_array($type, $addressComponent->getTypes())) {
                $addressComponents[] = $addressComponent;
            }
        }

        return $addressComponents;
    }

public function getAddressComponents ( $ type = null ) { if ( $ type === null ) { return $ this -> addressComponents ; } $ addressComponents = array ( ) ; foreach ( $ this -> addressComponents as $ addressComponent ) { if ( in_array ( $ type , $ addressComponent -> getTypes ( ) ) ) { $ addressComponents [ ] = $ addressComponent ; } } return $ addressComponents ; }

Gets the address components.

@param string|null The type of the address components.

@return array The address components.


public function setAddressComponents(array $addressComponents)
    {
        $this->addressComponents = array();

        foreach ($addressComponents as $addressComponent) {
            $this->addAddressComponent($addressComponent);
        }
    }

public function setAddressComponents ( array $ addressComponents ) { $ this -> addressComponents = array ( ) ; foreach ( $ addressComponents as $ addressComponent ) { $ this -> addAddressComponent ( $ addressComponent ) ; } }

Sets address components.

@param array $addressComponents The address components.


public function setPartialMatch($partialMatch = null)
    {
        if (!is_bool($partialMatch) && ($partialMatch !== null)) {
            throw GeocodingException::invalidGeocoderResultPartialMatch();
        }

        $this->partialMatch = $partialMatch;
    }

public function setPartialMatch ( $ partialMatch = null ) { if ( ! is_bool ( $ partialMatch ) && ( $ partialMatch !== null ) ) { throw GeocodingException :: invalidGeocoderResultPartialMatch ( ) ; } $ this -> partialMatch = $ partialMatch ; }

Sets the geocoder result partial match flag.

@param boolean $partialMatch TRUE if the geocoder result is a partial match else FALSE.

@throws \Ivory\GoogleMap\Exception\GeocodingException If the partial match flag is not valid.

Sets the geocoder result partial match flag .


public function url(string $email, int $size = 64, string $scheme = ''): string
    {
        $md5 = md5(mb_strtolower($this->c::mbTrim($email)));
        return $this->c::setScheme('https://www.gravatar.com/avatar/'.$md5.'?s='.$size, $scheme);
    }

public function url ( string $ email , int $ size = 64 , string $ scheme = '' ) : string { $ md5 = md5 ( mb_strtolower ( $ this -> c :: mbTrim ( $ email ) ) ) ; return $ this -> c :: setScheme ( 'https://www.gravatar.com/avatar/' . $ md5 . '?s=' . $ size , $ scheme ) ; }

Get a user gravatar.

@since 160114 Initial release.

@param string $email  Email address.
@param int    $size   A valid gravatar size.
@param string $scheme Specific scheme?

@return string Gravatar URL.


public function setCenter()
    {
        $args = func_get_args();

        if (isset($args[0]) && ($args[0] instanceof Coordinate)) {
            $this->center = $args[0];
        } elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1]))) {
            $this->center->setLatitude($args[0]);
            $this->center->setLongitude($args[1]);

            if (isset($args[2]) && is_bool($args[2])) {
                $this->center->setNoWrap($args[2]);
            }
        } else {
            throw MapException::invalidCenter();
        }
    }

public function setCenter ( ) { $ args = func_get_args ( ) ; if ( isset ( $ args [ 0 ] ) && ( $ args [ 0 ] instanceof Coordinate ) ) { $ this -> center = $ args [ 0 ] ; } elseif ( ( isset ( $ args [ 0 ] ) && is_numeric ( $ args [ 0 ] ) ) && ( isset ( $ args [ 1 ] ) && is_numeric ( $ args [ 1 ] ) ) ) { $ this -> center -> setLatitude ( $ args [ 0 ] ) ; $ this -> center -> setLongitude ( $ args [ 1 ] ) ; if ( isset ( $ args [ 2 ] ) && is_bool ( $ args [ 2 ] ) ) { $ this -> center -> setNoWrap ( $ args [ 2 ] ) ; } } else { throw MapException :: invalidCenter ( ) ; } }

Sets the map center.

Available prototypes:
- function setCenter(Ivory\GoogleMap\Base\Coordinate $center)
- function setCenter(double $latitude, double $longitude, boolean $noWrap = true)

@throws \Ivory\GoogleMap\Exception\MapException If the center is not valid (prototypes).


public function hasMapOption($mapOption)
    {
        if (!is_string($mapOption)) {
            throw MapException::invalidMapOption();
        }

        return isset($this->mapOptions[$mapOption]);
    }

public function hasMapOption ( $ mapOption ) { if ( ! is_string ( $ mapOption ) ) { throw MapException :: invalidMapOption ( ) ; } return isset ( $ this -> mapOptions [ $ mapOption ] ) ; }

Checks if the map option exists.

@param string $mapOption The map option.

@throws \Ivory\GoogleMap\Exception\MapException If the map option is not valid.

@return boolean TRUE if the map option exists else FALSE.


public function setMapOptions(array $mapOptions)
    {
        foreach ($mapOptions as $mapOption => $value) {
            $this->setMapOption($mapOption, $value);
        }
    }

public function setMapOptions ( array $ mapOptions ) { foreach ( $ mapOptions as $ mapOption => $ value ) { $ this -> setMapOption ( $ mapOption , $ value ) ; } }

Sets the map options.

@param array $mapOptions The map options.


public function getMapOption($mapOption)
    {
        if (!$this->hasMapOption($mapOption)) {
            throw MapException::mapOptionDoesNotExist($mapOption);
        }

        return $this->mapOptions[$mapOption];
    }

public function getMapOption ( $ mapOption ) { if ( ! $ this -> hasMapOption ( $ mapOption ) ) { throw MapException :: mapOptionDoesNotExist ( $ mapOption ) ; } return $ this -> mapOptions [ $ mapOption ] ; }

Gets a specific map option.

@param string $mapOption The map option.

@throws \Ivory\GoogleMap\Exception\MapException If the map option does not exist.

@return mixed The map option value.


public function setMapOption($mapOption, $value)
    {
        if (!is_string($mapOption)) {
            throw MapException::invalidMapOption();
        }

        $this->mapOptions[$mapOption] = $value;
    }

public function setMapOption ( $ mapOption , $ value ) { if ( ! is_string ( $ mapOption ) ) { throw MapException :: invalidMapOption ( ) ; } $ this -> mapOptions [ $ mapOption ] = $ value ; }

Sets a specific map option

@param string $mapOption The map option.
@param mixed  $value     The map option value.

@throws \Ivory\GoogleMap\Exception\MapException If the map option is not valid.


public function removeMapOption($mapOption)
    {
        if (!$this->hasMapOption($mapOption)) {
            throw MapException::mapOptionDoesNotExist($mapOption);
        }

        unset($this->mapOptions[$mapOption]);
    }

public function removeMapOption ( $ mapOption ) { if ( ! $ this -> hasMapOption ( $ mapOption ) ) { throw MapException :: mapOptionDoesNotExist ( $ mapOption ) ; } unset ( $ this -> mapOptions [ $ mapOption ] ) ; }

Removes a map option.

@param string $mapOption The map option.

@throws \Ivory\GoogleMap\Exception\MapException If the map option does not exist.


public function hasStylesheetOption($stylesheetOption)
    {
        if (!is_string($stylesheetOption)) {
            throw MapException::invalidStylesheetOption();
        }

        return isset($this->stylesheetOptions[$stylesheetOption]);
    }

public function hasStylesheetOption ( $ stylesheetOption ) { if ( ! is_string ( $ stylesheetOption ) ) { throw MapException :: invalidStylesheetOption ( ) ; } return isset ( $ this -> stylesheetOptions [ $ stylesheetOption ] ) ; }

Checks if the stylesheet option exists.

@param string $stylesheetOption The stylesheet option.

@throws \Ivory\GoogleMap\Exception\MapException If the stylesheet option is not valid.

@return boolean TRUE if the stylesheet option exists else FALSE.

Checks if the stylesheet option exists .


public function setStylesheetOptions(array $stylesheetOptions)
    {
        foreach ($stylesheetOptions as $stylesheetOption => $value) {
            $this->setStylesheetOption($stylesheetOption, $value);
        }
    }

public function setStylesheetOptions ( array $ stylesheetOptions ) { foreach ( $ stylesheetOptions as $ stylesheetOption => $ value ) { $ this -> setStylesheetOption ( $ stylesheetOption , $ value ) ; } }

Sets the stylesheet options.

@param array $stylesheetOptions The stylesheet options.


public function getStylesheetOption($stylesheetOption)
    {
        if (!$this->hasStylesheetOption($stylesheetOption)) {
            throw MapException::stylesheetOptionDoesNotExist($stylesheetOption);
        }

        return $this->stylesheetOptions[$stylesheetOption];
    }

public function getStylesheetOption ( $ stylesheetOption ) { if ( ! $ this -> hasStylesheetOption ( $ stylesheetOption ) ) { throw MapException :: stylesheetOptionDoesNotExist ( $ stylesheetOption ) ; } return $ this -> stylesheetOptions [ $ stylesheetOption ] ; }

Gets a specific stylesheet option.

@param string $stylesheetOption  The stylesheet option.

@throws \Ivory\GoogleMap\Exception\MapException If the stylesheet option does not exist.

@return mixed The stylesheet option value.


public function setStylesheetOption($stylesheetOption, $value)
    {
        if (!is_string($stylesheetOption)) {
            throw MapException::invalidStylesheetOption();
        }

        $this->stylesheetOptions[$stylesheetOption] = $value;
    }

public function setStylesheetOption ( $ stylesheetOption , $ value ) { if ( ! is_string ( $ stylesheetOption ) ) { throw MapException :: invalidStylesheetOption ( ) ; } $ this -> stylesheetOptions [ $ stylesheetOption ] = $ value ; }

Sets a specific stylesheet option.

@param string $stylesheetOption The stylesheet option.
@param mixed  $value            The stylesheet option value.

@throws \Ivory\GoogleMap\Exception\MapException If the stylesheet option is not valid.


public function removeStylesheetOption($stylesheetOption)
    {
        if (!$this->hasStylesheetOption($stylesheetOption)) {
            throw MapException::stylesheetOptionDoesNotExist($stylesheetOption);
        }

        unset($this->stylesheetOptions[$stylesheetOption]);
    }

public function removeStylesheetOption ( $ stylesheetOption ) { if ( ! $ this -> hasStylesheetOption ( $ stylesheetOption ) ) { throw MapException :: stylesheetOptionDoesNotExist ( $ stylesheetOption ) ; } unset ( $ this -> stylesheetOptions [ $ stylesheetOption ] ) ; }

Removes a stylesheet option.

@param string $stylesheetOption The stylesheet option.

@throws \Ivory\GoogleMap\Exception\MapException If the stylesheet option does not exist.


public function setMapTypeControl()
    {
        $args = func_get_args();

        if (isset($args[0]) && ($args[0] instanceof MapTypeControl)) {
            $this->mapTypeControl = $args[0];
            $this->mapOptions['mapTypeControl'] = true;
        } elseif ((isset($args[0]) && is_array($args[0]))
            && (isset($args[1]) && is_string($args[1]))
            && (isset($args[2]) && is_string($args[2]))
        ) {
            if ($this->mapTypeControl === null) {
                $this->mapTypeControl = new MapTypeControl();
            }

            $this->mapTypeControl->setMapTypeIds($args[0]);
            $this->mapTypeControl->setControlPosition($args[1]);
            $this->mapTypeControl->setMapTypeControlStyle($args[2]);

            $this->mapOptions['mapTypeControl'] = true;
        } elseif (!isset($args[0])) {
            $this->mapTypeControl = null;

            if (isset($this->mapOptions['mapTypeControl'])) {
                unset($this->mapOptions['mapTypeControl']);
            }
        } else {
            throw MapException::invalidMapTypeControl();
        }
    }

public function setMapTypeControl ( ) { $ args = func_get_args ( ) ; if ( isset ( $ args [ 0 ] ) && ( $ args [ 0 ] instanceof MapTypeControl ) ) { $ this -> mapTypeControl = $ args [ 0 ] ; $ this -> mapOptions [ 'mapTypeControl' ] = true ; } elseif ( ( isset ( $ args [ 0 ] ) && is_array ( $ args [ 0 ] ) ) && ( isset ( $ args [ 1 ] ) && is_string ( $ args [ 1 ] ) ) && ( isset ( $ args [ 2 ] ) && is_string ( $ args [ 2 ] ) ) ) { if ( $ this -> mapTypeControl === null ) { $ this -> mapTypeControl = new MapTypeControl ( ) ; } $ this -> mapTypeControl -> setMapTypeIds ( $ args [ 0 ] ) ; $ this -> mapTypeControl -> setControlPosition ( $ args [ 1 ] ) ; $ this -> mapTypeControl -> setMapTypeControlStyle ( $ args [ 2 ] ) ; $ this -> mapOptions [ 'mapTypeControl' ] = true ; } elseif ( ! isset ( $ args [ 0 ] ) ) { $ this -> mapTypeControl = null ; if ( isset ( $ this -> mapOptions [ 'mapTypeControl' ] ) ) { unset ( $ this -> mapOptions [ 'mapTypeControl' ] ) ; } } else { throw MapException :: invalidMapTypeControl ( ) ; } }

Sets the map type control.

Available prototypes:
- function setMapTypeControl(Ivory\GoogleMap\Controls\MapTypeControl $mapTypeControl = null)
- function setMaptypeControl(array $mapTypeIds, string $controlPosition, string $mapTypeControlStyle)

@throws \Ivory\GoogleMap\Exception\MapException If the map type control is not valid (prototypes).


public function setOverviewMapControl()
    {
        $args = func_get_args();

        if (isset($args[0]) && ($args[0]) instanceof OverviewMapControl) {
            $this->overviewMapControl = $args[0];
            $this->mapOptions['overviewMapControl'] = true;
        } elseif (isset($args[0]) && is_bool($args[0])) {
            if ($this->overviewMapControl === null) {
                $this->overviewMapControl = new OverviewMapControl();
            }

            $this->overviewMapControl->setOpened($args[0]);
            $this->mapOptions['overviewMapControl'] = true;
        } elseif (!isset($args[0])) {
            $this->overviewMapControl = null;

            if (isset($this->mapOptions['overviewMapControl'])) {
                unset($this->mapOptions['overviewMapControl']);
            }
        } else {
            throw MapException::invalidOverviewMapControl();
        }
    }

public function setOverviewMapControl ( ) { $ args = func_get_args ( ) ; if ( isset ( $ args [ 0 ] ) && ( $ args [ 0 ] ) instanceof OverviewMapControl ) { $ this -> overviewMapControl = $ args [ 0 ] ; $ this -> mapOptions [ 'overviewMapControl' ] = true ; } elseif ( isset ( $ args [ 0 ] ) && is_bool ( $ args [ 0 ] ) ) { if ( $ this -> overviewMapControl === null ) { $ this -> overviewMapControl = new OverviewMapControl ( ) ; } $ this -> overviewMapControl -> setOpened ( $ args [ 0 ] ) ; $ this -> mapOptions [ 'overviewMapControl' ] = true ; } elseif ( ! isset ( $ args [ 0 ] ) ) { $ this -> overviewMapControl = null ; if ( isset ( $ this -> mapOptions [ 'overviewMapControl' ] ) ) { unset ( $ this -> mapOptions [ 'overviewMapControl' ] ) ; } } else { throw MapException :: invalidOverviewMapControl ( ) ; } }

Sets the overview map control.

Available prototypes:
- function setOverviewMapControl(Ivory\GoogleMap\Controls\OverviewMapControl $overviewMapControl = null)
- function setOverviewMapControl(boolean $opened)

@throws \Ivory\GoogleMap\Exception\MapException If the overview map control is not valid (prototypes).


public function setPanControl()
    {
        $args = func_get_args();

        if (isset($args[0]) && ($args[0] instanceof PanControl)) {
            $this->panControl = $args[0];
            $this->mapOptions['panControl'] = true;
        } elseif (isset($args[0]) && is_string($args[0])) {
            if ($this->panControl === null) {
                $this->panControl = new PanControl();
            }

            $this->panControl->setControlPosition($args[0]);
            $this->mapOptions['panControl'] = true;
        } elseif (!isset($args[0])) {
            $this->panControl = null;

            if (isset($this->mapOptions['panControl'])) {
                unset($this->mapOptions['panControl']);
            }
        } else {
            throw MapException::invalidPanControl();
        }
    }

public function setPanControl ( ) { $ args = func_get_args ( ) ; if ( isset ( $ args [ 0 ] ) && ( $ args [ 0 ] instanceof PanControl ) ) { $ this -> panControl = $ args [ 0 ] ; $ this -> mapOptions [ 'panControl' ] = true ; } elseif ( isset ( $ args [ 0 ] ) && is_string ( $ args [ 0 ] ) ) { if ( $ this -> panControl === null ) { $ this -> panControl = new PanControl ( ) ; } $ this -> panControl -> setControlPosition ( $ args [ 0 ] ) ; $ this -> mapOptions [ 'panControl' ] = true ; } elseif ( ! isset ( $ args [ 0 ] ) ) { $ this -> panControl = null ; if ( isset ( $ this -> mapOptions [ 'panControl' ] ) ) { unset ( $ this -> mapOptions [ 'panControl' ] ) ; } } else { throw MapException :: invalidPanControl ( ) ; } }

Sets the map pan control.

Available prototypes:
- function setPanControl(Ivory\GoogleMap\Controls\PanControl $panControl = null)
- function setPanControl(string $controlPosition)

@throws \Ivory\GoogleMap\Exception\MapException If the pan control is not valid (prototypes).


public function setRotateControl()
    {
        $args = func_get_args();

        if (isset($args[0]) && ($args[0] instanceof RotateControl)) {
            $this->rotateControl = $args[0];
            $this->mapOptions['rotateControl'] = true;
        } elseif (isset($args[0]) && is_string($args[0])) {
            if ($this->rotateControl === null) {
                $this->rotateControl = new RotateControl();
            }

            $this->rotateControl->setControlPosition($args[0]);
            $this->mapOptions['rotateControl'] = true;
        } elseif (!isset($args[0])) {
            $this->rotateControl = null;

            if (isset($this->mapOptions['rotateControl'])) {
                unset($this->mapOptions['rotateControl']);
            }
        } else {
            throw MapException::invalidRotateControl();
        }
    }

public function setRotateControl ( ) { $ args = func_get_args ( ) ; if ( isset ( $ args [ 0 ] ) && ( $ args [ 0 ] instanceof RotateControl ) ) { $ this -> rotateControl = $ args [ 0 ] ; $ this -> mapOptions [ 'rotateControl' ] = true ; } elseif ( isset ( $ args [ 0 ] ) && is_string ( $ args [ 0 ] ) ) { if ( $ this -> rotateControl === null ) { $ this -> rotateControl = new RotateControl ( ) ; } $ this -> rotateControl -> setControlPosition ( $ args [ 0 ] ) ; $ this -> mapOptions [ 'rotateControl' ] = true ; } elseif ( ! isset ( $ args [ 0 ] ) ) { $ this -> rotateControl = null ; if ( isset ( $ this -> mapOptions [ 'rotateControl' ] ) ) { unset ( $ this -> mapOptions [ 'rotateControl' ] ) ; } } else { throw MapException :: invalidRotateControl ( ) ; } }

Sets the map rotate control.

Available prototypes:
- function setRotateControl(Ivory\GoogleMap\Controls\RotateControl $rotateControl = null)
- function setRotateControl(string $controlPosition)

@throws \Ivory\GoogleMap\Exception\MapException If the rotate control is not valid (prototypes).


public function setScaleControl()
    {
        $args = func_get_args();

        if (isset($args[0]) && ($args[0] instanceof ScaleControl)) {
            $this->scaleControl = $args[0];
            $this->mapOptions['scaleControl'] = true;
        } elseif ((isset($args[0]) && is_string($args[0])) && (isset($args[1]) && is_string($args[1]))) {
            if ($this->scaleControl === null) {
                $this->scaleControl = new ScaleControl();
            }

            $this->scaleControl->setControlPosition($args[0]);
            $this->scaleControl->setScaleControlStyle($args[1]);

            $this->mapOptions['scaleControl'] = true;
        } elseif (!isset($args[0])) {
            $this->scaleControl = null;

            if (isset($this->mapOptions['scaleControl'])) {
                unset($this->mapOptions['scaleControl']);
            }
        } else {
            throw MapException::invalidScaleControl();
        }
    }

public function setScaleControl ( ) { $ args = func_get_args ( ) ; if ( isset ( $ args [ 0 ] ) && ( $ args [ 0 ] instanceof ScaleControl ) ) { $ this -> scaleControl = $ args [ 0 ] ; $ this -> mapOptions [ 'scaleControl' ] = true ; } elseif ( ( isset ( $ args [ 0 ] ) && is_string ( $ args [ 0 ] ) ) && ( isset ( $ args [ 1 ] ) && is_string ( $ args [ 1 ] ) ) ) { if ( $ this -> scaleControl === null ) { $ this -> scaleControl = new ScaleControl ( ) ; } $ this -> scaleControl -> setControlPosition ( $ args [ 0 ] ) ; $ this -> scaleControl -> setScaleControlStyle ( $ args [ 1 ] ) ; $ this -> mapOptions [ 'scaleControl' ] = true ; } elseif ( ! isset ( $ args [ 0 ] ) ) { $ this -> scaleControl = null ; if ( isset ( $ this -> mapOptions [ 'scaleControl' ] ) ) { unset ( $ this -> mapOptions [ 'scaleControl' ] ) ; } } else { throw MapException :: invalidScaleControl ( ) ; } }

Sets the map scale control.

Available prototypes:
- function setScaleControl(Ivory\GoogleMap\Controls\ScaleControl $scaleControl = null)
- function setScaleControl(string $controlPosition, string $scaleControlStyle)

@throws \Ivory\GoogleMap\Exception\MapException If the scale control is not valid (prototypes).


public function setStreetViewControl()
    {
        $args = func_get_args();

        if (isset($args[0]) && ($args[0] instanceof StreetViewControl)) {
            $this->streetViewControl = $args[0];
            $this->mapOptions['streetViewControl'] = true;
        } elseif (isset($args[0]) && is_string($args[0])) {
            if ($this->streetViewControl === null) {
                $this->streetViewControl = new StreetViewControl();
            }

            $this->streetViewControl->setControlPosition($args[0]);
            $this->mapOptions['streetViewControl'] = true;
        } elseif (!isset($args[0])) {
            $this->streetViewControl = null;

            if (isset($this->mapOptions['streetViewControl'])) {
                unset($this->mapOptions['streetViewControl']);
            }
        } else {
            throw MapException::invalidStreetViewControl();
        }
    }

public function setStreetViewControl ( ) { $ args = func_get_args ( ) ; if ( isset ( $ args [ 0 ] ) && ( $ args [ 0 ] instanceof StreetViewControl ) ) { $ this -> streetViewControl = $ args [ 0 ] ; $ this -> mapOptions [ 'streetViewControl' ] = true ; } elseif ( isset ( $ args [ 0 ] ) && is_string ( $ args [ 0 ] ) ) { if ( $ this -> streetViewControl === null ) { $ this -> streetViewControl = new StreetViewControl ( ) ; } $ this -> streetViewControl -> setControlPosition ( $ args [ 0 ] ) ; $ this -> mapOptions [ 'streetViewControl' ] = true ; } elseif ( ! isset ( $ args [ 0 ] ) ) { $ this -> streetViewControl = null ; if ( isset ( $ this -> mapOptions [ 'streetViewControl' ] ) ) { unset ( $ this -> mapOptions [ 'streetViewControl' ] ) ; } } else { throw MapException :: invalidStreetViewControl ( ) ; } }

Sets the map street view control.

Available prototypes:
- function setStreetViewControl(Ivory\GoogleMap\Controls\StreetViewControl $streetViewControl = null)
- function setStreetViewControl(string $controlPosition)

@throws \Ivory\GoogleMap\Exception\MapException If the street view control is not valid (prototypes).