Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
PluginValidator.php
Go to the documentation of this file.
1 <?php
7 
11 
13 {
15  private $frameworkValidator;
16 
20  public function __construct(InterfaceValidator $frameworkValidator)
21  {
22  $this->frameworkValidator = $frameworkValidator;
23  }
24 
32  public function validate($pluginClass, $interceptedType)
33  {
34  $this->frameworkValidator->validate($pluginClass, $interceptedType);
35  $this->validateClassNameMatchesCase($pluginClass);
36  $this->validateClassNameMatchesCase($interceptedType);
37  }
38 
45  private function validateClassNameMatchesCase($className)
46  {
47  $declarationName = (new \ReflectionClass($className))->getName();
48 
49  if (ltrim($className, '\\') != ltrim($declarationName)) {
50  throw new ValidatorException(
51  new Phrase(
52  "Capitalization of class name '%1' does not match expected '%2'",
53  [$className, $declarationName]
54  )
55  );
56  }
57  }
58 }
validate($pluginClass, $interceptedType)
__construct(InterfaceValidator $frameworkValidator)
if($currentSelectedMethod==$_code) $className
Definition: form.phtml:31