/** * @param GatewayInterface $gateway * @param ArrayObject $model */ protected function createCustomer(GatewayInterface $gateway, ArrayObject $model) { if ($model['customer']) { return; } if (false == ($model['card'] && is_string($model['card']))) { return; } $local = $model->getArray('local'); if (false == $local['save_card']) { return; } $customer = $local->getArray('customer'); $customer['card'] = $model['card']; $gateway->execute(new CreateCustomer($customer)); $local['customer'] = $customer->toUnsafeArray(); $model['local'] = $local->toUnsafeArray(); unset($model['card']); if ($customer['id']) { $model['customer'] = $customer['id']; } else { $model['status'] = Constants::STATUS_FAILED; } }
public function shouldAllowGetArrayAsArrayObjectIfNotSet() { $array = new ArrayObject(); $subArray = $array->getArray('foo'); $this->assertInstanceOf(ArrayObject::class, $subArray); $this->assertEquals([], (array) $subArray); }