mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php namespace Visiosoft\ProfileModule;
|
|
|
|
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
|
|
use Visiosoft\ProfileModule\Adress\Command\GetAddress;
|
|
use Visiosoft\ProfileModule\Adress\Command\GetAddressByUser;
|
|
use Visiosoft\ProfileModule\Profile\Command\GetProfileDetail;
|
|
|
|
class ProfileModulePlugin extends Plugin
|
|
{
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function getFunctions()
|
|
{
|
|
return [
|
|
new \Twig_SimpleFunction(
|
|
'getAddress',
|
|
function ($id) {
|
|
|
|
if (!$ad = $this->dispatch(new GetAddress($id))) {
|
|
return null;
|
|
}
|
|
|
|
return $ad;
|
|
}
|
|
),
|
|
new \Twig_SimpleFunction(
|
|
'getAddressByUser',
|
|
function ($user_id) {
|
|
|
|
if (!$ad = $this->dispatch(new GetAddressByUser($user_id))) {
|
|
return null;
|
|
}
|
|
|
|
return $ad;
|
|
}
|
|
),
|
|
new \Twig_SimpleFunction(
|
|
'getProfileDetail',
|
|
function ($user_id) {
|
|
|
|
if (!$ad = $this->dispatch(new GetProfileDetail($user_id))) {
|
|
return null;
|
|
}
|
|
|
|
return $ad;
|
|
}
|
|
)
|
|
];
|
|
}
|
|
}
|