Creates a new item, combines data with the column headings
@param $itemData
@return array
185994
protected function createNewItem($itemData)
    {
        $item = array_flip($this->columns);

        foreach ($item as $key => $value) {
            if (isset($itemData[$key])) {
                $item[$key] = $itemData[$key];
            } else {
                $item[$key] = null;
            }
        }

        return $item;
    }
381222
public function objectCreate($oData)
    {
        $sBucket       = !empty($oData->bucket->slug) ? $oData->bucket->slug : '';
        $sFilenameOrig = !empty($oData->filename) ? $oData->filename : '';
        $sFilename     = strtolower(substr($sFilenameOrig, 0, strrpos($sFilenameOrig, '.')));
        $sExtension    = strtolower(substr($sFilenameOrig, strrpos($sFilenameOrig, '.')));
        $sSource       = !empty($oData->file) ? $oData->file : '';
        $sMime         = !empty($oData->mime) ? $oData->mime : '';
        $sName         = !empty($oData->name) ? $oData->name : 'file' . $sExtension;

        // --------------------------------------------------------------------------

        try {

            //  Create "normal" version
            $this->sdk()->putObject([
                'Bucket'      => $this->getBucket(),
                'Key'         => $sBucket . '/' . $sFilename . $sExtension,
                'SourceFile'  => $sSource,
                'ContentType' => $sMime,
                'ACL'         => 'public-read',
            ]);

            //  Create "download" version
            $this->sdk()->copyObject([
                'Bucket'             => $this->getBucket(),
                'CopySource'         => $this->getBucket() . '/' . $sBucket . '/' . $sFilename . $sExtension,
                'Key'                => $sBucket . '/' . $sFilename . '-download' . $sExtension,
                'ContentType'        => 'application/octet-stream',
                'ContentDisposition' => 'attachment; filename="' . str_replace('"', '', $sName) . '" ',
                'MetadataDirective'  => 'REPLACE',
                'ACL'                => 'public-read',
            ]);

            return true;

        } catch (\Exception $e) {
            $this->setError('AWS-SDK EXCEPTION: [objectCreate]: ' . $e->getMessage());
            return false;
        }
    }
1135567
protected function mergeData(array $data)
    {
        $columns = [];
        foreach ($this->getHeader() as $key => $default) {
            $columns[] = isset($data[$key]) ? $data[$key] : $default;
        }

        return $columns;
    }
317124
public function create($data)
    {
        $data = $this->retrieveData($data);
        $insertData = [
            'role_id'=> $this->getRoleId(),
            'resource' => $data['resource'],
            'methods'=> implode(',', $data['methods']),
        ];
        $this->table->insert($insertData);

        return $data;
    }
965880
protected function mapTranslationDataResult(array $translationData): array
    {
        $result = [];
        foreach ($translationData as $data) {
            $result[] = TranslationData::createFromArray($data);
        }
        return $result;
    }
239401
private function buildBlockCreateStruct(array $blockData): BlockCreateStruct
    {
        if (!array_key_exists($blockData['main_locale'], $blockData['parameters'])) {
            throw new RuntimeException(
                sprintf('Missing data for block main locale "%s"', $blockData['main_locale'])
            );
        }

        $blockDefinition = $this->blockDefinitionRegistry->getBlockDefinition($blockData['definition_identifier']);

        $blockCreateStruct = $this->blockService->newBlockCreateStruct($blockDefinition);
        $blockCreateStruct->name = $blockData['name'];
        $blockCreateStruct->viewType = $blockData['view_type'];
        $blockCreateStruct->itemViewType = $blockData['item_view_type'];
        $blockCreateStruct->isTranslatable = $blockData['is_translatable'];
        $blockCreateStruct->alwaysAvailable = $blockData['is_always_available'];
        $blockCreateStruct->fillParametersFromHash($blockData['parameters'][$blockData['main_locale']], true);
        $this->setConfigStructs($blockCreateStruct, $blockDefinition, $blockData['configuration'] ?? []);
        $this->setCollectionStructs($blockCreateStruct, $blockData['collections']);

        return $blockCreateStruct;
    }
