Check that the import file's ContentTypes exists.

@param Bag $importData

@throws RuntimeException
964668
private function validateContentTypes(Bag $importData)
    {
        $contentTypeNames = $this->contentTypes->keys()->toArray();
        $importData->filter(function ($k, $v) use ($contentTypeNames) {
            if (!in_array($k, $contentTypeNames)) {
                throw new RuntimeException(sprintf('ContentType "%s" is not configured.', $k));
            }
        });
    }
369548
public static function allowLtiLinkItem($postdata) {
        if ( ! isset($postdata['content_item_return_url']) ) return false;
        if ( isset($postdata['accept_media_types']) ) {
            $ltilink_mimetype = 'application/vnd.ims.lti.v1.ltilink';
            $m = new Mimeparse;
            $ltilink_allowed = $m->best_match(array($ltilink_mimetype), $postdata['accept_media_types']);
            if ( $ltilink_mimetype != $ltilink_allowed ) return false;
            return true;
        }
        return false;
    }
303345
private function checkDatas($yamlData)
    {
        try {
            if ($yamlData === false || !is_array($yamlData) || count($yamlData) > 1) {
                throw new ClassWrapperException('Malformed class content description');
            }

            foreach ($yamlData as $classname => $contentDesc) {
                if ($this->classname != $this->_normalizeVar($this->classname)) {
                    throw new ClassWrapperException("Class Name don't match with the filename");
                }

                if (!is_array($contentDesc)) {
                    throw new ClassWrapperException('None class content description found');
                }

                foreach ($contentDesc as $key => $data) {
                    switch ($key) {
                        case 'extends':
                            $this->extends = $this->_normalizeVar($data, true);
                            if (substr($this->extends, 0, 1) != NAMESPACE_SEPARATOR) {
                                $this->extends = NAMESPACE_SEPARATOR.$this->namespace.
                                    NAMESPACE_SEPARATOR.$this->extends;
                            }

                            break;
                        case 'interfaces':
                            $data = false === is_array($data) ? array($data) : $data;
                            $this->interfaces = array();

                            foreach ($data as $i) {
                                $interface = $i;
                                if (NAMESPACE_SEPARATOR !== substr($i, 0, 1)) {
                                    $interface = NAMESPACE_SEPARATOR.$i;
                                }

                                // add interface only if it exists
                                if (true === interface_exists($interface)) {
                                    $this->interfaces[] = $interface;
                                }
                            }

                            // build up interface use string
                            $str = implode(', ', $this->interfaces);
                            if (0 < count($this->interfaces)) {
                                $this->interfaces = 'implements '.$str;
                            } else {
                                $this->interfaces = '';
                            }

                            break;
                        case 'repository':
                            if (class_exists($data)) {
                                $this->repository = $data;
                            }
                            break;
                        case 'traits':
                            $data = false === is_array($data) ? array($data) : $data;
                            $this->traits = array();

                            foreach ($data as $t) {
                                $trait = $t;
                                if (NAMESPACE_SEPARATOR !== substr($t, 0, 1)) {
                                    $trait = NAMESPACE_SEPARATOR.$t;
                                }

                                // add traits only if it exists
                                if (true === trait_exists($trait)) {
                                    $this->traits[] = $trait;
                                }
                            }

                            // build up trait use string
                            $str = implode(', ', $this->traits);
                            if (0 < count($this->traits)) {
                                $this->traits = 'use '.$str.';';
                            } else {
                                $this->traits = '';
                            }

                            break;
                        case 'elements':
                        case 'parameters':
                        case 'properties':
                            $values = array();
                            $data = (array) $data;
                            foreach ($data as $var => $value) {
                                $values[strtolower($this->_normalizeVar($var))] = $value;
                            }

                            $this->$key = $values;
                            break;
                    }
                }
            }
        } catch (ClassWrapperException $e) {
            throw new ClassWrapperException($e->getMessage(), 0, null, $this->_path);
        }

        return true;
    }
1210868
public function importJson($jsonData)
    {
        $json = json_decode($jsonData, true);

        if ($json === null) {
            throw new \InvalidArgumentException("Footprint json is not a valid");
        }

        if (!is_array($json)) {
            throw new \InvalidArgumentException("Footprint json data is not a valid");
        }

        $this->_data += $json;
    }
813138
public static function isSupportedFormatAndVersion ($xmlData) {
        $xmlreader = new \XMLReader();
        $xmlreader->XML($xmlData);

        return self::isValidFormatAndVersion($xmlreader);

    }
617456
public function importFile (string $assetPathToMap) : void
    {
        try {
            $filePath = $this->namespaceRegistry->getFilePath(Asset::createFromAssetPath($assetPathToMap));

            if (\is_file($filePath))
            {
                $map = \json_decode(\file_get_contents($filePath), true);

                if (null !== $map)
                {
                    $this->importMap(
                        \dirname($assetPathToMap),
                        $map
                    );
                }
            }
        }
        catch (AssetsException $e)
        {
            if (null !== $this->logger)
            {
                $this->logger->error("Could not load dependency map at {path}.", [
                    "path" => $assetPathToMap,
                    "error" => $e->getMessage(),
                ]);
            }
        }
    }
