Loyalty feature installer (#118)
* fixes for crash during the installation * add LP activate option
This commit is contained in:
parent
417b5f6e1e
commit
dee8af4b25
1 changed files with 20 additions and 0 deletions
|
@ -85,7 +85,27 @@ class ServiceLocator
|
|||
{
|
||||
return static::$services[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or create service (instantiates service if it wasn't created earlier; $name must be FQN).
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getOrCreate(string $name)
|
||||
{
|
||||
$service = static::$services[$name];
|
||||
|
||||
if (null === $service) {
|
||||
static::$services[$name] = new $name();
|
||||
return static::$services[$name];
|
||||
}
|
||||
|
||||
return $service;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get or create service (instantiates service if it wasn't created earlier; $name must be FQN).
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue