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
magento2-base
dev
tests
static
framework
Magento
TestFramework
Integrity
Library
PhpParser
Uses.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\TestFramework\Integrity\Library\PhpParser
;
7
12
class
Uses
implements
ParserInterface
13
{
19
protected
$parseUse
=
false
;
20
26
protected
$uses
= [];
27
33
public
function
hasUses
()
34
{
35
return
!empty($this->uses);
36
}
37
41
protected
function
createEmptyItem
()
42
{
43
$this->uses[] =
''
;
44
}
45
52
public
function
getClassNameWithNamespace
(
$class
)
53
{
54
if
(preg_match(
'#^\\\\#'
,
$class
)) {
55
return
$class
;
56
}
57
58
preg_match(
'#^([A-Za-z0-9_]+)(.*)$#'
,
$class
, $match);
59
foreach
($this->uses as $use) {
60
if
(preg_match(
'#^([A-Za-z0-9_\\\\]+)\s+as\s+(.*)$#'
, $use, $useMatch) && $useMatch[2] == $match[1]) {
61
$class
= $useMatch[1] . $match[2];
62
break
;
63
}
64
$packages = explode(
'\\'
, $use);
65
end($packages);
66
$lastPackageKey = key($packages);
67
if
($packages[$lastPackageKey] == $match[1]) {
68
$class
= $use . $match[2];
69
}
70
}
71
return
$class
;
72
}
73
79
protected
function
appendToLast
(
$value
)
80
{
81
end($this->uses);
82
$this->uses[key($this->uses)] = ltrim($this->uses[key($this->uses)] .
$value
);
83
}
84
90
protected
function
isParseInProgress
()
91
{
92
return
$this->parseUse
;
93
}
94
98
protected
function
stopParse
()
99
{
100
$this->parseUse =
false
;
101
}
102
106
protected
function
startParse
()
107
{
108
$this->parseUse =
true
;
109
}
110
114
public
function
parse
(
$token
, $key)
115
{
116
if
(is_array(
$token
)) {
117
if
($this->
isParseInProgress
()) {
118
$this->
appendToLast
(
$token
[1]);
119
}
120
if
(T_USE ==
$token
[0]) {
121
$this->
startParse
();
122
$this->
createEmptyItem
();
123
}
124
}
else
{
125
if
($this->
isParseInProgress
()) {
126
if
(
$token
==
';'
) {
127
$this->
stopParse
();
128
}
129
if
(
$token
==
','
) {
130
$this->
createEmptyItem
();
131
}
132
}
133
}
134
}
135
}
Magento\TestFramework\Integrity\Library\PhpParser\Uses\$uses
$uses
Definition:
Uses.php:26
Magento\TestFramework\Integrity\Library\PhpParser
Definition:
DependenciesCollectorInterface.php:6
Magento\TestFramework\Integrity\Library\PhpParser\ParserInterface
Definition:
ParserInterface.php:12
$token
$token
Definition:
fake_payment_token.php:14
Magento\TestFramework\Integrity\Library\PhpParser\Uses\stopParse
stopParse()
Definition:
Uses.php:98
$class
$_option $_optionId $class
Definition:
date.phtml:13
$value
$value
Definition:
gender.phtml:16
Magento\TestFramework\Integrity\Library\PhpParser\Uses
Definition:
Uses.php:12
Magento\TestFramework\Integrity\Library\PhpParser\Uses\parse
parse($token, $key)
Definition:
Uses.php:114
Magento\TestFramework\Integrity\Library\PhpParser\Uses\hasUses
hasUses()
Definition:
Uses.php:33
Magento\TestFramework\Integrity\Library\PhpParser\Uses\startParse
startParse()
Definition:
Uses.php:106
Magento\TestFramework\Integrity\Library\PhpParser\Uses\$parseUse
$parseUse
Definition:
Uses.php:19
Magento\TestFramework\Integrity\Library\PhpParser\Uses\appendToLast
appendToLast($value)
Definition:
Uses.php:79
Magento\TestFramework\Integrity\Library\PhpParser\Uses\createEmptyItem
createEmptyItem()
Definition:
Uses.php:41
Magento\TestFramework\Integrity\Library\PhpParser\Uses\isParseInProgress
isParseInProgress()
Definition:
Uses.php:90
Magento\TestFramework\Integrity\Library\PhpParser\Uses\getClassNameWithNamespace
getClassNameWithNamespace($class)
Definition:
Uses.php:52