282830
public static function loadLockPackages(array $lockData)
    {
        $loader = new ArrayLoader();
        $lockData = static::loadLockPackage($loader, $lockData);
        $lockData = static::loadLockPackage($loader, $lockData, true);
        $lockData = static::convertLockAlias($lockData);

        return $lockData;
    }
568823
final public function importData($data)
    {
        foreach ($data as $property => $value) {
            if ($this[$property] instanceof ModelState){
                $this[$property]->importData($value);
            } else {
                $this[$property] = $value;
            }
        }
    }
270922
public static function allowContentItem($postdata=false) {
        if ( ! $postdata ) $postdata = LTIX::ltiRawPostArray();
        return parent::allowContentItem($postdata);
    }
79883
protected function import($sImportClass, $arImportData)
    {
        if (empty($sImportClass) || empty($arImportData) || !class_exists($sImportClass)) {
            return;
        }

        /** @var \Lovata\Toolbox\Classes\Helper\AbstractImportModel $obImport */
        $obImport = new $sImportClass();
        $obImport->import($arImportData, false);
    }
520949
protected function requireDefaultRecordFixture($defaultData)
    {
        $code = $defaultData['ErrorCode'];
        $page = ErrorPage::get()->filter('ErrorCode', $code)->first();
        $pageExists = !empty($page);
        if (!$pageExists) {
            $page = new ErrorPage($defaultData);
            $page->write();
            $page->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
        }

        // Check if static files are enabled
        if (!self::config()->enable_static_file) {
            return;
        }

        // Ensure this page has cached error content
        $success = true;
        if (!$page->hasStaticPage()) {
            // Update static content
            $success = $page->writeStaticPage();
        } elseif ($pageExists) {
            // If page exists and already has content, no alteration_message is displayed
            return;
        }

        if ($success) {
            DB::alteration_message(
                sprintf('%s error page created', $code),
                'created'
            );
        } else {
            DB::alteration_message(
                sprintf('%s error page could not be created. Please check permissions', $code),
                'error'
            );
        }
    }
264030
@Deprecated
    public void importData(CmsObject cms, String importFile, String importPath, I_CmsReport report)
    throws CmsXmlException, CmsImportExportException, CmsRoleViolationException, CmsException {

        CmsImportParameters parameters = new CmsImportParameters(importFile, importPath, true);
        setImportParameters(parameters);

        importData(cms, report);
    }
878648
public function importarRutas(array $rutas)
    {
        foreach ($rutas as $ruta) {
            if (isset($ruta[4])) {
                $this->agregarRuta($ruta[0], $ruta[1], $ruta[2], $ruta[3], $ruta[4]);
            } elseif (isset($ruta[3])) {
                $this->agregarRuta($ruta[0], $ruta[1], $ruta[2], $ruta[3]);
            } elseif (is_int($ruta[0])) {
                $this->agregarRutaEstadoHttp($ruta[0], $ruta[1]);
            } else {
                $this->agregarRuta($ruta[0], $ruta[1], $ruta[2]);
            }
        }
    }
436903
public function import(array $data)
    {
        $this->_params = $this->arrayUtil->merge($this->_params, $data);
    }
268924
protected function checkJsonObjectOrArray(\SwaggerValidator\Common\Context $context, &$jsonData)
    {
        if (is_object($jsonData) && !($jsonData instanceof \stdClass)) {
            $context->throwException('Mismatching type of JSON Data received', get_class($this) . '::' . __METHOD__, __LINE__);
        }
        elseif (!is_object($jsonData) && !is_array($jsonData)) {
            $context->throwException('Mismatching type of JSON Data received', get_class($this) . '::' . __METHOD__, __LINE__);
        }

        if (is_array($jsonData)) {
            parent::setJSONIsArray();
        }

        return true;
    }
34041
private function import(&$data)
    {
        $imports = array();
        preg_match_all('/#@([-a-z0-9\/_]+)\\n/is', $data, $imports, PREG_SET_ORDER);
        foreach ($imports as $import) {
            $importPath = FS2LANG . '/' . $this->local . '/' . $import[1] . '.txt';
            $importData = @file_get_contents($importPath);

            // getting file content ok
            if ($importData != false) {
                $importData = str_replace(array("\r\n", "\r"), "\n", $importData); // unify linebreaks
                $this->import($importData);
                $replace = '/#@' . preg_quote($import[1], '/') . '/i';
                $data = preg_replace($replace, $importData, $data);
                // replace all imports recursive
            }
        }
        unset($imports);
    }
40160
private function syncItemSubscriberUpdateMode($importData, $websiteId)
    {
        $email = $importData['email'];
        $id = $importData['id'];
        $result = $this->client->postContacts($email);
        if (isset($result->id)) {
            $contactId = $result->id;
            $this->client->deleteAddressBookContact(
                $this->helper->getSubscriberAddressBook($websiteId),
                $contactId
            );
        } else {
            //suppress contacts
            $this->suppressedContactIds[] = $id;
        }
        return $result;
    }