@param array  $defaultSiteSettings
@param string $author
@param string $createdByUserId
@param string $createdReason

@return array|mixed
427401
public function getDefaultSitePageSettings(
        array $defaultSiteSettings,
        string $author,
        string $createdByUserId,
        string $createdReason
    ) {
        $pagesData = (array_key_exists('pages', $defaultSiteSettings) ? $defaultSiteSettings['pages'] : []);

        // Set the author for each
        foreach ($pagesData as $key => $pageData) {
            $pagesData[$key]['createdByUserId'] = $createdByUserId;
            $pagesData[$key]['createdReason']
                = 'Default page creation in ' . get_class($this) . ' for: ' . $createdReason;
            $pagesData[$key]['author'] = $author;
        }

        return $pagesData;
    }
907443
@Override
    public void setAuthor(final String author) {
        // Get the DCModule so that we can check to see if "creator" is already set.
        final DCModule dcModule = getDCModule();
        final String currentValue = dcModule.getCreator();

        if (Strings.isEmpty(currentValue)) {
            getDCModule().setCreator(author);
        }
    }
554537
protected function setAuthors($json, $authors)
    {
        $json['authors'] = [];
        foreach ($authors as $author) {
            list($name, $email) = \explode(' <', $author);

            $config = [
                'name'     => \trim($name),
                'email'    => \trim(\substr($email, 0, -1))
            ];

            if ($this->config->hasMetadata($author, 'homepage')) {
                $config['homepage'] = $this->config->getMetadata($author, 'homepage');
            }

            $config['role'] = $this->config->getMetadata($author, 'role') ?: 'Developer';

            $json['authors'][] = $config;
        }

        return $json;
    }
765729
public function createAction($workspaceName, Workspace $baseWorkspace, $ownerAccountIdentifier = null)
    {
        $existingWorkspace = $this->workspaceRepository->findByIdentifier($workspaceName);
        if ($existingWorkspace !== null) {
            $this->throwStatus(409, 'Workspace already exists', '');
        }

        if ($ownerAccountIdentifier !== null) {
            $owner = $this->userService->getUser($ownerAccountIdentifier);
            if ($owner === null) {
                $this->throwStatus(422, 'Requested owner account does not exist', '');
            }
        } else {
            $owner = null;
        }

        $workspace = new Workspace($workspaceName, $baseWorkspace, $owner);
        $this->workspaceRepository->add($workspace);
        $this->throwStatus(201, 'Workspace created', '');
    }
616580
public function create(array $data, MembershipInterface $author, ModelInterface $forum): PodiumResponse
    {
        /* @var $threadForm CategorisedFormInterface */
        $threadForm = $this->getForm();

        $threadForm->setAuthor($author);
        $threadForm->setForum($forum);

        if (!$threadForm->loadData($data)) {
            return PodiumResponse::error();
        }

        return $threadForm->create();
    }
236878
public function newInstance(
        string $createdByUserId,
        string $createdReason = Tracking::UNKNOWN_REASON
    ) {
        /** @var static $new */
        $new = parent::newInstance(
            $createdByUserId,
            $createdReason
        );

        // if no id, then it has not been save and can be returned
        if (empty($new->revisionId)) {
            return $new;
        }

        $new->revisionId = null;
        $new->createdDate = new \DateTime();

        $new->published = false;
        $new->publishedDate = null;

        /* Clone Plugins */
        $pluginWrappers = $new->pluginWrappers;
        $clonedPluginWrappers = new ArrayCollection();

        /** @var \Rcm\Entity\PluginWrapper $pluginWrapper */
        foreach ($pluginWrappers as $pluginWrapper) {
            $clonedPluginWrapper = $pluginWrapper->newInstance(
                $createdByUserId,
                $createdReason
            );
            $clonedPluginWrappers->add($clonedPluginWrapper);
        }

        $new->pluginWrappers = $clonedPluginWrappers;

        return $new;
    }
221990
public function setAuthors($authors)
    {
        $this->_authors = $authors;
        foreach ($authors as $_author) {
            $this->addAuthor($_author['name'], $_author['user'], $_author['email']);
        }
        return $this;
    }
