objectManager = $objectManager; $this->tokenTypes = $tokenTypes; } /** * Create payment token entity * @param $type string * @return PaymentTokenInterface * @since 101.0.0 */ public function create($type = null) { /** * This code added for Backward Compatibility reasons only, as previous implementation of Code Generated factory * accepted an array as any other code generated factory */ if (is_array($type)) { return $this->objectManager->create( PaymentTokenInterface::class, $type ); } if ($type !== null && !in_array($type, $this->tokenTypes, true)) { throw new \LogicException('There is no such payment token type: ' . $type); } return $this->objectManager->create( PaymentTokenInterface::class, ['data' => [PaymentTokenInterface::TYPE => $type]] ); } }