return a copy of this component

@author Kjell-Inge Gustafsson <ical@kigkonsult.se>
@since 2.2.16 - 2007-11-07
@return object
546332
function copy() {
    $serialized_contents = serialize($this);
    $copy = unserialize($serialized_contents);
    unset( $copy->propix );
    return $copy;
 }
1078204
public function copy()
	{
		$view = $this->getView();

		$view->customData = $this->toArray( $view->item, true );
		$view->customBody = '';

		foreach( $this->getSubClients() as $client ) {
			$view->customBody .= $client->copy();
		}

		return $this->render( $view );
	}
713326
public function getArrayCopy()
    {
        $obj_vars = get_object_vars($this);

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

        return $obj_vars;
    }
532493
public function getContainer()
    {
        if (! $this->container) {
            $this->container = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
        }

        return $this->container;
    }
313904
public function getEventObject()
    {
        if ($this->currentOverriddenEvent) {
            return $this->currentOverriddenEvent;
        }

        $event = clone $this->masterEvent;

        // Ignoring the following block, because PHPUnit's code coverage
        // ignores most of these lines, and this messes with our stats.
        //
        // @codeCoverageIgnoreStart
        unset(
            $event->RRULE,
            $event->EXDATE,
            $event->RDATE,
            $event->EXRULE,
            $event->{'RECURRENCE-ID'}
        );
        // @codeCoverageIgnoreEnd

        $event->DTSTART->setDateTime($this->getDtStart(), $event->DTSTART->isFloating());
        if (isset($event->DTEND)) {
            $event->DTEND->setDateTime($this->getDtEnd(), $event->DTEND->isFloating());
        }
        $recurid = clone $event->DTSTART;
        $recurid->name = 'RECURRENCE-ID';
        $event->add($recurid);

        return $event;
    }
643465
function copy()
    {
        $collection = clone $this;

        $db = eZDB::instance();
        $db->begin();
        $collection->store();

        $oldItems = $this->itemList();
        foreach ( $oldItems as $oldItem )
        {
            $item = $oldItem->copy( $collection->attribute( 'id' ) );
        }
        $db->commit();
        return $collection;
    }
1370349
public function copy()
	{
		$view = $this->getView();

		$view->propertyData = $this->toArray( $view->item, true );
		$view->propertyTypes = $this->getPropertyTypes();
		$view->propertyBody = '';

		foreach( $this->getSubClients() as $client ) {
			$view->propertyBody .= $client->copy();
		}

		return $this->render( $view );
	}
869853
protected function copy()
    {
        if ($this->isStale) {
            throw new \BadMethodCallException("Unable to modify a stale server request object");
        }
        
        $request = clone $this;
        
        if ($this->isStale === false) {
            $this->dereferenceProperty('serverParams', 'cookies', 'queryParams', 'postData', 'uploadedFiles');
            $this->isStale = true;
        }
        
        return $request;
    }
287639
function copy()
    {
        $db = eZDB::instance();
        $db->begin();

        $newRole = eZRole::createNew();
        $this->copyPolicies( $newRole->attribute( 'id' ) );
        $newRole->setAttribute( 'name', ezpI18n::tr( 'kernel/role/edit', 'Copy of %rolename', null,
                                                array( '%rolename' => $this->attribute( 'name' ) ) ) );
        $newRole->store();
        $db->commit();
        return $newRole;
    }
713624
public function discard() {
		$filter = array_flip(func_get_args());
		$obj = $this->preserveInstance ? $this : clone $this;
		$obj->config = array_diff_key($this->config, $filter);
		return $obj;
	}
849181
public function getArrayCopy()
    {
        $copy = [];
        foreach ((array)$this as $key => $value) {
            if (is_string($value)) {
                continue;
            }
            $element = $value->getElement();
            if (is_object($element)
                and method_exists($element, 'name')
                and $name = $element->name()
                and !($element instanceof Button)
            ) {
                $copy[$name] = $element->getValue();
            }
        }
        return $copy;
    }
356740
protected function getExistingObject()
    {
        $content = ContentQuery::create()
            ->findOneById($this->getRequest()->get('content_id', 0));

        if (null !== $content) {
            $content->setLocale($this->getCurrentEditionLocale());
        }

        return $content;
    }
801991
public function getPlaceableObject()
    {
        if ($this->placeableobject) {
            return $this->placeableobject;
        }
        $instance = Injector::inst()->get($this->ObjectClassName);
        $this->placeableobject = $instance;
        return $instance;
    }
185508
public function performReadonlyTransformation()
    {
        $copy = clone $this;
        $copy->setReadonly(true);
        $copyConfig = $copy->getConfig();

        // get the whitelist for allowable readonly components
        $allowedComponents = $this->getReadonlyComponents();
        foreach ($this->getConfig()->getComponents() as $component) {
            // if a component doesn't exist, remove it from the readonly version.
            if (!in_array(get_class($component), $allowedComponents)) {
                $copyConfig->removeComponent($component);
            }
        }

        // As the edit button may have been removed, add a view button if it doesn't have one
        if (!$copyConfig->getComponentByType(GridFieldViewButton::class)) {
            $copyConfig->addComponent(new GridFieldViewButton);
        }

        return $copy;
    }
470367
public function toArray()
    {
        return array_map(function($value) {
            if ($value instanceof Component) {
                return $value->json()->getAttributes();
            }

            return $value instanceof Arrayable ? $value->toArray() : $value;

        }, $this->items);
    }
1093472
public function build()
    {
        if (isset($this->component)) {
            return $this->component;
        }

        $this->component = BuildUtil::removeNullElements([
            'type' => ComponentType::ICON,
            'url' => $this->url,
            'margin' => $this->margin,
            'size' => $this->size,
            'aspectRatio' => $this->aspectRatio,
        ]);

        return $this->component;
    }
600786
public static function getImageComponent()
    {
        // Get image component
        if (is_object(static::$_imageComponent)) {
            $imageComponent = static::$_imageComponent;
        } else {
            $imageComponent = Yii::createObject([
                'class' => 'yii\image\ImageDriver',
            ]);
            // Store component for future using
            static::$_imageComponent = $imageComponent;
        }

        return $imageComponent;
    }