Copy a fact to the clipboard.

@param Fact $fact
184056
public function copyFact(Fact $fact): void
    {
        $clipboard   = Session::get('clipboard', []);
        $record_type = $fact->record()::RECORD_TYPE;
        $fact_id     = $fact->id();

        // If we are copying the same fact twice, make sure the new one is at the end.
        unset($clipboard[$record_type][$fact_id]);

        $clipboard[$record_type][$fact_id] = [
            'factrec' => $fact->gedcom(),
            'fact'    => $fact->getTag(),
        ];

        // The clipboard only holds a limited number of facts.
        $clipboard[$record_type] = array_slice($clipboard[$record_type], -self::CLIPBOARD_SIZE);

        Session::put('clipboard', $clipboard);
    }
858285
private function _copySection($source, &$target)
    {
        foreach ($source as $key => $value) {

            if (!array_key_exists($key, $target)) $target[$key] = $value;
        }
    }
1071573
private function copyData(string $source, string $to, array $mapping)
    {
        $sourceColumns = array_keys($mapping);
        $targetColumns = array_values($mapping);

        //Preparing mapping
        $sourceColumns = array_map([$this, 'identify'], $sourceColumns);
        $targetColumns = array_map([$this, 'identify'], $targetColumns);

        $query = sprintf(
            'INSERT INTO %s (%s) SELECT %s FROM %s',
            $this->identify($to),
            implode(', ', $targetColumns),
            implode(', ', $sourceColumns),
            $this->identify($source)
        );

        $this->run($query);
    }
809388
public function formatFirstMajorFact(array $facts, int $style): string
    {
        foreach ($this->facts($facts, true) as $event) {
            // Only display if it has a date or place (or both)
            if ($event->date()->isOK() && $event->place()->gedcomName() !== '') {
                $joiner = ' — ';
            } else {
                $joiner = '';
            }
            if ($event->date()->isOK() || $event->place()->gedcomName() !== '') {
                switch ($style) {
                    case 1:
                        return '<br><em>' . $event->label() . ' ' . FunctionsPrint::formatFactDate($event, $this, false, false) . $joiner . FunctionsPrint::formatFactPlace($event) . '</em>';
                    case 2:
                        return '<dl><dt class="label">' . $event->label() . '</dt><dd class="field">' . FunctionsPrint::formatFactDate($event, $this, false, false) . $joiner . FunctionsPrint::formatFactPlace($event) . '</dd></dl>';
                }
            }
        }

        return '';
    }
1154162
function copyfrom($var,$func=NULL) {
		if (is_string($var))
			$var=\Base::instance()->$var;
		if ($func)
			$var=call_user_func($func,$var);
		foreach ($var as $key=>$val)
			$this->set($key,$val);
	}
162075
public function pasteFact(ServerRequestInterface $request, Tree $tree, ClipboardService $clipboard_service): ResponseInterface
    {
        $xref    = $request->get('xref', '');
        $fact_id = $request->get('fact_id');

        $record = GedcomRecord::getInstance($xref, $tree);

        Auth::checkRecordAccess($record, true);

        $clipboard_service->pasteFact($fact_id, $record);

        return response();
    }
1332610
function copyfrom($var) {
		if (is_string($var))
			$var=\Base::instance()->$var;
		foreach ($var as $key=>$val)
			$this->set($key,$val);
	}
925877
public function copy($name = null)
    {
        $this->_process($this->_list($name), true, $this->param('overwrite'));
    }
617474
public function copy($proto){
		$this->id = $proto->id;
		$this->relation_id = $proto->relation_id;
		$this->text = $proto->text;
		$this->data = $proto->data;			
	}
1143662
public static Fact fact(String key, @NullableDecl Object value) {
    return new Fact(key, String.valueOf(value));
  }
431900
public function copyfrom($args) {
        if (($args || \Base::instance()->exists($args,$args))
        && is_array($args))
            foreach ($args as $arg => $val)
                $this->{$arg} = $val;
    }
