Source of file MslsRegistryInstance.php

Size: 0,428 Bytes - Last Modified: 2018-02-05T14:23:18+00:00

/home/dennisploetner/Projects/Multisite-Language-Switcher/includes/MslsRegistryInstance.php

1234567891011121314151617181920212223242526272829
<?php

namespace lloc\Msls;

/**
 * Class MslsRegistryInstance
 *
 * @package lloc\Msls
 */
class MslsRegistryInstance {

	/**
	 * Gets or creates an instance of the called class
	 *
	 * @return object
	 */
	public static function instance() {
		$class = get_called_class();

		if ( ! ( $obj = MslsRegistry::get_object( $class ) ) ) {
			$obj = new $class;

			MslsRegistry::set_object( $class, $obj );
		}

		return $obj;
	}

}