![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/dev/tests/static/framework/Magento/TestFramework/Integrity/Library/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\TestFramework\Integrity\Library; use Laminas\Code\Reflection\ClassReflection; use Magento\Framework\GetParameterClassTrait; use ReflectionException; /** * Provide dependencies for the file */ class Injectable { use GetParameterClassTrait; /** * @var string[] */ protected $dependencies = []; /** * Get dependencies * * @param ClassReflection $class * * @return string[] * @throws ReflectionException */ public function getDependencies(ClassReflection $class): array { foreach ($class->getMethods() as $method) { if ($method->getDeclaringClass()->getName() !== $class->getName()) { continue; } foreach ($method->getParameters() as $parameter) { try { $dependency = $this->getParameterClass($parameter); if ($dependency !== null) { $this->dependencies[] = $dependency->getName(); } } catch (ReflectionException $e) { if (preg_match('#^Class ([A-Za-z0-9_\"\\\\]+) does not exist$#', $e->getMessage(), $result)) { $this->dependencies[] = trim($result[1], '"'); } else { throw $e; } } } } return $this->dependencies; } }