# depicter/1.6.2/app/src/DataSources/Manager.php

Depicter — Popup &amp; Slider Builder, version 1.6.2. 120 lines.

- Page: https://pluginprobe.com/plugins/depicter/1.6.2/code/app/src/DataSources/Manager.php
- Raw: https://pluginprobe.com/plugins/depicter/1.6.2/raw/app/src/DataSources/Manager.php
- Modified: 2023-02-09T06:22:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/depicter/1.6.2/code/app/src/DataSources/Manager.php#L10-L20`.

```php
<?php
namespace Depicter\DataSources;

use Depicter\DataSources\Tags\Manager as TagsManager;

/**
 * Chained api to access all data sources
 */
class Manager {

	/**
	 * Returns the instance of posts class
	 *
	 * @return Posts
	 */
	public function posts(): Posts {
		return \Depicter::resolve('depicter.dataSources.posts');
	}

	/**
	 * Returns the instance of products class
	 *
	 * @return Products
	 */
	public function products(): Products {
		return \Depicter::resolve('depicter.dataSources.products');
	}

	/**
	 * Returns the instance of handpicked products class
	 *
	 * @return HandPickedProducts
	 */
	public function handPickedProducts(): HandPickedProducts {
		return \Depicter::resolve('depicter.dataSources.handPickedProducts');
	}

	/**
	 * Returns the instance of tags Manager class
	 *
	 * @return TagsManager
	 */
	public function tagsManager(): TagsManager {
		return \Depicter::resolve('depicter.dataSources.tags.manager');
	}

	/**
	 * Get DataSource instance by type
	 *
	 * @param string $type
	 *
	 * @return DataSourceInterface
	 */
	public function getByType( string $type ){
		$result = $this->posts();

		switch ( $type ) {

			case 'wpPost':
			case 'wpPostHandpicked':
			case 'wpPage':
			case 'wpPageHandpicked':
			case 'wpCPT':
				$result = $this->posts();
				break;

			case 'wooProduct':
			case 'wooProducts':
				$result = $this->products();
				break;

			case 'wooHandpicked':
				$result = $this->handPickedProducts();
				break;

			default:
				break;
		}

		return $result;
	}

	/**
	 * Get post type by DataSource type
	 *
	 * @param string $type
	 *
	 * @return string
	 */
	public function getPostTypeByType( string $type ){
		$result = '';

		switch ( $type ) {

			case 'wpPost':
			case 'wpPostHandpicked':
			case 'wpCPT':
				$result = 'post';
				break;

			case 'wpPage':
			case 'wpPageHandpicked':
				$result = 'page';
				break;

			case 'wooProduct':
			case 'wooProducts':
			case 'wooHandpicked':
				$result = 'product';
				break;

			default:
				break;
		}

		return $result;
	}

}

```
