Services_OpenStreetMap

# Class: Services_OpenStreetMap_Config

Source Location: /OpenStreetMap/Config.php

### Class Overview

Services_OpenStreetMap_Config

#### Author(s):

- Ken Guest <kguest@php.net>

### Variables

- $api_version
- $areaMaximum
- $changesetMaximumElements
- $config
- $generator
- $maxVersion
- $minVersion
- $server
- $timeout
- $tracepointsPerPage
- $waynodesMaximum

### Methods

- asArray
- getGenerator
- getMaxArea
- getMaxElements
- getMaxNodes
- getMaxVersion
- getMinVersion
- getTimeout
- getTracepointsPerPage
- getTransport
- getValue
- getXmlValue
- setPasswordfile
- setServer
- setTransport
- setValue

### Class Details

[line 25]
Services_OpenStreetMap_Config

#### Tags:

author: | Ken Guest <kguest@php.net>
link: | Config.php
license: | BSD

[ Top ]

### Class Variables

#### $api_version = '0.6'

[line 100]

Version of the [OSM] API which communications will be over.

#### Tags:

access: | protected

Type: | string

[ Top ]

#### $areaMaximum = null

[line 75]

Max size of area that can be downloaded in one request.

#### Tags:

access: | protected

Type: | float

[ Top ]

#### $changesetMaximumElements = null

[line 54]

number of elements allowed per changeset

#### Tags:

access: | protected

Type: | integer

[ Top ]

#### $config = array(
'adapter' => 'HTTP_Request2_Adapter_Socket',
'api_version' => '0.6',
'password' => null,
'passwordfile' => null,
'server' => 'http://api.openstreetmap.org/',
'User-Agent' => 'Services_OpenStreetMap',
'user' => null,
'verbose' => false,
)

[line 84]

Default config settings

#### Tags:

see: | Services_OpenStreetMap::getConfig
see: | Services_OpenStreetMap::setConfig
access: | protected

Type: | array

[ Top ]

#### $generator = 'Generator'

[line 115]

Capabilities XML generated by...

#### Tags:

access: | protected

Type: | string

[ Top ]

#### $maxVersion = null

[line 40]

Maximum version of the OSM API that is supported.

#### Tags:

access: | protected

Type: | float

[ Top ]

#### $minVersion = null

[line 33]

Minimum version of the OSM API that is supported.

#### Tags:

access: | protected

Type: | float

[ Top ]

#### $server = 'http://api.openstreetmap.org/'

[line 107]

Server to connect to.

#### Tags:

access: | protected

Type: | string

[ Top ]

#### $timeout = null

[line 47]

timeout, in seconds.

#### Tags:

access: | protected

Type: | integer

[ Top ]

#### $tracepointsPerPage = null

[line 68]

Number of tracepoints per way.

#### Tags:

access: | protected

Type: | integer

[ Top ]

#### $waynodesMaximum = null

[line 61]

Maximum number of nodes per way.

#### Tags:

access: | protected

Type: | integer

[ Top ]

### Class Methods

### method asArray [line 341]

`array asArray( )`

Return all config settings in an array.

#### Tags:

access: | public

[ Top ]

### method getGenerator [line 529]

`string getGenerator( )`

Name of what generated the Capabilities XML

#### Tags:

access: | public

[ Top ]

### method getMaxArea [line 429]

`float getMaxArea( )`

Max size of area that can be downloaded in one request.

1. $osm = new Services_OpenStreetMap();
2. $area_allowed = $osm->getMaxArea();

#### Tags:

access: | public

[ Top ]

### method getMaxElements [line 519]

`float getMaxElements( )`

Number of elements allowed per changeset

1. $osm = new Services_OpenStreetMap();
2. $max = $osm->getMaxElements();

#### Tags:

access: | public

[ Top ]

### method getMaxNodes [line 504]

`float getMaxNodes( )`

Maximum number of nodes per way.

Anymore than that and the way must be split.

1. $osm = new Services_OpenStreetMap();
2. $max = $osm->getMaxNodes();

#### Tags:

access: | public

[ Top ]

### method getMaxVersion [line 461]

`float getMaxVersion( )`

maxVersion - max API version supported by connected server.

