@param ContentUpdateData|ContentCreateData|NewnessChecker $data

@return string
329574
private function resolveMainLanguageCode($data): string
    {
        return $data->isNew()
            ? $data->mainLanguageCode
            : $data->contentDraft->getVersionInfo()->getContentInfo()->mainLanguageCode;
    }
650561
public function contentEdit(
        ?ContentEditData $data = null,
        ?string $name = null,
        array $options = []
    ): FormInterface {
        $name = $name ?: StringUtil::fqcnToBlockPrefix(ContentEditType::class);
        $data = $data ?? new ContentEditData();

        if (empty($options['language_codes']) && null !== $data->getVersionInfo()) {
            $options['language_codes'] = $data->getVersionInfo()->languageCodes;
        }

        return $this->formFactory->createNamed(
            $name,
            ContentEditType::class,
            $data,
            $options
        );
    }
1068762
public function editLanguage($data) {
        $response=CodeBank_ClientAPI::responseBase();
        
        try {
            if(SnippetLanguage::get()->filter('Name:nocase', Convert::raw2sql($data->language))->Count()>0) {
                $response['status']='EROR';
                $response['message']=_t('CodeBankAPI.LANGUAGE_EXISTS', '_Language already exists');
            
                return $response;
            }
            
            
            $lang=SnippetLanguage::get()->byID(intval($data->id));
            if(empty($lang) || $lang===false || $lang->ID==0) {
                $response['status']='EROR';
                $response['message']=_t('CodeBankAPI.LANGUAGE_NOT_FOUND', '_Language not found');
                
                return $response;
            }
            
            
            //Update language and write
            if($lang->UserLanguage==true) {
                $lang->Name=$data->language;
                $lang->FileExtension=$data->fileExtension;
            }
            
            $lang->Hidden=$data->hidden;
            $lang->write();
            
            
            $response['status']='HELO';
            $response['message']="Language edited successfully";
        }catch (Exception $e) {
            $response['status']='EROR';
            $response['message']=_t('CodeBankAPI.SERVER_ERROR', '_Server error has occured, please try again later');
        }
        
        return $response;
    }
929862
public function sitesEdit(array $data)
    {
        if (!array_key_exists('code', $data)) {
            throw new \InvalidArgumentException(
                'Data must contain "code" parameter.'
            );
        }

        /* @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            sprintf('/reference/sites/%s/edit', $data['code']),
            "POST",
            ['site' => json_encode($data)]
        );
    }
8310
protected static function makeUpdateParameter($data)
    {
        foreach ($data as $field => $value) {
            $newData[] = "{$field}=:{$field}";
        }

        $newData = implode(",", $newData); // override new data

        return $newData;
    }
1017203
public function Check($data)
    {
        $value = $data[$this->prefix . 'Page'];
        return $this->pageField->Check($value);
    }
512657
public function getNew($data = [])
    {
        $pk = $this->getPrimaryKey();
        if (is_string($pk) && isset($data[$pk]) && $this->getRegistry()->has($data[$pk])) {
            $return = $this->getRegistry()->get($data[$pk]);
            $return->writeData($data);
            $return->writeDBData($data);

            return $return;
        }

        $record = $this->getNewRecordFromDB($data);

        return $record;
    }
359162
protected function serializeData($data, $contentType)
    {
        if (is_string($data)) {
            return $data;
        }
        
        $repository = new ApacheMimeTypes();
        list($format) = $repository->findExtensions($contentType) + [null];
        
        $method = 'serializeDataTo' . $format;
        
        if (method_exists($this, $method)) {
            return $this->$method($data);
        }

        $type = (is_object($data) ? get_class($data) . ' ' : '') . gettype($data);
        throw new \UnexpectedValueException("Unable to serialize $type to '$contentType'");
    }
1014028
protected function createAndReturnNewFirstEntity($data, $entityName)
    {
        if (is_array($data)) {
            $entity = $this->getFirstEntityByName($entityName);
            return $this->mapAttributesFromSecondEntityToFirstEntityAndReturnEntity($data, $entity);
        }

        return null;
    }
472446
public function update($data = null)
    {
        if ($this->hasMethod('__update') && is_callable([$this, '__update'])) {
            return $this->__update($data);
        }

        // notify observers about new data
        $this->notify();
    }
1299643
public function create($data)
    {
        $traitDescriptor = new TraitDescriptor();

        $traitDescriptor->setFullyQualifiedStructuralElementName($data->getFqsen());
        $traitDescriptor->setName($data->getName());
        $traitDescriptor->setLine($data->getLocation()->getLineNumber());
        $traitDescriptor->setPackage($this->extractPackageFromDocBlock($data->getDocBlock()) ?: '');

        // Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself
        $traitDescriptor->setNamespace(
            substr((string) $data->getFqsen(), 0, -strlen($data->getName()) - 1)
        );

        $this->assembleDocBlock($data->getDocBlock(), $traitDescriptor);

        $this->addProperties($data->getProperties(), $traitDescriptor);
        $this->addMethods($data->getMethods(), $traitDescriptor);

        return $traitDescriptor;
    }
1191500
public function makeHashable(Data $data): ?HashableFormat
    {
        if (!$data->isHashable()) {
            return null;
        }

        return HashableFormat::make($data);
    }
1328800
public function setContentData(string $data): self
    {
        $this->contentData = $data;
        $this->contentLength = strlen($this->contentData);
        $extraLength = $this->contentLength % 8;
        $this->paddingLength = $extraLength ? (8 - $extraLength) : 0;
        return $this;
    }
890723
private function doEncode($data = null)
    {
        $data = is_null($data) ? $this->data : $data;

        if (is_array($data) && (isset ($data[0]) || empty ($data))) {
            return $this->encodeList($data);
        } elseif (is_array($data)) {
            return $this->encodeDict($data);
        } elseif (is_integer($data) || is_float($data)) {
            $data = sprintf("%.0f", round($data, 0));
            return $this->encodeInteger($data);
        } else {
            return $this->encodeString($data);
        }
    }
522404
public function createNew($data)
    {
        if ($data instanceof File) {
            /* @var $data File */

            $media = new Media();
            if (method_exists($media, 'getClientOriginalName')) {
                $media->setName($data->getClientOriginalName());
            } else {
                $media->setName($data->getFilename());
            }
            $media->setContent($data);

            return $media;
        }
    }
1107893
public function checkData($data)
    {
        $class_name = $this->getTypeClassName();

        if (!$data instanceof $class_name) {
            $data = $this->createObjectFrom($data);
        }

        return $data;
    }
28164
public function updateWhereData($data) {
        $this->performed = false;
        $this->whereData = array_merge($this->whereData, $data);

        return $this;
    }