Transport\Entity\LocationFactory::createFromJson PHP Method

createFromJson() public static method

public static createFromJson ( $json )
    public static function createFromJson($json)
    {
        return Location\Station::createStationFromJson($json);
    }

Usage Example

    public function testCreateFromJsonWithUmlaute()
    {
        $jsonString = <<<'EOF'
{
    "extId": "8508489", 
    "name": "N&#252;mmerland", 
    "prodclass": "16",
    "puic": "85", 
    "urlname": "N%FCmmerland", 
    "x": "8382324", 
    "y": "47003057"
}
EOF;
        $station = new Station();
        $station->name = 'Nümmerland';
        $station->id = 8508489;
        $coordinate = new Coordinate();
        $coordinate->type = 'WGS84';
        $coordinate->x = 47.003057;
        $coordinate->y = 8.382324000000001;
        $station->coordinate = $coordinate;
        $this->assertEquals($station, LocationFactory::createFromJson(json_decode($jsonString)));
    }
All Usage Examples Of Transport\Entity\LocationFactory::createFromJson