File "AbstractGenerator.php"

Full path: /home/kosmetik/public_html/wp-content/plugins/woo-license-keys/vendor/gladcodes/keygen/src/Keygen/AbstractGenerator.php
File size: 1.33 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php

/*
 * This file is part of the Keygen package.
 *
 * (c) Glad Chinda <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Keygen;

use Keygen\Traits\KeyManipulation;
use Keygen\Traits\MutableGenerator;
use Keygen\Traits\GeneratorMutation;

abstract class AbstractGenerator
{
	use KeyManipulation, MutableGenerator, GeneratorMutation {
		MutableGenerator::flattenArguments insteadof GeneratorMutation;
	}

	/**
	 * Creates a new KeyGenerator instance.
	 * 
	 * @param mixed $length
	 * 
	 * @throws \InvalidArgumentException
	 */
	public function __construct($length = 16)
	{
		$this->length($length);
	}

	/**
	 * Overload the __isset method
	 */
	public function __isset($prop)
	{
		return array_key_exists($prop, get_object_vars($this));
	}

	/**
	 * Overload the __get method
	 */
	public function __get($prop)
	{
		if (isset($this->{$prop})) {
			return $this->{$prop};
		}
	}

	/**
	 * Overload the __call method 
	 */
	public function __call($method, $args)
	{
		return $this->__overloadMethods($method, $args);
	}

	/**
	 * Overload the __callStatic method 
	 */
	public static function __callStatic($method, $args)
	{
		return (new static)->__call($method, $args);
	}
}