You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
418 B
22 lines
418 B
9 months ago
|
<?php
|
||
|
/**
|
||
|
* Storage registry class
|
||
|
*/
|
||
|
class RWMB_Storage_Registry {
|
||
|
protected $storages = [];
|
||
|
|
||
|
/**
|
||
|
* Get storage instance.
|
||
|
*
|
||
|
* @param string $class_name Storage class name.
|
||
|
* @return RWMB_Storage_Interface
|
||
|
*/
|
||
|
public function get( $class_name ) {
|
||
|
if ( empty( $this->storages[ $class_name ] ) ) {
|
||
|
$this->storages[ $class_name ] = new $class_name();
|
||
|
}
|
||
|
|
||
|
return $this->storages[ $class_name ];
|
||
|
}
|
||
|
}
|