# depicter/1.3.3/vendor/htmlburger/wpemerge/src/Application/GenericFactory.php

Depicter — Popup &amp; Slider Builder, version 1.3.3. 55 lines.

- Page: https://pluginprobe.com/plugins/depicter/1.3.3/code/vendor/htmlburger/wpemerge/src/Application/GenericFactory.php
- Raw: https://pluginprobe.com/plugins/depicter/1.3.3/raw/vendor/htmlburger/wpemerge/src/Application/GenericFactory.php
- Modified: 2022-06-01T06:26:20+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.3.3/code/vendor/htmlburger/wpemerge/src/Application/GenericFactory.php#L10-L20`.

```php
<?php
/**
 * @package   WPEmerge
 * @author    Atanas Angelov <hi@atanas.dev>
 * @copyright 2017-2019 Atanas Angelov
 * @license   https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0
 * @link      https://wpemerge.com/
 */

namespace WPEmerge\Application;

use Pimple\Container;
use WPEmerge\Exceptions\ClassNotFoundException;

/**
 * Generic class instance factory.
 */
class GenericFactory {
	/**
	 * Container.
	 *
	 * @var Container
	 */
	protected $container = null;

	/**
	 * Constructor.
	 *
	 * @codeCoverageIgnore
	 * @param Container $container
	 */
	public function __construct( Container $container ) {
		$this->container = $container;
	}

	/**
	 * Make a class instance.
	 *
	 * @throws ClassNotFoundException
	 * @param  string $class
	 * @return object
	 */
	public function make( $class ) {
		if ( isset( $this->container[ $class ] ) ) {
			return $this->container[ $class ];
		}

		if ( ! class_exists( $class ) ) {
			throw new ClassNotFoundException( 'Class not found: ' . $class );
		}

		return new $class();
	}
}

```
