Code Duplication    Length = 17-17 lines in 2 locations

src/Generator.php 2 locations

@@ 112-128 (lines=17) @@
109
    }
110
  }
111
  
112
  protected function normalizeStyles(array &$meta, string &$html, string $filename): void {
113
    $basePath = dirname($filename);
114
    $meta["styles"] = array_filter($meta["styles"], function($value) use($basePath) {
115
      return file_exists("$basePath/$value");
116
    });
117
    if(!count($meta["styles"])) {
118
      unset($meta["styles"]);
119
      $html = str_replace("
120
  %%styles%%", "", $html);
121
      return;
122
    }
123
    array_walk($meta["styles"], function(&$value) use($basePath) {
124
      $this->addAsset("$basePath/$value");
125
      $value = "<link rel=\"stylesheet\" type=\"text/css\" href=\"$value\">";
126
    });
127
    $meta["styles"] = implode("\n  ", $meta["styles"]);
128
  }
129
  
130
  protected function normalizeScripts(array &$meta, string &$html, string $filename): void {
131
    $basePath = dirname($filename);
@@ 130-146 (lines=17) @@
127
    $meta["styles"] = implode("\n  ", $meta["styles"]);
128
  }
129
  
130
  protected function normalizeScripts(array &$meta, string &$html, string $filename): void {
131
    $basePath = dirname($filename);
132
    $meta["scripts"] = array_filter($meta["scripts"], function($value) use($basePath) {
133
      return file_exists("$basePath/$value");
134
    });
135
    if(!count($meta["scripts"])) {
136
      unset($meta["scripts"]);
137
      $html = str_replace("
138
  %%scripts%%", "", $html);
139
      return;
140
    }
141
    array_walk($meta["scripts"], function(&$value) use($basePath) {
142
      $this->addAsset("$basePath/$value");
143
      $value = "<script type=\"text/javascript\" src=\"$value\"></script>";
144
    });
145
    $meta["scripts"] = implode("\n  ", $meta["scripts"]);
146
  }
147
  
148
  protected function createHtml(string $filename): string {
149
    $parser = new GithubMarkdown();