Json
extends Intensity
in package
Fetch Json intensity data from HSIT portal
Table of Contents
Constants
- fileExtension = 'json'
- templateUrl = 'https://e.hsit.it/%d/%d_%s%s.%s'
Properties
- $fetchMunicipality : bool
- $idQuake : Id
- $localFileFullPath : string|null
- $macroseismicStudyName : string
- $places : array<string|int, mixed>
Methods
- __construct() : mixed
- fetch() : int
- fetch data from url (remote or local - if $localFileFullPath is set in __construct)
- getIterator() : array<string|int, mixed>
- get all places intensity
- fetchFromLocalPath() : array<string|int, mixed>
- fetch data from local path - if $localFileFullPath is set in __construct)
- fetchFromUrl() : array<string|int, mixed>
- fetch data from remote url path - if $localFileFullPath is set NOT in __construct)
- isValidType() : bool
- check if macroseismic scale study is supported
Constants
fileExtension
protected
mixed
fileExtension
= 'json'
templateUrl
protected
mixed
templateUrl
= 'https://e.hsit.it/%d/%d_%s%s.%s'
Properties
$fetchMunicipality
protected
bool
$fetchMunicipality
= true
$idQuake
protected
Id
$idQuake
$localFileFullPath
protected
string|null
$localFileFullPath
= null
$macroseismicStudyName
protected
string
$macroseismicStudyName
$places
protected
array<string|int, mixed>
$places
= array()
Methods
__construct()
public
__construct(Id $fdsnQuakeId, string $macroseismicStudyName[, bool|null $fetchMunicipality = true ][, string|null $localFileFullPath = null ]) : mixed
Parameters
- $fdsnQuakeId : Id
- $macroseismicStudyName : string
- $fetchMunicipality : bool|null = true
- $localFileFullPath : string|null = null
fetch()
fetch data from url (remote or local - if $localFileFullPath is set in __construct)
public
fetch() : int
Return values
int —number of data found
getIterator()
get all places intensity
public
getIterator() : array<string|int, mixed>
Return values
array<string|int, mixed> —locality intensity (array of associative arrays[lat, lon, intensity, reports, placeName] )
fetchFromLocalPath()
fetch data from local path - if $localFileFullPath is set in __construct)
protected
fetchFromLocalPath() : array<string|int, mixed>
Return values
array<string|int, mixed> —data from file, splitted in array of lines
fetchFromUrl()
fetch data from remote url path - if $localFileFullPath is set NOT in __construct)
protected
fetchFromUrl() : array<string|int, mixed>
Return values
array<string|int, mixed> —data from file, splitted in array of lines
isValidType()
check if macroseismic scale study is supported
private
isValidType(string $macroseismicStudyName) : bool
Parameters
- $macroseismicStudyName : string
-
name of the macroseismic scale study
Return values
bool —TRUE if is supported, FALSE otherwise