Skip to content

Commit

Permalink
Added global function for accessing the default service
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeryther committed Sep 12, 2021
1 parent 6d15e7f commit 815b096
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
"autoload": {
"psr-4": {
"Gigadrive\\MinecraftAvatar\\": "src/"
}
},
"files": [
"src/global_functions.php"
]
},
"authors": [
{
Expand Down
16 changes: 16 additions & 0 deletions src/global_functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

use Gigadrive\MinecraftAvatar\MinecraftAvatar;
use Gigadrive\MinecraftAvatar\Service\AbstractMinecraftAvatarGenerator;

if (!function_exists("avatar")) {
/**
* Gets the default Minecraft avatar service.
*
* @return AbstractMinecraftAvatarGenerator
* @author Mehdi Baaboura <[email protected]>
*/
function avatar(): AbstractMinecraftAvatarGenerator {
return MinecraftAvatar::getDefaultService();
}
}

0 comments on commit 815b096

Please sign in to comment.