This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452'; | |
$client = new \GuzzleHttp\Client; | |
$response = $client->get($url, [ | |
'headers' => ['Accept' => application/json], | |
])->getBody(); | |
$array = json_decode($response, TRUE); | |
$iterator = new \RecursiveIteratorIterator( | |
new \RecursiveArrayIterator($array), | |
\RecursiveIteratorIterator::SELF_FIRST); | |
// Recurse through the result array. When there is an array of items at the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class GmapJSONReader extends JSONReader { | |
public function getSourceFields($url) { | |
$items = parent::getSourceFields($url); | |
// Loop over the JSON values, walk the tree and extract as keyed values. | |
foreach ($items as &$item) { | |
if (isset($item['address_components']) && is_array($item['address_components'])) { | |
foreach ($item['address_components'] as $component) { | |
if (isset($component['long_name']) && isset($component['types']) && is_array($component['types'])) { | |
foreach ($component['types'] as $type) { | |
$item[$type] = $component['long_name']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
profiles:juanca* master$ drush cim sync -y | |
Collection Config Operation | |
system.menu.account create | |
block.block.bartik_branding create | |
block.block.bartik_breadcrumbs create | |
block.block.bartik_content create | |
system.menu.footer create | |
block.block.bartik_local_actions create | |
block.block.bartik_local_tasks create | |
system.menu.main create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>homework1</title> | |
</head> | |
<body> | |