|
19 | 19 | class PhpStorm implements FormatInterface
|
20 | 20 | {
|
21 | 21 | private const PROJECT_PATH_IDENTIFIER = '$PROJECT_DIR$';
|
22 |
| - private const IDEA_PATH = '.idea'; |
23 | 22 |
|
24 | 23 | /**
|
25 | 24 | * @var ReadInterface
|
@@ -63,8 +62,6 @@ public function generateCatalog(array $dictionary, $configFilePath)
|
63 | 62 | $componentNode = null;
|
64 | 63 | $projectNode = null;
|
65 | 64 |
|
66 |
| - $ideaDir = $this->resolveProjectPath($configFilePath); |
67 |
| - |
68 | 65 | try {
|
69 | 66 | $file = $this->fileWriteFactory->create(
|
70 | 67 | $configFilePath,
|
@@ -100,7 +97,7 @@ public function generateCatalog(array $dictionary, $configFilePath)
|
100 | 97 | foreach ($dictionary as $urn => $xsdPath) {
|
101 | 98 | $node = $dom->createElement('resource');
|
102 | 99 | $node->setAttribute('url', $urn);
|
103 |
| - $node->setAttribute('location', $this->getFileLocationInProject($ideaDir, $xsdPath)); |
| 100 | + $node->setAttribute('location', $this->getFileLocationInProject($xsdPath)); |
104 | 101 | $componentNode->appendChild($node);
|
105 | 102 | }
|
106 | 103 | $dom->formatOutput = true;
|
@@ -135,26 +132,14 @@ private function initEmptyFile(\DOMDocument $dom)
|
135 | 132 | return $projectNode;
|
136 | 133 | }
|
137 | 134 |
|
138 |
| - /** |
139 |
| - * Resolve PhpStorm Project Path |
140 |
| - * |
141 |
| - * @param string $configFilePath |
142 |
| - * @return string |
143 |
| - */ |
144 |
| - private function resolveProjectPath($configFilePath): string |
145 |
| - { |
146 |
| - return \str_replace('/' . self::IDEA_PATH, '', realpath(dirname($configFilePath))); |
147 |
| - } |
148 |
| - |
149 | 135 | /**
|
150 | 136 | * Resolve xsdpath to xml project path
|
151 | 137 | *
|
152 |
| - * @param string $ideaDir |
153 | 138 | * @param string $xsdPath
|
154 | 139 | * @return string
|
155 | 140 | */
|
156 |
| - private function getFileLocationInProject(string $ideaDir, string $xsdPath): string |
| 141 | + private function getFileLocationInProject(string $xsdPath): string |
157 | 142 | {
|
158 |
| - return \str_replace($ideaDir, self::PROJECT_PATH_IDENTIFIER, $xsdPath); |
| 143 | + return self::PROJECT_PATH_IDENTIFIER . DIRECTORY_SEPARATOR . $this->currentDirRead->getRelativePath($xsdPath); |
159 | 144 | }
|
160 | 145 | }
|
0 commit comments