Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Throws.php
Go to the documentation of this file.
1 <?php
7 
13 {
17  protected $tokens;
18 
24  protected $dependencies = [];
25 
31  protected $throws = [];
32 
36  public function __construct(Tokens $tokens)
37  {
38  $this->tokens = $tokens;
39  }
40 
44  public function parse($token, $key)
45  {
46  if (is_array($token) && $token[0] == T_THROW) {
47  $this->throws[] = $key;
48  }
49  }
50 
54  public function getDependencies(Uses $uses)
55  {
56  foreach ($this->throws as $throw) {
57  $class = '';
58  if ($this->tokens->getTokenCodeByKey($throw + 2) == T_NEW) {
59  $step = 4;
60  while ($this->tokens->getTokenCodeByKey(
61  $throw + $step
62  ) == T_STRING || $this->tokens->getTokenCodeByKey(
63  $throw + $step
64  ) == T_NS_SEPARATOR) {
65  $class .= trim($this->tokens->getTokenValueByKey($throw + $step));
66  $step++;
67  }
68  if ($uses->hasUses()) {
70  }
71  $this->dependencies[] = $class;
72  }
73  }
74 
75  return $this->dependencies;
76  }
77 }
$_option $_optionId $class
Definition: date.phtml:13