![]() 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/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\TestFramework\Integrity; use Magento\Framework\Exception\ValidatorException; use Magento\Framework\Interception\Code\InterfaceValidator; use Magento\Framework\Phrase; class PluginValidator { /** @var InterfaceValidator */ private $frameworkValidator; /** * @param InterfaceValidator $frameworkValidator */ public function __construct(InterfaceValidator $frameworkValidator) { $this->frameworkValidator = $frameworkValidator; } /** * Validate plugin and intercepted class * * @param string $pluginClass * @param string $interceptedType * @throws ValidatorException */ public function validate($pluginClass, $interceptedType) { $this->frameworkValidator->validate($pluginClass, $interceptedType); $this->validateClassNameMatchesCase($pluginClass); $this->validateClassNameMatchesCase($interceptedType); } /** * Verify that the class name has same capitalization as the class declaration * * @param string $className * @throws ValidatorException */ private function validateClassNameMatchesCase($className) { $declarationName = (new \ReflectionClass($className))->getName(); if (ltrim($className, '\\') != ltrim($declarationName)) { throw new ValidatorException( new Phrase( "Capitalization of class name '%1' does not match expected '%2'", [$className, $declarationName] ) ); } } }