├── Interception
└── Code
│ └── Generator
│ ├── DiCompileInterceptor.php
│ ├── GetClassMethodsTrait.php
│ └── Interceptor.php
├── LICENSE.txt
├── README.md
├── composer.json
├── etc
├── di.xml
└── module.xml
└── registration.php
/Interception/Code/Generator/DiCompileInterceptor.php:
--------------------------------------------------------------------------------
1 | ['addFilterGroupToCollection']
11 | ];
12 |
13 | /**
14 | * Returns list of methods for class generator.
15 | *
16 | * Included protected method in our filter.
17 | *
18 | * @return array
19 | * @throws \ReflectionException
20 | */
21 | protected function _getClassMethods()
22 | {
23 | $methods = [$this->_getDefaultConstructorDefinition()];
24 | $reflectionClass = new \ReflectionClass($this->getSourceClassName());
25 | $methodFilter = \ReflectionMethod::IS_PUBLIC;
26 |
27 | // Working around a circular dependency issue for this specific class.
28 | if (strpos($this->getSourceClassName(), '\Magento\Store\Model\ResourceModel') !== 0) {
29 | $methodFilter |= \ReflectionMethod::IS_PROTECTED;
30 | }
31 |
32 | $interceptedMethods = $reflectionClass->getMethods($methodFilter);
33 | foreach ($interceptedMethods as $method) {
34 | if ($this->isInterceptedMethod($method) && !$this->isIgnoredMethod($method)) {
35 | $methods[] = $this->_getMethodInfo($method);
36 | }
37 | }
38 | return $methods;
39 | }
40 |
41 | /**
42 | * Retrieve method info
43 | *
44 | * @param \ReflectionMethod $method
45 | * @return array
46 | */
47 | protected function _getMethodInfo(\ReflectionMethod $method)
48 | {
49 | $methodInfo = parent::_getMethodInfo($method);
50 | $methodInfo['visibility'] = $method->isProtected() ? 'protected' : 'public';
51 | return $methodInfo;
52 | }
53 |
54 | private function isIgnoredMethod(\ReflectionMethod $method): bool
55 | {
56 | if (!isset($this->ignores[$method->getDeclaringClass()->getName()])) {
57 | return false;
58 | }
59 |
60 | return in_array($method->getName(), $this->ignores[$method->getDeclaringClass()->getName()], true);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/Interception/Code/Generator/Interceptor.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/etc/module.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/registration.php:
--------------------------------------------------------------------------------
1 |