-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathYamlLoader.php
More file actions
35 lines (29 loc) · 986 Bytes
/
YamlLoader.php
File metadata and controls
35 lines (29 loc) · 986 Bytes
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
<?php
declare(strict_types=1);
namespace MakinaCorpus\DbToolsBundle\Anonymization\Config\Loader;
use Symfony\Component\Yaml\Yaml;
class YamlLoader extends ArrayLoader
{
public function __construct(
private string $file,
string $connectionName = 'default',
/**
* Root directory from which the configuration was loaded. It allows
* later file loading (for example, when sources are CSV or TXT files).
*
* If not set, the file directory will be used instead. If set, it will
* override the file directory.
*/
?string $basePath = null,
) {
// @todo dirname() is purely soft logic, it does not imply any
// syscalls, whereas realpah() may.
$basePath ??= \realpath(\dirname($file));
parent::__construct([], $connectionName, $basePath);
}
#[\Override]
protected function getData(): array
{
return Yaml::parseFile($this->file);
}
}