1. $config = array('user' => 'fred@example.net', 'password' => 'wilma4eva');
2. $osm = new Services_OpenStreetMap($config);
3. $max = $osm->getMaxVersion();

#### Tags:

access: | public

[ Top ]

### method getMinVersion [line 445]

`float getMinVersion( )`

minVersion - min API version supported by connected server.

1. $config = array('user' => 'fred@example.net', 'password' => 'wilma4eva');
2. $osm = new Services_OpenStreetMap($config);
3. $min = $osm->getMinVersion();

#### Tags:

access: | public

[ Top ]

### method getTimeout [line 472]

`int getTimeout( )`

Return the number of seconds that must elapse before a connection is considered to have timed-out.

#### Tags:

access: | public

[ Top ]

### method getTracepointsPerPage [line 487]

`float getTracepointsPerPage( )`

Maximum number of tracepoints per page.

1. $osm = new Services_OpenStreetMap();
2. $tracepoints = $osm->getTracepointsPerPage();

#### Tags:

access: | public

[ Top ]

### method getTransport [line 331]

`Services_OpenStreetMap_Transport. getTransport( )`

Retrieve the current Transport instance.

#### Tags:

access: | public

[ Top ]

### method getValue [line 132]

`mixed getValue( [string $name = null])`

Get the value of a configuration setting - if none is set all are returned.

1. $config = $osm->getConfig();

#### Tags:

return: | value of $name parameter, array of all configuration parameters if $name is not given
throws: | Services_OpenStreetMap_InvalidArgumentException If the parameter is unknown
access: | public

#### Parameters:

string | $name | name. optional.

[ Top ]

### method getXmlValue [line 544]

`string getXmlValue( SimpleXMLElement $xml, string $tag, string $attribute, [mixed $default = null])`

getXmlValue

#### Tags:

access: | public

#### Parameters:

SimpleXMLElement | $xml | Object
string | $tag | name of tag
string | $attribute | name of attribute
mixed | $default | default value

[ Top ]

### method setPasswordfile [line 274]

`Services_OpenStreetMap setPasswordfile( string $file)`

Set and parse a password file, setting username and password as specified in the file.

A password file is a ASCII text file, with username and passwords pairs on each line, seperated [delimited] by a semicolon. Lines starting with a hash [#] are comments. If only one non-commented line is present in the file, that username and password will be used for authentication. If more than one set of usernames and passwords are present, the username must be specified, and the matching password from the file will be used.

     # Example password file.
     fredfs@example.com:Wilma4evah
     barney@example.net:B3ttyRawks

#### Tags:

access: | public

#### Parameters:

string | $file | file containing credentials

[ Top ]

### method setServer [line 228]

`Services_OpenStreetMap setServer( string $server)`

Connect to specified server.

#### Tags:

access: | public

#### Parameters:

string | $server | base server details, e.g. http://api.openstreetmap.org

[ Top ]

### method setTransport [line 320]

`Services_OpenStreetMap_Config setTransport( Services_OpenStreetMap_Transport $transport)`

Set the Transport instance.

#### Tags:

access: | public

#### Parameters:

Services_OpenStreetMap_Transport | $transport | Transport instance.

[ Top ]

### method setValue [line 173]

`Services_OpenStreetMap_Config setValue( mixed $config, [mixed $value = null])`

set at least one configuration variable.

     $osm->setConfig('user', 'fred@example.com');
     $osm->setConfig(array('user' => 'fred@example.com', 'password' => 'Simples'));
     $osm->setConfig('user' => 'f@example.com')->setConfig('password' => 'Sis');

The following parameters are available:

- 'adapter' - adapter to use (string)
- 'api_version' - Version of API to communicate via (string)
- 'password' - password (string, optional)
- 'passwordfile' - passwordfile (string, optional)
- 'server' - server to connect to (string)
- 'User-Agent' - User-Agent (string)
- 'user' - user (string, optional)
- 'verbose' - verbose (boolean, optional)

#### Tags:

throws: | Services_OpenStreetMap_InvalidArgumentException If the parameter is unknown
access: | public

#### Parameters:

mixed | $config | array containing config settings
mixed | $value | config value if $config is not an array

[ Top ]

Documentation generated on Wed, 26 Sep 2012 01:24:52 +0100 by phpDocumentor 1.4.4