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
framework
TestFramework
Unit
Autoloader
FactoryGenerator.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Framework\TestFramework\Unit\Autoloader
;
8
9
use
Magento\Framework\Code\Generator\ClassGenerator
;
10
14
class
FactoryGenerator
implements
GeneratorInterface
15
{
22
public
function
generate
(
$className
)
23
{
24
if
(!$this->isFactory(
$className
)) {
25
return
false
;
26
}
27
$methods
= [[
28
'name'
=>
'create'
,
29
'parameters'
=> [[
'name'
=>
'data'
,
'type'
=>
'array'
,
'defaultValue'
=> []]],
30
'body'
=>
''
,
31
]];
32
$classGenerator =
new
ClassGenerator
();
33
$classGenerator->setName(
$className
)
34
->addMethods(
$methods
);
35
return
$classGenerator->generate();
36
}
37
44
private
function
isFactory(
$className
)
45
{
46
$sourceName = rtrim(substr(
$className
, 0, -strlen(
'Factory'
)),
'\\'
);
47
return
$sourceName .
'Factory'
==
$className
;
48
}
49
}
Magento\Framework\TestFramework\Unit\Autoloader\GeneratorInterface
Definition:
GeneratorInterface.php:12
Magento\Framework\TestFramework\Unit\Autoloader\FactoryGenerator
Definition:
FactoryGenerator.php:14
Magento\Framework\TestFramework\Unit\Autoloader\FactoryGenerator\generate
generate($className)
Definition:
FactoryGenerator.php:22
Magento\Framework\Code\Generator\ClassGenerator
Definition:
ClassGenerator.php:11
$methods
$methods
Definition:
billing.phtml:71
Magento\Framework\TestFramework\Unit\Autoloader
Definition:
ExtensionAttributesGenerator.php:7
$className
if($currentSelectedMethod==$_code) $className
Definition:
form.phtml:31