-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComponentPathValidator.php
51 lines (46 loc) · 1.32 KB
/
ComponentPathValidator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* ModulePathValidator.php
*
* PHP Version 5
*
* @category magento2
* @package magento2
* @author David Verholen <[email protected]>
* @license http://opensource.org/licenses/OSL-3.0 OSL-3.0
* @link http://github.com/davidverholen
*/
namespace DavidVerholen\DynamicComponentRegistry\Validator\Component;
use DavidVerholen\DynamicComponentRegistry\Api\Data\ComponentInterface;
/**
* Class ModulePathValidator
*
* @category magento2
* @package DavidVerholen\DynamicComponentRegistry\Validator\Component
* @author David Verholen <[email protected]>
* @license http://opensource.org/licenses/OSL-3.0 OSL-3.0
* @link http://github.com/davidverholen
*/
class ComponentPathValidator extends AbstractValidator
{
/**
* execute
*
* @param ComponentInterface $component
*
* @return void
*/
protected function execute(ComponentInterface $component)
{
$this->validateThePathExists($component->getPath());
}
protected function validateThePathExists($path)
{
if (false === file_exists($this->getNormalizedPath($path))) {
$this->addError(__(sprintf(
'the path does not exist: \'%s\'. The path must be relative to the Magento root dir',
$this->getNormalizedPath($path)
)));
}
}
}