Skip to content

Commit 272364d

Browse files
author
Gaige Lama
authored
Merge pull request #10 from ExoUNX/dev
Switched from sprintf() back to native concatenation
2 parents 910db26 + 3044c37 commit 272364d

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Builder.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public function sri(string $file): string
4545
{
4646
$algorithm = self::selectAlgorithm();
4747

48-
return sprintf('%s-%s', $algorithm, base64_encode(
49-
hash_file($algorithm, public_path($file), true)
50-
));
48+
return $algorithm.'-'.base64_encode(
49+
hash_file($algorithm, public_path($file), true)
50+
);
5151
}
5252

5353
/**
@@ -59,7 +59,7 @@ public function sri(string $file): string
5959
*/
6060
public function versioning(string $file): string
6161
{
62-
return sprintf('id=%s', hash_file('md5', public_path($file)));
62+
return '?id='.hash_file('md5', public_path($file));
6363
}
6464

6565
/**
@@ -100,7 +100,7 @@ public function attribute(string $file): string
100100
*/
101101
public function crossOrigin(string $keyword): string
102102
{
103-
return sprintf(' crossorigin="%s"', $keyword);
103+
return 'crossorigin="'.$keyword.'"';
104104
}
105105

106106
/**

src/ManifestReader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function getManifest(string $file): array
3232

3333
} else {
3434

35-
throw new Exception(sprintf('Incorrect file path or file does not exist for %s', $file));
35+
throw new Exception('Incorrect file path or file does not exist for '.$file);
3636

3737
}
3838
}

src/Vasri.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function vasri(
8686
*/
8787
private function getSRI(string $file, string $keyword): string
8888
{
89-
return sprintf('integrity="%s" %s', $this->vasriManifest[$file]['sri'], $this->builder->crossOrigin($keyword));
89+
return ' integrity="'.$this->vasriManifest[$file]['sri'].'" '.$this->builder->crossOrigin($keyword);
9090
}
9191

9292
/**
@@ -110,7 +110,7 @@ private function addAttributes(string $file, bool $enableVersioning, bool $enabl
110110
}
111111
if ($enableSRI) {
112112

113-
$output = sprintf('%s %s', $output, $this->getSRI($file, $keyword));
113+
$output .= $this->getSRI($file, $keyword);
114114

115115
}
116116

@@ -136,7 +136,7 @@ private function getVersioning(string $file): string
136136
*/
137137
private function getSourceAttribute(string $file, string $version = ''): string
138138
{
139-
return sprintf('%s="%s%s"', $this->builder->attribute($file), $file, $version);
139+
return $this->builder->attribute($file).'="'.$file.$version.'"';
140140
}
141141

142142
/**

0 commit comments

Comments
 (0)