Inpsyde\MultilingualPress\Factory\GenericFactory::__construct PHP Method

__construct() public method

Constructor. Sets up the properties.
Since: 3.0.0
public __construct ( string $base, string $default_class = '' )
$base string Fully qualified name of the base class or interface.
$default_class string Optional. Fully qualified name of the default class. Defaults to empty string.
    public function __construct($base, $default_class = '')
    {
        $this->base_is_class = class_exists($base);
        if (!($this->base_is_class || interface_exists($base))) {
            throw new InvalidArgumentException(sprintf('"%s"" requires a valid fully qualified class or interface name as first argument.', __METHOD__));
        }
        $this->base = (string) $base;
        if ($default_class) {
            $this->check_class($default_class);
            $this->default_class = (string) $default_class;
            return;
        }
        if ($this->base_is_class) {
            $this->default_class = (string) $base;
            return;
        }
        throw new InvalidArgumentException(sprintf('"%s"" requires a fully qualified class name as first or second argument.', __METHOD__));
    }