Esempio n. 1
0
 private function parseFile(Filter $filter, $itemPath)
 {
     $extension = pathinfo($itemPath, PATHINFO_EXTENSION);
     if (in_array($extension, $this->compileExtensions)) {
         $filter->addCompileFile($itemPath);
     } elseif (in_array($extension, $this->includeExtensions)) {
         $filter->addIncludeFile($itemPath);
     } elseif (in_array($extension, $this->resourceExtensions)) {
         $filter->addResourceFile($itemPath);
     } else {
         $filter->addIgnoreFile($itemPath);
     }
 }
 protected function writeItemGroupFilemap(DOMElement $parent, Filter $filter, DOMElement $incGroup = null, DOMElement $srcGroup = null, DOMElement $resGroup = null, DOMElement $ignGroup = null)
 {
     if ($filter->getIncludeFiles()) {
         $incGroup = $incGroup ?: $parent->appendChild($this->dom->createElement('ItemGroup'));
         foreach ($filter->getIncludeFiles() as $path) {
             XmlDom::createElement($incGroup, 'ClInclude', null, ['Include' => $path]);
         }
     }
     if ($filter->getCompileFiles()) {
         $srcGroup = $srcGroup ?: $parent->appendChild($this->dom->createElement('ItemGroup'));
         foreach ($filter->getCompileFiles() as $path) {
             $element = XmlDom::createElement($srcGroup, 'ClCompile', null, ['Include' => $path]);
             $this->writePrecompiledHeader($element, $path);
         }
     }
     if ($filter->getResourceFiles()) {
         $resGroup = $resGroup ?: $parent->appendChild($this->dom->createElement('ItemGroup'));
         foreach ($filter->getResourceFiles() as $path) {
             XmlDom::createElement($resGroup, 'ResourceCompile', null, ['Include' => $path]);
         }
     }
     if ($filter->getIgnoreFiles()) {
         $ignGroup = $ignGroup ?: $parent->appendChild($this->dom->createElement('ItemGroup'));
         foreach ($filter->getIgnoreFiles() as $path) {
             XmlDom::createElement($resGroup, 'ResourceCompile', null, ['Include' => $path]);
         }
     }
     if ($filter->getFilters()) {
         foreach ($filter->getFilters() as $subFilter) {
             $this->writeItemGroupFilemap($parent, $subFilter, $incGroup, $srcGroup, $resGroup, $ignGroup);
         }
     }
 }
 protected function writeFilterName(Filter $filter)
 {
     $filterName = $filter->getName();
     while ($filter && $filter->getParent() && $filter->getParent()->getName()) {
         $filterName = $filter->getParent()->getName() . '\\' . $filterName;
         $filter = $filter->getParent();
     }
     return $filterName;
 }