File "WPDP_List_Columns_Cache.php"

Full Path: /home/vantageo/public_html/cache/cache/cache/cache/cache/cache/cache/.wp-cli/wp-content/plugins/wp-data-access/WPDataProjects/Data_Dictionary/WPDP_List_Columns_Cache.php
File size: 1.3 KB
MIME-type: text/x-php
Charset: utf-8

<?php

/**
 * Suppress "error - 0 - No summary was found for this file" on phpdoc generation
 *
 * @package WPDataProjects\Data_Dictionary
 */

namespace WPDataProjects\Data_Dictionary {

	/**
	 * Class WPDP_List_Columns_Cache
	 *
	 * Instances of object WPDP_List_Columns are cached in this class
	 *
	 * @author  Peter Schulz
	 * @since   2.0.0
	 */
	class WPDP_List_Columns_Cache {

		/**
		 * List of cached instances of WPDP_List_Columns
		 *
		 * @var array
		 */
		protected static $cached_list_columns = array();

		/**
		 * Gets an instance of WPDP_List_Columns from cache or creates a new instance
		 *
		 * New instances are added to the cache
		 *
		 * @param string $schema_name Database schema name
		 * @param string $table_name Database table name
		 * @param string $label_type Label type
		 * @param string $setname Options set name
		 *
		 * @return object Handle to WPDP_List_Columns instance
		 */
		public static function get_list_columns( $schema_name, $table_name, $label_type, $setname = 'default' ) {
			$index = "$schema_name.$table_name.$label_type.$setname";
			if ( ! isset( self::$cached_list_columns[ $index ] ) ) {
				self::$cached_list_columns[ $index ] = new WPDP_List_Columns( $schema_name, $table_name, $label_type, $setname );
			}

			return self::$cached_list_columns[ $index ];
		}

	}

}