Make Copy of given record with optional modifiactions

!!!Experimental Feature!!!

@param int  $source
@param array $overrides

@return FlexiBeeRW|null copied record object or null in case of failure
430471
public function copy($source, $overrides = [])
    {
        $this->sourceId = $source;
        return $this->sync($overrides) ? $this : null;
    }
499313
public void createOverride(int groupId, String methodName, String className) throws Exception {
        // first make sure this doesn't already exist
        for (Method method : EditService.getInstance().getMethodsFromGroupId(groupId, null)) {
            if (method.getMethodName().equals(methodName) && method.getClassName().equals(className)) {
                // don't add if it already exists in the group
                return;
            }
        }

        try (Connection sqlConnection = sqlService.getConnection()) {
            PreparedStatement statement = sqlConnection.prepareStatement(
                "INSERT INTO " + Constants.DB_TABLE_OVERRIDE
                    + "(" + Constants.OVERRIDE_METHOD_NAME
                    + "," + Constants.OVERRIDE_CLASS_NAME
                    + "," + Constants.OVERRIDE_GROUP_ID
                    + ")"
                    + " VALUES (?, ?, ?)"
            );
            statement.setString(1, methodName);
            statement.setString(2, className);
            statement.setInt(3, groupId);
            statement.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
1346508
public function upload($source, $path, $override = false)
    {
        $path = trim($path, '/');
        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        $type  = finfo_file($finfo, $source);
        finfo_close($finfo);

        $response = $this->clientS3->putObject(array(
            'Bucket'      => $this->bucket,
            'Key'         => $path,
            'SourceFile'  => $source,
            'ACL'         => static::ACL_PUBLIC_READ,
            'ContentType' => $type,
            'CacheControl' => "max-age={$this->expires_seconds}",
            'Expires' => gmdate("D, d M Y H:i:s T", time()+$this->expires_seconds),
        ));

        return true;
    }
763036
protected function add(Permission $permission, $override = true)
    {
        if ($override || ! $this->permissions->containsKey($permission->getName()))
        {
            $this->permissions->set($permission->getName(), $permission);
        }
    }
682726
public function heredocRealOverride($matches)
    {
        $this->record($matches[0], null);
        $this->posShift(strlen($matches[0]));
        // don't need this anymore
        $this->removePattern('HEREDOC_NL');
        assert($this->heredoc !== null);
        $delim = preg_quote($this->heredoc);
        $substr = $this->scanUntil('/^' . $delim . '\\b/m');
        if ($substr !== null) {
            $this->record($substr, 'HEREDOC');
            $delim_ = $this->scan('/' . $delim . '/');
            assert($delim !== null);
            $this->record($delim_, 'DELIMITER');
        } else {
            $this->record($this->rest(), 'HEREDOC');
            $this->terminate();
        }
    }
517623
public function setOverrides($overrides)
    {
        $fieldsOverridden = [];
        if (isset($this->payload->body)) {
            foreach ($this->payload->body as &$field) {
                if (
                    isset($field->overridable)
                    && true === $field->overridable
                    && isset($field->key)
                    && isset($overrides[$field->key])
                    && null !== $overrides[$field->key]
                ) {
                    $field->value                  = $overrides[$field->key];
                    $fieldsOverridden[$field->key] = $overrides[$field->key];
                }
            }
        }
        if ($fieldsOverridden) {
            $this->setLogs($fieldsOverridden, 'fieldsOverridden');
        }

        return $this;
    }
564941
public function upload($source, $path, $override = false)
    {
        $path = ltrim($path, "/");
        return copy($source, $this->pathRoot.$path);
    }
1337749
public function createRoute(array $overrideKeys = [])
    {
        $composition = $this->getKeys();
        
        foreach ($overrideKeys as $key => $value) {
            if (array_key_exists($key, $composition)) {
                $composition[$key] = $value;
            }
        }
        return implode('/', $composition);
    }
508713
public function build(): SetOverrideCertificateErrorsRequest
	{
		$instance = new SetOverrideCertificateErrorsRequest();
		if ($this->override === null) {
			throw new BuilderException('Property [override] is required.');
		}
		$instance->override = $this->override;
		return $instance;
	}
409086
public function set($key, $value = null, $override = false)
    {
        // if key is array,
        // loop the set, while expecting value parameter to be override
        if(is_array($key))
        {
            $override = $value;

            foreach($key as $k => $val)
            {
                if($override === true)
                    $this->setOverride($k, $val);
                else
                    $this->data[$k] = $val;
            }

            return $this;
        }
        else
        {
            if($override === true)
                $this->setOverride($key, $value);
            else
                $this->data[$key] = $value;

            return $this;
        }
    }
998146
private function overrideConfiguration(array $configuration, array $override)
    {
        $configuration['parameters'] = array_replace(
            $configuration['parameters'],
            $override['parameters']
        );

        unset($override['parameters']);

        return array_replace($configuration, $override);
    }
244279
public function customizeEpub( $overrides = [] ) {
		$path = $this->getPathToEpubScss();
		if ( $path ) {
			return $this->customize( 'epub', \Pressbooks\Utility\get_contents( $path ), $overrides );
		}
		return '';
	}
1326070
public function set($key, $value, $override = true) {
        if(is_null($key)) return;
        if(!$override && array_key_exists($key, $this->data)) return;
        $this->data[$key] = $value;        
    }
71767
public function setRecipientOverride($recipientOverride)
    {
        if (!$recipientOverride) {
            return $this;
        }

        if (!filter_var($recipientOverride, FILTER_VALIDATE_EMAIL)) {
            throw new Exception('Recipient override must be a valid email address');
        }

        $this->recipientOverride = (string) $recipientOverride;

        return $this;
    }
21873
protected function update_last_message( $overrides = [] ) {
		if ( $this->messages->isNotEmpty() ) {
			$this->messages->last()->update( $overrides );
		}

		return $this;
	}
1350326
protected function compileSelectStatement($selectOverride = false)
    {
        $sqlStatement = parent::compileSelectStatement($selectOverride);

        if ($this->isSubQuery) {
            return $sqlStatement;
        }

        return str_replace('SELECT', 'SELECT SQL_CALC_FOUND_ROWS', $sqlStatement);
    }
516063
public function load($pluginName, array $overrideProps = [])
	{
		// Validate the plugin name / class
		$pluginName = $this->normalizeKey($pluginName);
		$className  = 's9e\\TextFormatter\\Plugins\\' . $pluginName . '\\Configurator';

		if (!class_exists($className))
		{
			throw new RuntimeException("Class '" . $className . "' does not exist");
		}

		// Create the plugin
		$plugin = new $className($this->configurator, $overrideProps);

		// Save it
		$this->set($pluginName, $plugin);

		// Return it
		return $plugin;
	}