576957
private function create_author_mapping_file( $file, $author_data ) {

		if ( touch( $file ) ) {
			$author_mapping = array();
			foreach ( $author_data as $author ) {
				$author_mapping[] = array(
					'old_user_login' => $author->user_login,
					'new_user_login' => $this->suggest_user( $author->user_login, $author->user_email ),
				);
			}
			$file_resource = fopen( $file, 'w' );
			\WP_CLI\utils\write_csv( $file_resource, $author_mapping, array( 'old_user_login', 'new_user_login' ) );
			return new WP_Error( 'author-mapping-error', sprintf( 'Please update author mapping file before continuing: %s', $file ) );
		} else {
			return new WP_Error( 'author-mapping-error', "Couldn't create author mapping file." );
		}
	}
802392
private function fetchLoggedAuthor(): Author
    {
        $author = new Author();

        try {
            $permissionResolver = $this->repository->getPermissionResolver();
            $userService = $this->repository->getUserService();
            $loggedUserId = $permissionResolver->getCurrentUserReference()->getUserId();
            $loggedUserData = $userService->loadUser($loggedUserId);

            $author->name = $loggedUserData->getName();
            $author->email = $loggedUserData->email;
        } catch (NotFoundException $e) {
            //Do nothing
        }

        return $author;
    }
266639
public static function defaultContent($name = null)
    {
        $defaults = [
            self::EMAIL_REACTIVATION => [
                'topic' => Yii::t('podium/view', '{forum} account reactivation'),
                'content' => Yii::t('podium/view', '<p>{forum} Account Activation</p><p>You are receiving this e-mail because someone has started the process of activating the account at {forum}.<br>If this person is you open the following link in your Internet browser and follow the instructions on screen.</p><p>{link}</p><p>If it was not you just ignore this e-mail.</p><p>Thank you!<br>{forum}</p>'),
            ],
            self::EMAIL_REGISTRATION => [
                'topic' => Yii::t('podium/view', 'Welcome to {forum}! This is your activation link'),
                'content' => Yii::t('podium/view', '<p>Thank you for registering at {forum}!</p><p>To activate your account open the following link in your Internet browser:<br>{link}<br></p><p>See you soon!<br>{forum}</p>'),
            ],
            self::EMAIL_PASSWORD => [
                'topic' => Yii::t('podium/view', '{forum} password reset link'),
                'content' => Yii::t('podium/view', '<p>{forum} Password Reset</p><p>You are receiving this e-mail because someone has started the process of changing the account password at {forum}.<br>If this person is you open the following link in your Internet browser and follow the instructions on screen.</p><p>{link}</p><p>If it was not you just ignore this e-mail.</p><p>Thank you!<br>{forum}</p>'),
            ],
            self::EMAIL_NEW => [
                'topic' => Yii::t('podium/view', 'New e-mail activation link at {forum}'),
                'content' => Yii::t('podium/view', '<p>{forum} New E-mail Address Activation</p><p>To activate your new e-mail address open the following link in your Internet browser and follow the instructions on screen.</p><p>{link}</p><p>Thank you<br>{forum}</p>'),
            ],
            self::EMAIL_SUBSCRIPTION => [
                'topic' => Yii::t('podium/view', 'New post in subscribed thread at {forum}'),
                'content' => Yii::t('podium/view', '<p>There has been new post added in the thread you are subscribing. Click the following link to read the thread.</p><p>{link}</p><p>See you soon!<br>{forum}</p>'),
            ],
            self::TERMS_AND_CONDS => [
                'topic' => Yii::t('podium/view', 'Forum Terms and Conditions'),
                'content' => Yii::t('podium/view', "Please remember that we are not responsible for any messages posted. We do not vouch for or warrant the accuracy, completeness or usefulness of any post, and are not responsible for the contents of any post.<br><br>The posts express the views of the author of the post, not necessarily the views of this forum. Any user who feels that a posted message is objectionable is encouraged to contact us immediately by email. We have the ability to remove objectionable posts and we will make every effort to do so, within a reasonable time frame, if we determine that removal is necessary.<br><br>You agree, through your use of this service, that you will not use this forum to post any material which is knowingly false and/or defamatory, inaccurate, abusive, vulgar, hateful, harassing, obscene, profane, sexually oriented, threatening, invasive of a person's privacy, or otherwise violative of any law.<br><br>You agree not to post any copyrighted material unless the copyright is owned by you or by this forum."),
            ],
        ];

        if (empty($name)) {
            return $defaults;
        }
        if (!empty($defaults[$name])) {
            return $defaults[$name];
        }
        return null;
    }
