Returns another instance of this field, but "cast" to a different class.

@see FormField::castedCopy()

@param String $classOrCopy
@return FormField
10325
public function castedCopy($classOrCopy)
    {
        $field = parent::castedCopy($classOrCopy);
        if ($field instanceof SelectField) {
            $field->setSource($this->getSource());
        }
        return $field;
    }
580792
public static function getInstance($config, $classname = 'IDS_Log_Database')
    {
        if ($config instanceof IDS_Init) {
            $wrapper = $config->config['Logging']['wrapper'];
        } elseif (is_array($config)) {
            $wrapper = $config['wrapper'];
        }

        if (!isset(self::$instances[$wrapper])) {
            self::$instances[$wrapper] = new $classname($config);
        }

        return self::$instances[$wrapper];
    }
941700
public static function getInstance($type, $data = null)
    {
        $classname = self::classname($type);

        if (!isset(self::$__instances[$classname])) {
            $instance = new $classname();
            self::$__instances[$classname] = $instance;
        }

        $instance = clone self::$__instances[$classname];

        if ($data) {
            $instance->unserialize($data);
        }

        return $instance;
    }
713326
public function getArrayCopy()
    {
        $obj_vars = get_object_vars($this);

        if (isset($obj_vars['attributes'])) {
            
            $obj_vars['attributes'] = $this->getAttributes()->toArray();
        }

        return $obj_vars;
    }
1366958
public function castingHelper($field)
    {
        $copy = $this->CopyContentFrom();
        if ($copy && $copy->exists() && ($helper = $copy->castingHelper($field))) {
            return $helper;
        }
        return parent::castingHelper($field);
    }
641664
public function createObjectType() : ObjectConstructorCallbackDefiner
    {
        return new ObjectConstructorCallbackDefiner($this->class, function (callable $typeCallback) {
            $this->createObjectCallback = function (array $input) use ($typeCallback) {
                $className = $this->class->getClassName();

                /** @var TypedObject|string $instanceOrType */
                $instanceOrType = $typeCallback($input);

                if (is_string($instanceOrType)) {
                    if (class_exists($instanceOrType) && is_a($instanceOrType, $className, true)) {
                        $instanceOrType = $instanceOrType::definition()->newCleanInstance();
                    }
                }

                if (!($instanceOrType instanceof $className)) {
                    throw InvalidReturnValueException::format(
                        'Invalid create object callback return value: expecting class compatible with %s, %s given',
                        $className, is_string($instanceOrType) ? $instanceOrType : Debug::getType($instanceOrType)
                    );
                }

                return $instanceOrType;
            };
        });
    }
818499
public function CloneInstance()
	{
		$result = new SpecialChildNodeIterator();
		$result->AssignFrom( $this );
		$result->kind = $this->kind;
		return $result;
	}
779984
public static function instance($type)
	{
		// Sanitize format type.
		$type = strtolower(preg_replace('/[^A-Z0-9_]/i', '', $type));

		// Only instantiate the object if it doesn't already exist.
		if (!isset(self::$instances[$type]))
		{
			// Only load the file if the class does not exist.
			$class = __NAMESPACE__ . '\\Processor\\' . ucfirst($type);

			if (!class_exists($class))
			{
				foreach (self::all() as $inst)
				{
					if (in_array($type, $inst->getSupportedExtensions()))
					{
						$class = get_class($inst);
					}
				}

				if (!class_exists($class))
				{
					throw new InvalidArgumentException(sprintf('Unable to load format class for format "%s"', $type), 500);
				}
			}

			self::$instances[$type] = new $class;
		}

		return self::$instances[$type];
	}
561692
protected static function getObject($objectOrClass): object
    {
        self::assertParam($objectOrClass);

        if (\is_string($objectOrClass)) {
            try {
                $objectOrClass = new $objectOrClass();
            } catch (\Error $e) {
                try {
                    $class = new \ReflectionClass($objectOrClass);
                    $objectOrClass = $class->newInstanceWithoutConstructor();
                    // @codeCoverageIgnoreStart
                } catch (\ReflectionException $exception) {
                    throw new \RuntimeException(
                        '[' . typeOf($exception) . '] ' . $exception->getMessage(),
                        (int)$exception->getCode(),
                        $exception
                    );
                }
                // @codeCoverageIgnoreEnd
            }
        }
        return $objectOrClass;
    }
994181
public static function getInstance($type)
	{
		// Sanitize format type.
		$type = strtolower(preg_replace('/[^A-Z0-9_]/i', '', $type));

		// Only instantiate the object if it doesn't already exist.
		if (!isset(self::$instances[$type]))
		{
			$class = '\\Joomla\\Registry\\Format\\' . ucfirst($type);

			if (!class_exists($class))
			{
				throw new \InvalidArgumentException('Unable to load format class.', 500);
			}

			self::$instances[$type] = new $class;
		}

		return self::$instances[$type];
	}
321135
public function getArrayCopy()
    {
        $obj_vars = get_object_vars($this);

        if (isset($obj_vars['postElements'])) {
            $obj_vars['postElements'] = $this->getPostElements()->toArray();
        }

        return $obj_vars;
    }
23473
public static function getValue($objectOrClass, string $propertyName)
    {
        $objectOrClass = self::getObject($objectOrClass);
        $closure =
            /**
             * @return mixed
             */
            function () use ($propertyName) {
                if (\property_exists($this, $propertyName)) {
                    $class = new \ReflectionClass(typeOf($this));
                    $property = $class->getProperty($propertyName);
                    $property->setAccessible(true);
                    return $property->getValue($this);
                }
                throw new \RuntimeException(
                    Picklock::errorMessage($this, $propertyName, false)
                );
            };
        return
            $closure->bindTo($objectOrClass, $objectOrClass)();
    }
485535
def copy(self):
        """"""
        # This way of initializing the copy means it works for subclasses, too.
        obj = self.__class__(self)
        obj.keyOrder = self.keyOrder[:]
        return obj
546332
function copy() {
    $serialized_contents = serialize($this);
    $copy = unserialize($serialized_contents);
    unset( $copy->propix );
    return $copy;
 }
1000753
public function performReadonlyTransformation()
    {
        $readonlyClassName = static::class . '_Readonly';

        if (ClassInfo::exists($readonlyClassName)) {
            $clone = $this->castedCopy($readonlyClassName);
        } else {
            $clone = $this->castedCopy(ReadonlyField::class);
        }

        $clone->setReadonly(true);

        return $clone;
    }
744244
protected function getCopy(ObjectId $origOID) {
    $copyOID = $this->getCopyOID($origOID);
    if ($copyOID != null) {
      $persistenceFacade = $this->getPersistenceFacade();
      $nodeCopy = $persistenceFacade->load($copyOID);
      return $nodeCopy;
    }
    else {
      return null;
    }
  }
867753
public function CloneInstance()
	{
		/**
		 * @var BufferedNodeIterator $res
		 */
		$clone = new BufferedNodeIterator();
		$clone->src = $this->src->CloneInstance();
		$clone->buffer = $this->buffer;
		$clone->empty = $this->empty;
		$clone->filled = $this->filled;
		return $clone;
	}