- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
public function toArray()
{
$that = $this;
$profile = $this->getProfile();
return [
'sex' => $profile->getSex(),
'distance' => (int) $profile->get($profile::FIELD_DISTANCE),
'balance' => new Object_Response_Model_User_Balance($profile->get($profile::FIELD_BALANCE)),
'payments' => call_user_func(function() use ($that) {
$return = [];
$checkoutTypes = $that->getRelationCheckoutTypes()->find_all()->as_array();
foreach($checkoutTypes as $checkoutType) {
if (json_decode($checkoutType->data)[0]->value) {
$return[] = $checkoutType;
}
}
return $return;
}),
'vk' => $this->getRelationSocial()->getProfileUrl(),
'validate' => $this->getValidate()
];
};
Автор: просто php нам дало анонимные функции, почему бы ими не пользоваться?
tirinox 09.09.2014 16:22 # +3
Жаль нельзя 'payments' => (function () { ... }) ()
someone 10.09.2014 12:27 # +3
inkanus-gray 10.09.2014 15:48 # +2
gost 11.09.2014 14:07 # +1
Глобальный питух.
1024-- 11.09.2014 15:40 # +2
Elvenfighter 10.09.2014 19:23 # +1
По Фрейду.
Fike 11.09.2014 00:51 # +1
http://i455.photobucket.com/albums/qq280/EvilEvilAnchovies/PassportExample.png
Elvenfighter 11.09.2014 16:01 # +1
Fike 11.09.2014 16:39 # +2
guest 13.09.2014 18:27 # 0
Fike 13.09.2014 19:40 # +2
guest 13.09.2014 19:51 # +1
COMHPiI 25.08.2021 02:32 # 0