407935
def facts(puppet=False):
    '''
    
    '''
    ret = {}
    opt_puppet = '--puppet' if puppet else ''
    cmd_ret = __salt__['cmd.run_all']('facter {0}'.format(opt_puppet))

    if cmd_ret['retcode'] != 0:
        raise CommandExecutionError(cmd_ret['stderr'])

    output = cmd_ret['stdout']

    # Loop over the facter output and  properly
    # parse it into a nice dictionary for using
    # elsewhere
    for line in output.splitlines():
        if not line:
            continue
        fact, value = _format_fact(line)
        if not fact:
            continue
        ret[fact] = value
    return ret
958346
public function copyData($object)
    {
        if ($object instanceof CNabuDataObject) {
            $this->data = $object->data;
        } elseif (is_array($object)) {
            $this->data = $object;
        }
    }
1372534
public function icon(Fact $fact): string
    {
        $asset = 'public/css/' . $this->name() . '/images/facts/' . $fact->getTag() . '.png';
        if (file_exists(Webtrees::ROOT_DIR . 'public' . $asset)) {
            return '<img src="' . e(asset($asset)) . '" title="' . GedcomTag::getLabel($fact->getTag()) . '">';
        }

        // Spacer image - for alignment - until we move to a sprite.
        $asset = 'public/css/' . $this->name() . '/images/facts/NULL.png';
        if (file_exists(Webtrees::ROOT_DIR . 'public' . $asset)) {
            return '<img src="' . e(asset($asset)) . '">';
        }

        return '';
    }
745650
public function copyFact(ServerRequestInterface $request, Tree $tree, ClipboardService $clipboard_service): ResponseInterface
    {
        $xref    = $request->get('xref', '');
        $fact_id = $request->get('fact_id');

        $record = GedcomRecord::getInstance($xref, $tree);

        Auth::checkRecordAccess($record, true);

        foreach ($record->facts() as $fact) {
            if ($fact->id() === $fact_id) {
                $clipboard_service->copyFact($fact);

                FlashMessages::addMessage(I18N::translate('The record has been copied to the clipboard.'));
                break;
            }
        }

        return response();
    }
867315
function getDecimals( $fact )
	{
		if (
				( ! isset( $fact['decimals'] )  || ! strlen( $fact['decimals'] ) ) &&
				( ! isset( $fact['precision'] ) || ! strlen( $fact['precision'] ) )
		 )
		{
			return INF;
		}

		return isset( $fact['decimals'] )
			? ( $fact['decimals'] == 'INF' ? INF : $fact['decimals'] )
			: XBRL_Instance::inferDecimals( $fact['value'], $fact['precision'] );
	}
400439
public function Filter( $facts, $variableSet )
	{
		// Look for the variable
		$vars = $variableSet->getBindingsAsVars();
		$clark = str_replace( "{}", "", "{{$this->variable['namespace']}}{$this->variable['name']}" );
		if ( ! isset( $vars[ $clark ] ) )
		{
			// Should probably throw some kind of error here
			throw XPath2Exception::withErrorCodeAndParam( "XPST0008", Resources::XPST0008, $clark );
		}

		/**
		 * @var \DOMNode[] $candidates
		 */
		$candidate = null;
		$var = $vars[ $clark ];
		if ( $var instanceof XPath2NodeIterator )
		{
			$node = reset( $var->ToList() );
			if ( is_null( $node ) )
			{
				throw XPath2Exception::withErrorCodeAndParam( "XPST0008", Resources::XPST0008, $clark );
			}

			$candidate = $node->getUnderlyingObject();
		}
		else
		{
			$candidate = $var->getUnderlyingObject();
		}

		$matched = array();
		$notMatched = array();

		$candidateParent = $candidate->parentNode;

		// The fact can be an
		foreach ( $facts as $fact )
		{
			$node = $fact->getUnderlyingObject();
			$factParent = $node->parentNode;

			if ( $candidateParent->isSameNode( $factParent ) )
			{
				$matched[] = $fact->CloneInstance();
			}
			else
			{
				$notMatched[] = $fact->CloneInstance();
			}
		}

		return DocumentOrderNodeIterator::fromItemset( $this->complement ? $notMatched : $matched );

		return $facts;
	}