Skip to content

Commit 20b58ec

Browse files
eonghkjfoulquie-tnw
authored andcommitted
Allow name change for assets adding
1 parent c0c342a commit 20b58ec

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/PassGenerator.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,23 @@ public function __destruct()
167167
* Add an asset to the pass. Use this function to add images to the pass.
168168
*
169169
* @param string $assetPath
170+
* @param string $name
170171
*
171172
* @throws \InvalidArgumentException
172173
*
173174
* @return void
174175
*/
175-
public function addAsset($assetPath)
176+
public function addAsset($assetPath, $name = null)
176177
{
177178
if (is_file($assetPath)) {
178-
$this->assets[basename($assetPath)] = $assetPath;
179-
179+
if(empty($name)) {
180+
$this->assets[basename($assetPath)] = $assetPath;
181+
} else {
182+
$this->assets[$name] = $assetPath;
183+
}
180184
return;
181185
}
182-
186+
183187
throw new InvalidArgumentException("The file $assetPath does NOT exist");
184188
}
185189

0 commit comments

Comments
 (0)