Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-vault
Model
PaymentTokenFactory.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Vault\Model
;
8
9
use
Magento\Framework\ObjectManagerInterface
;
10
use
Magento\Vault\Api\Data\PaymentTokenFactoryInterface
;
11
use
Magento\Vault\Api\Data\PaymentTokenInterface
;
12
18
class
PaymentTokenFactory
implements
PaymentTokenFactoryInterface
19
{
23
private
$tokenTypes = [];
24
28
private
$objectManager;
29
35
public
function
__construct
(
ObjectManagerInterface
$objectManager, array $tokenTypes = [])
36
{
37
$this->objectManager =
$objectManager
;
38
$this->tokenTypes = $tokenTypes;
39
}
40
47
public
function
create
(
$type
=
null
)
48
{
53
if
(is_array(
$type
)) {
54
return
$this->objectManager->create(
55
PaymentTokenInterface::class,
56
$type
57
);
58
}
59
60
if
(
$type
!==
null
&& !in_array(
$type
, $this->tokenTypes,
true
)) {
61
throw
new \LogicException(
'There is no such payment token type: '
.
$type
);
62
}
63
64
return
$this->objectManager->create(
65
PaymentTokenInterface::class,
66
[
'data'
=> [
PaymentTokenInterface::TYPE
=>
$type
]]
67
);
68
}
69
}
Magento\Vault\Model\PaymentTokenFactory\__construct
__construct(ObjectManagerInterface $objectManager, array $tokenTypes=[])
Definition:
PaymentTokenFactory.php:35
$objectManager
$objectManager
Definition:
bootstrap.php:17
Magento\Framework\ObjectManagerInterface
Definition:
ObjectManagerInterface.php:12
Magento\Vault\Api\Data\PaymentTokenFactoryInterface
Definition:
PaymentTokenFactoryInterface.php:14
$type
$type
Definition:
item.phtml:13
Magento\Vault\Model\PaymentTokenFactory
Definition:
PaymentTokenFactory.php:18
Magento\Vault\Model\PaymentTokenFactory\create
create($type=null)
Definition:
PaymentTokenFactory.php:47
Magento\Vault\Api\Data\PaymentTokenInterface\TYPE
const TYPE
Definition:
PaymentTokenInterface.php:38
Magento\Vault\Model
Definition:
PaymentTokenRepositoryTest.php:6
Magento\Vault\Api\Data\PaymentTokenInterface
Definition:
PaymentTokenInterface.php:14