Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Runtime.php
Go to the documentation of this file.
1 <?php
10 
12 
13 class Runtime implements DefinitionInterface
14 {
18  protected $_typesByPrefixes = [
19  'befor' => self::LISTENER_BEFORE,
20  'aroun' => self::LISTENER_AROUND,
21  'after' => self::LISTENER_AFTER,
22  ];
23 
29  protected $prefixLengths = [
30  self::LISTENER_BEFORE => 6,
31  self::LISTENER_AROUND => 6,
32  self::LISTENER_AFTER => 5,
33  ];
34 
41  public function getMethodList($type)
42  {
43  $methods = [];
44  $allMethods = get_class_methods($type);
45  if ($allMethods) {
46  foreach ($allMethods as $method) {
47  $prefix = substr($method, 0, 5);
48  if (isset($this->_typesByPrefixes[$prefix])) {
49  $methodName = \lcfirst(substr($method, $this->prefixLengths[$this->_typesByPrefixes[$prefix]]));
50  $methods[$methodName] = isset(
51  $methods[$methodName]
52  ) ? $methods[$methodName] | $this->_typesByPrefixes[$prefix] : $this->_typesByPrefixes[$prefix];
53  }
54  }
55  }
56  return $methods;
57  }
58 }
$type
Definition: item.phtml:13
$prefix
Definition: name.phtml:25
$methods
Definition: billing.phtml:71
$method
Definition: info.phtml:13