winter/modules/system/traits/LazyOwnerAlias.php
Luke Towers 4a6bc4df6a
Add support for plugin replacement / forking (#41)
Documented by https://github.com/wintercms/docs/pull/11

Co-authored-by: @jaxwilko Jack Wilkinson <me@jackwilky.com>
Co-authored-by: @mjauvin Marc Jauvin <marc.jauvin@gmail.com>
Co-authored-by: @bennothommo Ben Thomson <git@alfreido.com>
Co-authored-by: @LukeTowers  Luke Towers <github@luketowers.ca>
2021-04-21 13:50:59 -06:00

29 lines
707 B
PHP

<?php namespace System\Traits;
/**
* Lazy Owner Alias
* Adds support for statically binding owner aliases
*
* @package winter\wn-system-module
* @author Jack Wilkinson
*/
trait LazyOwnerAlias
{
/**
* @var array List of aliases
*/
protected static $lazyAliases = [];
/**
* Binds the alias of an owner to the lazy alias list. This allows us to bind aliases
* prior to init() which is necessary to do before to `PluginManager` being registered.
* @param string $owner
* @param string $alias
* @return void
*/
public static function lazyRegisterOwnerAlias(string $owner, string $alias)
{
static::$lazyAliases[$alias] = $owner;
}
}