137201
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint)
    {
        // The provider does nothing, but is required
        $providerId = sprintf('%s.%s', self::PROVIDER_SWITCH_USER_STATELESS, $id);
        $container->setDefinition(
            $providerId,
            new DefinitionDecorator(self::PROVIDER_SWITCH_USER_STATELESS)
        );

        // The listener does the logic
        $listenerId = sprintf('%s.%s', self::LISTENER_SWITCH_USER_STATELESS, $id);
        $container
            ->setDefinition(
                $listenerId,
                new DefinitionDecorator(self::LISTENER_SWITCH_USER_STATELESS)
            )
            ->replaceArgument(1, new Reference($userProvider))
            ->replaceArgument(3, $id)
            ->replaceArgument(6, $config['parameter'])
            ->replaceArgument(7, $config['role'])
        ;

        return [$providerId, $listenerId, $defaultEntryPoint];
    }
11660
protected static function defaultCreateResponse(
        string $index,
        UriInterface $requestUri,
        CrudInterface $crud,
        JsonSchemasInterface $jsonSchemas,
        EncoderInterface $encoder
    ): ResponseInterface {
        $model = $crud->read($index);
        assert($model !== null && !($model instanceof PaginatedDataInterface));

        $responses = static::defaultCreateResponses($requestUri, $encoder);
        $fullUrl   = static::defaultGetResourceUrl($model, $requestUri, $jsonSchemas);
        $response  = $responses->getCreatedResponse($model, $fullUrl);

        return $response;
    }
779011
public function registerDefaults()
    {
        $requestSubscriber = new RequestSubscriber();
        $this->addSubscriber($requestSubscriber);

        $userAgentHeaderPlugin = new UserAgentHeaderPlugin();
        $this->addSubscriber($userAgentHeaderPlugin);

        return $this;
    }
187086
private function buildSettings(ServerRequestInterface $request, ResponseInterface $response): CorsSettings
    {
        $settings = new CorsSettings;

        $origin = array_fill_keys((array) $this->options["origin"], true);
        $settings->setRequestAllowedOrigins($origin);

        if (is_callable($this->options["methods"])) {
            $methods = (array) $this->options["methods"]($request, $response);
        } else {
            $methods = $this->options["methods"];
        }
        $methods = array_fill_keys($methods, true);
        $settings->setRequestAllowedMethods($methods);

        $headers = array_fill_keys($this->options["headers.allow"], true);
        $headers = array_change_key_case($headers, CASE_LOWER);
        $settings->setRequestAllowedHeaders($headers);

        $headers = array_fill_keys($this->options["headers.expose"], true);
        $settings->setResponseExposedHeaders($headers);

        $settings->setRequestCredentialsSupported($this->options["credentials"]);

        if (is_string($this->options["origin.server"])) {
            $settings->setServerOrigin($this->options["origin.server"]);
        }

        $settings->setPreFlightCacheMaxAge($this->options["cache"]);

        return $settings;
    }
547845
public function newInstance(
        string $createdByUserId,
        string $createdReason = Tracking::UNKNOWN_REASON
    ) {
        /** @var static $new */
        $new = parent::newInstance(
            $createdByUserId,
            $createdReason
        );

        // if no id, then it has not been save and can be returned
        if (empty($new->pageId)) {
            return $new;
        }

        $new->pageId = null;
        $new->name = null;
        $new->parent = null;

        return $new;
    }
216183
private function getWebsiteStoreId($customer, $defaultStoreId = null)
    {
        if ($customer->getWebsiteId() != 0 && empty($defaultStoreId)) {
            $storeIds = $this->storeManager->getWebsite($customer->getWebsiteId())->getStoreIds();
            $defaultStoreId = reset($storeIds);
        }
        return $defaultStoreId;
    }
1163197
public void setUserCreated(String userCreated) {

        try {
            String userCreatedName = OpenCms.getImportExportManager().translateUser(userCreated);
            try {
                m_resourceBuilder.setUserCreated(getCms().readUser(userCreatedName).getId());
            } catch (@SuppressWarnings("unused") CmsDbEntryNotFoundException e) {
                m_resourceBuilder.setUserCreated(getRequestContext().getCurrentUser().getId());
            }
        } catch (Throwable e) {
            setThrowable(e);
        }
    }