Code Duplication    Length = 15-15 lines in 2 locations

src/Generator.php 2 locations

@@ 141-155 (lines=15) @@
138
    });
139
  }
140
  
141
  protected function normalizeStyles(array &$meta, string &$html, string $filename): void {
142
    $basePath = dirname($filename);
143
    $this->removeInvalidFiles($meta["styles"], $basePath);
144
    if(count($meta["styles"]) === 0) {
145
      unset($meta["styles"]);
146
      $html = str_replace("
147
  %%styles%%", "", $html);
148
      return;
149
    }
150
    array_walk($meta["styles"], function(&$value) use($basePath) {
151
      $this->addAsset("$basePath/$value");
152
      $value = "<link rel=\"stylesheet\" type=\"text/css\" href=\"$value\">";
153
    });
154
    $meta["styles"] = implode("\n  ", $meta["styles"]);
155
  }
156
  
157
  protected function normalizeScripts(array &$meta, string &$html, string $filename): void {
158
    $basePath = dirname($filename);
@@ 157-171 (lines=15) @@
154
    $meta["styles"] = implode("\n  ", $meta["styles"]);
155
  }
156
  
157
  protected function normalizeScripts(array &$meta, string &$html, string $filename): void {
158
    $basePath = dirname($filename);
159
    $this->removeInvalidFiles($meta["scripts"], $basePath);
160
    if(count($meta["scripts"]) === 0) {
161
      unset($meta["scripts"]);
162
      $html = str_replace("
163
  %%scripts%%", "", $html);
164
      return;
165
    }
166
    array_walk($meta["scripts"], function(&$value) use($basePath) {
167
      $this->addAsset("$basePath/$value");
168
      $value = "<script type=\"text/javascript\" src=\"$value\"></script>";
169
    });
170
    $meta["scripts"] = implode("\n  ", $meta["scripts"]);
171
  }
172
  
173
  protected function createMarkdownParser(): \cebe\markdown\Markdown {
174
    return new MarkdownParser();