File "AbstractFactory.php"

Full Path: /home/branxxtp/freemanvalue.com/wp-content/plugins/enhanced-text-widget/analyst/src/Core/AbstractFactory.php
File size: 511 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

namespace Analyst\Core;

abstract class AbstractFactory
{
	/**
	 * Unserialize to static::class instance
	 *
	 * @param $raw
	 * @return static
	 */
	protected static function unserialize($raw)
	{
		$instance = maybe_unserialize($raw);

		$isProperObject = is_object($instance) && $instance instanceof static;

		// In case for some reason unserialized object is not
		// static::class we make sure it is static::class
		if (!$isProperObject) {
			$instance = new static();
		}

		return $instance;
	}
}