887271
public function createFromData(array $configData) : SettingsContract {
        $data       = (array) Arr::get($configData, 'data', []);
        $rules      = (array) Arr::get($configData, 'rules', []);
        $phrases    = (array) Arr::get($configData, 'phrases', []);
        $customUrl  = (string) Arr::get($configData, 'custom_url', '');

        return new Settings($data, $rules, $phrases, $customUrl);
    }
889037
public function create($data) {
        $data = Values::of(array('Data' => Serialize::jsonObject($data), ));

        $payload = $this->version->create(
            'POST',
            $this->uri,
            array(),
            $data
        );

        return new SyncListItemInstance(
            $this->version,
            $payload,
            $this->solution['serviceSid'],
            $this->solution['listSid']
        );
    }
1160957
public function createArray(array $items): Array_
    {
        $arrayItems = [];

        foreach ($items as $item) {
            $arrayItems[] = $this->createArrayItem($item);
        }

        return new Array_($arrayItems);
    }
162409
protected function _item($data, $options = [])
    {
        $name = $this->_through;
        $parent = $this->_parent;
        $relThrough = $parent->schema()->relation($name);
        $through = $relThrough->to();
        $id = $this->_parent->id();
        $item = $through::create($id !== null ? $relThrough->match($this->_parent) : [], $options);
        $item->setAt($this->_using, $data, $options);
        return $item;
    }
1144484
public function diff(array $oldData, array $newData)
    {
        $diff = [];
        $keys = array_keys($oldData + $newData);
        
        foreach ($keys as $field) {
            $old = array_key_exists($field, $oldData) ? $oldData[$field] : null;
            $new = array_key_exists($field, $newData) ? $newData[$field] : null;

            if ($old == $new) {
                $row = ['old' => '', 'new' => '', 'same' => $old];
            } else {
                $row = ['old' => $old, 'new' => $new, 'same' => ''];
            }

            $diff[$field] = $row;
        }

        return $diff;
    }
500383
protected function &_NewElement(&$aData)
    {
        $oElement = false;
        $sTableObject = $this->sTableObject;
        if (array_key_exists('class', $aData)) {
            $sTableObject = $aData['class'];
        }

        // try to fetch the element from _items first
        $oElement = new $sTableObject();
        $oElement->table = $this->sTableName;
        $oElement->SetLanguage($this->iLanguageId);
        $oElement->LoadFromRow($aData);

        return $oElement;
    }
364879
protected function getCreationEvent($formData)
    {
        $saleCreateEvent = new SaleCreateEvent();

        $saleCreateEvent
            ->setLocale($formData['locale'])
            ->setTitle($formData['title'])
            ->setSaleLabel($formData['label'])
        ;

        return $saleCreateEvent;
    }
203718
private function addTermData($termData)
    {
        $labelsByThesaurusId = [];

        foreach ($termData as $currentTerm) {
            $label = $currentTerm['expansions_terms'];

            if (isset($currentTerm['expanded_term']) && $currentTerm['expanded_term']) {
                $label = sprintf("%s => %s", $currentTerm['expanded_term'], $label);
            }

            $labelsByThesaurusId[$currentTerm['thesaurus_id']][] = $label;
        }

        foreach ($labelsByThesaurusId as $thesaurusId => $labels) {
            $this->_items[$thesaurusId]->setData('terms_summary', implode(" <br/> ", $labels));
        }

        return $this;
    }
672549
public function create(Resource\ResourceData $resourceData)
    {
        return $this->crudRepositoryAdapter->createResource($this->resourceType, $resourceData);
    }
120979
public function make_question($questiondata) {
        $question = $this->make_question_instance($questiondata);
        $this->initialise_question_instance($question, $questiondata);
        return $question;
    }
306418
private function prepareItemData($itemData, $ttl = null)
    {
        $ttl = $this->normalizeTtl($ttl);

        // Integrate TTL into data (it will be checked later in the get() method)
        $fileData = [
            'ttl'  => $ttl,
            'item' => $itemData,
        ];

        return '<?php return unserialize(' . var_export(serialize($fileData), true) . ');';
    }