mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
41 lines
987 B
PHP
41 lines
987 B
PHP
<?php namespace Visiosoft\LocationModule;
|
|
|
|
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
|
|
use Visiosoft\LocationModule\District\Command\GetDistrict;
|
|
use Visiosoft\LocationModule\Neighborhood\Command\GetNeighborhood;
|
|
|
|
class LocationModulePlugin extends Plugin
|
|
{
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function getFunctions()
|
|
{
|
|
return [
|
|
new \Twig_SimpleFunction(
|
|
'getDistrict',
|
|
function ($id) {
|
|
|
|
if (!$ad = $this->dispatch(new GetDistrict($id))) {
|
|
return null;
|
|
}
|
|
|
|
return $ad;
|
|
}
|
|
),
|
|
new \Twig_SimpleFunction(
|
|
'getNeighborhood',
|
|
function ($id) {
|
|
|
|
if (!$ad = $this->dispatch(new GetNeighborhood($id))) {
|
|
return null;
|
|
}
|
|
|
|
return $ad;
|
|
}
|
|
),
|
|
];
|
|
}
|
|
}
|