PluginProbe
Code Snippets / 3.10.0
Code Snippets v3.10.0
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
code-snippets / vendor / typisttech / imposter / src / ProjectConfig.php

ProjectConfig.php in Code Snippets 3.10.0, at vendor/typisttech/imposter/src/ProjectConfig.php

62 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace TypistTech\Imposter;
6
7 use UnexpectedValueException;
8
9 class ProjectConfig extends Config implements ProjectConfigInterface
10 {
11 /**
12 * @var string[]
13 */
14 protected const DEFAULT_EXCLUDES = ['typisttech/imposter'];
15
16 /**
17 * @var string[]
18 */
19 private $extraExcludes = [];
20
21 /**
22 * @return string[]
23 */
24 public function getExcludes(): array
25 {
26 $extra = $this->get('extra');
27 $excludes = $extra['imposter']['excludes'] ?? [];
28
29 return array_merge(static::DEFAULT_EXCLUDES, $excludes, $this->extraExcludes);
30 }
31
32 public function getImposterNamespace(): string
33 {
34 $extra = $this->get('extra');
35
36 if (empty($extra['imposter']['namespace'])) {
37 throw new UnexpectedValueException('Imposter namespace is empty');
38 }
39
40 return $extra['imposter']['namespace'];
41 }
42
43 public function getVendorDir(): string
44 {
45 $config = $this->get('config');
46 $vendorDir = $config['vendor-dir'] ?? 'vendor';
47
48 return StringUtil::addTrailingSlash($this->packageDir . $vendorDir);
49 }
50
51 /**
52 * @param string[] $extraExcludes
53 *
54 * @return void
55 */
56
57 public function setExtraExcludes(array $extraExcludes)
58 {
59 $this->extraExcludes = $extraExcludes;
60 }
61 }
62