Skip to content

Commit

Permalink
Allow name change for assets adding
Browse files Browse the repository at this point in the history
  • Loading branch information
eonghk authored and jfoulquie-tnw committed Mar 13, 2024
1 parent c0c342a commit 20b58ec
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/PassGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,23 @@ public function __destruct()
* Add an asset to the pass. Use this function to add images to the pass.
*
* @param string $assetPath
* @param string $name
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addAsset($assetPath)
public function addAsset($assetPath, $name = null)
{
if (is_file($assetPath)) {
$this->assets[basename($assetPath)] = $assetPath;

if(empty($name)) {
$this->assets[basename($assetPath)] = $assetPath;
} else {
$this->assets[$name] = $assetPath;
}
return;
}

throw new InvalidArgumentException("The file $assetPath does NOT exist");
}

Expand Down

0 comments on commit 20b58ec

Please sign in to comment.