/*!
\static
Similar to instance() but will always create a new copy.
493947
static function create( $localeString = false )
    {
        if ( $localeString === false )
        {
            $ini = eZINI::instance();
            $localeString = $ini->variable( 'RegionalSettings', 'Locale' );
        }
        return new eZLocale( $localeString );
    }
1272707
static function fromValue($value)
    {
        $key = self::getKey($value);

        return self::$instanceCache[static::class][$key]
            ?? (self::$instanceCache[static::class][$key] = new static($key, static::getValue($key)));
    }
647317
final public static function instance()
        {
            $className = get_called_class();

            if (!Arrays::exists(static::$instances[$className])) {
                static::$instances[$className] = new $className(func_get_args());
            }

            return static::$instances[$className];
        }
1005081
public function CloneInstance()
	{
		$result = new XBRLFilterMemberNetwork( $this->context, $this->dimension, $this->member, $this->linkRole, $this->arcRole, $this->axis );
		if ( ! is_null( $this->index ) ) $result->index = $this->index;
		if ( ! is_null( $this->memberPath ) ) $result->memberPath = $this->memberPath;
		if ( ! is_null( $this->candidates ) ) $result->candidates = $this->candidates;
		return $result;
	}
212607
static public function instance($args=null)
    {
        $args = func_get_args();
        
        $id = get_called_class() . '.' . md5(serialize($args));
        if (isset(static::$instances[$id])) {
            return static::$instances[$id];
        }
        
        if ($args) {
            switch (count($args)) {
                case 1:
                    $obj = new static($args[0]);
                    break;
                case 2:
                    $obj = new static($args[0], $args[1]);
                    break;
                case 3:
                    $obj = new static($args[0], $args[1], $args[2]);
                    break;
                case 4:
                    $obj = new static($args[0], $args[1], $args[2], $args[3]);
                    break;
                case 5:
                    $obj = new static($args[0], $args[1], $args[2], $args[3], $args[4]);
                    break;
                case 6:
                    $obj = new static($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]);
                    break;
                default:
                    $obj = new static($args);
                    break;
            }
        } else {
            $obj = new static();
        }
        
        static::$instances[$id] = $obj;
        return static::$instances[$id];
    }
405605
public static function create( $name = null, $conf = null ) 
	{
		if ( is_null( $name ) ) 
		{
			$name = static::$_default;
		}

		if ( !is_null( $conf ) && is_array( $conf ) )
		{
			return static::$_instances[$name] = new static( $name, $conf );
		}

		if ( !isset( static::$_instances[$name] ) )
		{
			static::$_instances[$name] = new static( $name );
		}

		return static::$_instances[$name];
	}
576236
static public function instance($type=null)
    {
        $type = $type ?: 'default';
        if (!isset(static::$instances[$type])) {
            $options = ['type' => $type];
            static::$instances[$type] = new static($options);
        }
        return static::$instances[$type];
    }
1220257
public function copy(): Collection
    {
        $items = $this->items;
        $resolver = $this->resolver;

        return new static($items, $resolver);
    }
948273
public static function instance($instance = null)
	{
		$class = get_called_class();

		if (static::exists($instance))
		{
			$instance = static::$_instances[$class][$instance];
		}
		else
		{
			$instance = false;
		}

		return $instance;
	}
661608
static function factory($name = 'default') {
        $class = get_called_class();
        if (!isset(self::$instances[$class][$name])) {
            self::$instances[$class][$name] = new $class($name);
        }

        return self::$instances[$class][$name];
    }
1093309
static function instance( $filename = false )
    {
        if ( self::$isShutdownFunctionRegistered !== true )
        {
            eZExecution::addCleanupHandler( array( __CLASS__, 'cleanupGeneratingFiles' ) );
            self::$isShutdownFunctionRegistered = true;
        }

        if( $filename !== false )
        {
            $optionArray = array( 'iniFile'      => 'file.ini',
                                  'iniSection'   => 'ClusteringSettings',
                                  'iniVariable'  => 'FileHandler',
                                  'handlerParams'=> array( $filename ) );

            $options = new ezpExtensionOptions( $optionArray );

            $handler = eZExtension::getHandlerClass( $options );

            return $handler;
        }
        else
        {
            // return Filehandler from GLOBALS based on ini setting.
            if ( self::$globalHandler === null )
            {
                $optionArray = array( 'iniFile'      => 'file.ini',
                                      'iniSection'   => 'ClusteringSettings',
                                      'iniVariable'  => 'FileHandler' );

                $options = new ezpExtensionOptions( $optionArray );

                $handler = eZExtension::getHandlerClass( $options );

                self::$globalHandler = $handler;
            }
            else
                $handler = self::$globalHandler;

            return $handler;
        }
    }
1373746
public function createInstance()
    {
        if (is_null($this->entityName)) {
            $class = new \ReflectionClass($this->originalEntityName);
        } else {
            $class = new \ReflectionClass($this->entityName);
        }

        return $class->newInstanceArgs();
    }
553265
public static function &getInstance( $instance = null )
	{
		if ( parent::hasInstance() )
		{
			return parent::getInstance();
		}

		$instance = parent::getInstance( new self() );
		$instance->fromFile();
		return $instance;
	}
590632
protected function cloneForExport()
    {
        return tap(new static, function ($instance) {
            $instance->setRawAttributes($this->getAttributes());
            $instance->setRelations($this->relations);
            $instance->setAppends($this->appends);
            $instance->setVisible($this->visible);
            $instance->setHidden($this->hidden);
        });
    }
842783
public function copy(): self
    {
        $stockMovement = new static();
        $stockMovement
            ->setQuantity($this->getQuantity())
            ->setComplaint($this->isComplaint())
            ->setReference($this->getReference())
            ->setRetailPrice($this->getRetailPrice())
            ->setPrice($this->getPrice())
            ->setVatPercentage($this->getVatPercentage())
            ->setType($this->getType())
            ->setProduct($this->getProduct())
            ->setOrderLine($this->getOrderLine())
            ->setOrderLineRemoved($this->isOrderLineRemoved())
        ;

        return $stockMovement;
    }
876041
static function instance(\hlin\archetype\Filesystem $fs, array $filemaps) {
		$i = new static;
		$i->fs = $fs;
		$i->filemaps = $filemaps;
		return $i;
	}
1233924
protected static function instance($refresh = false)
    {
        if (self::$instance === null || $refresh === true) {
            self::$instance = new self();
        }

        return self::$instance;
    }