Code Duplication    Length = 17-17 lines in 2 locations

src/Generator.php 2 locations

@@ 125-141 (lines=17) @@
122
    }
123
  }
124
  
125
  protected function normalizeStyles(array &$meta, string &$html, string $filename): void {
126
    $basePath = dirname($filename);
127
    $meta["styles"] = array_filter($meta["styles"], function($value) use($basePath) {
128
      return file_exists("$basePath/$value");
129
    });
130
    if(!count($meta["styles"])) {
131
      unset($meta["styles"]);
132
      $html = str_replace("
133
  %%styles%%", "", $html);
134
      return;
135
    }
136
    array_walk($meta["styles"], function(&$value) use($basePath) {
137
      $this->addAsset("$basePath/$value");
138
      $value = "<link rel=\"stylesheet\" type=\"text/css\" href=\"$value\">";
139
    });
140
    $meta["styles"] = implode("\n  ", $meta["styles"]);
141
  }
142
  
143
  protected function normalizeScripts(array &$meta, string &$html, string $filename): void {
144
    $basePath = dirname($filename);
@@ 143-159 (lines=17) @@
140
    $meta["styles"] = implode("\n  ", $meta["styles"]);
141
  }
142
  
143
  protected function normalizeScripts(array &$meta, string &$html, string $filename): void {
144
    $basePath = dirname($filename);
145
    $meta["scripts"] = array_filter($meta["scripts"], function($value) use($basePath) {
146
      return file_exists("$basePath/$value");
147
    });
148
    if(!count($meta["scripts"])) {
149
      unset($meta["scripts"]);
150
      $html = str_replace("
151
  %%scripts%%", "", $html);
152
      return;
153
    }
154
    array_walk($meta["scripts"], function(&$value) use($basePath) {
155
      $this->addAsset("$basePath/$value");
156
      $value = "<script type=\"text/javascript\" src=\"$value\"></script>";
157
    });
158
    $meta["scripts"] = implode("\n  ", $meta["scripts"]);
159
  }
160
  
161
  protected function createHtml(string $filename): string {
162
    $parser = new GithubMarkdown();