Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: /www/gimpster.com/php/phpweather/data_retrieval.php
PHP Weather - PHP Weather

data_retrieval

base_object
   |
  +-- db_layer
     |
    +-- data_retrieval

This class contains all the logic needed to get and store METARs.

 

private class data_retrieval extends db_layer

This class contains all the logic needed to get and store METARs.
It manages the caching system, the station and the METAR.

AuthorsMartin Geisler <gimpster@gimpster.com>
Versiondata_retrieval.html,v 1.6 2001/06/27 11:35:43 gimpster Exp

 
Direct known subclasses: metar_parser

Methods inherited from db_layer

db_layer, set_db_type, get_db_type

Methods inherited from base_object

base_object, error, debug, print_properties

Public Method Summary

string

get_icao()

Returns the current ICAO.
void

set_icao(string $new_icao)

Sets the station or rather the ICAO.
string

get_metar()

Retrieves a raw METAR, either from the web or from a database.
string

get_metar_from_db()

Tries to get a METAR from the database.
string

get_metar_from_web(boolean $new_station)

Fetches a METAR from the Internet.

Private Method Summary

void

data_retrieval(array $input)

Constructor
void

get_location()

Warning: documentation is missing.

Fields inherited from db_layer

$db

Fields inherited from base_object

$properties, $version

Private Field Summary

string

$metar

The METAR is stored here.
string

$location

The location of the station, eg. something like 'Aalborg, Denmark'.

Public Method Details

get_icao

public string get_icao( )

  Returns the current ICAO.

Returns string

The station-ICAO


set_icao

public void set_icao( string $new_icao )

  Sets the station or rather the ICAO.
It also clear the METAR and decoded METAR if the station is different from the old one. If the new station is the same as the old one, nothing is changed.

Parameter
string $new_icao
ICAO of the new station.
Returns void


get_metar

public string get_metar( )

  Retrieves a raw METAR, either from the web or from a database.
If the METAR is already set, then it just return that. If it's not set, then it tries to get it from the database.

Returns string

The raw METAR.


get_metar_from_db

public string get_metar_from_db( )

  Tries to get a METAR from the database.
It looks in the database, and fetches a new METAR is necessary.You do not have to be connected to the database before you callthis function, just make sure that you have passed the rightproperties to the object.If $this->properties['always_use_db'] is true, then it ignoresthe timestamp of the METAR and just returns it. Otherwise it willtry to get a new METAR from the web, if the old one is older thatone hour.

Returns string

The raw METAR.


get_metar_from_web

public string get_metar_from_web( boolean $new_station )

  Fetches a METAR from the Internet.
The METAR is fetched via HTTP from the National Weather Services public server at http://weather.noaa.gov.

Parameter
boolean $new_station
the station be inserted into the database, or should we update an all ready existing entry?
Returns string

The raw METAR.


Private Method Details

data_retrieval

private void data_retrieval( array $input )

  Constructor
This sets the station.

Parameter
array $input
initial properties of the object.
Returns void


get_location

private void get_location( )

 

Warning: documentation is missing.

Returns void


Private Field Details

$metar

private string $metar

>><<

The METAR is stored here.
The property is used when-ever someone want access to the rawMETAR. Although you shouldn't do it, it is possible to set thisdirectly. But that is only something the developers should do fortesting... :-)


$location

private string $location

>><<

The location of the station, eg. something like 'Aalborg, Denmark'.



Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta