Imports the provided model configuration into a new model.

Note that this method assumes that self::check_dependencies has already been called.

@param  string $zipfilepath Path to the zip file to import
@return \core_analytics\model
496126
public function import(string $zipfilepath) : \core_analytics\model {

        list($modeldata, $mlbackenddir) = $this->extract_import_contents($zipfilepath);

        $target = \core_analytics\manager::get_target($modeldata->target);
        $indicators = [];
        foreach ($modeldata->indicators as $indicatorclass) {
            $indicator = \core_analytics\manager::get_indicator($indicatorclass);
            $indicators[$indicator->get_id()] = $indicator;
        }
        $model = \core_analytics\model::create($target, $indicators, $modeldata->timesplitting, $modeldata->processor);

        // Import them disabled.
        $model->update(false, false, false, false);

        if ($mlbackenddir) {
            $modeldir = $model->get_output_dir(['execution']);
            if (!$model->get_predictions_processor(true)->import($model->get_unique_id(), $modeldir, $mlbackenddir)) {
                throw new \moodle_exception('errorimport', 'analytics');
            }
            $model->mark_as_trained();
        }

        return $model;
    }
1080579
public function loadYamlFile($filePath)
    {
        if (file_exists($filePath)) {
            $this->loadYaml(file_get_contents($filePath));

            return $this;
        }

        return $this;
    }
822128
public static function loadFromPhpFile(string $filePath): DataMap
    {
        if (! is_file($filePath)) {
            throw new CoreException(CoreException::FILE_NOT_FOUND, '找不到php文件: ' . $filePath, $filePath);
        }
        $data = include $filePath;
        return new static($data);
    }
1242106
private function loadConfiguration($filePath)
    {
        if (!is_file($filePath)) {
            throw new \InvalidArgumentException(sprintf('The configuration file "%s" does not exit', $filePath));
        }

        $config = include $filePath;

        if (!$config instanceof Configuration) {
            throw new \InvalidArgumentException(
                sprintf(
                    'The configuration file "%s" must return a "Akeneo\CouplingDetector\Configuration\Configuration"',
                    $filePath
                )
            );
        }

        return $config;
    }
78974
public function setPath(?string $path = null): ZipInterface {

        if ( $path === null ) {
            $this->path = null;
        } else if ( !file_exists($path) ) {
            throw new ZipException("Not existent path: $path");
        } else {
            $this->path = $path;
        }

        return $this;

    }
1259840
public function loadPaths($basePath = null, $configPath = null)
    {
        if ($basePath) {
            $this->basePath = realpath($basePath);
        }

        $this->paths = $this->loadConfig($configPath);

        return $this;
    }
360460
public static function fromPhp($configFilePath)
    {
        ob_start();
        /** @noinspection PhpIncludeInspection */
        $configArray = include($configFilePath);

        // Hide console output
        ob_end_clean();

        if (!is_array($configArray)) {
            throw new \RuntimeException(sprintf(
                'PHP file \'%s\' must return an array',
                $configFilePath
            ));
        }

        return new static($configArray, $configFilePath);
    }
1220870
public function composer($dependencyFilePath = null)
    {

        $this->active = new VirtualModule($this->system_path, $this->map, $this, 'local');

        return $this;
    }
508724
public final function addClass(
        string $className,
        string $classPath): LoaderInterface
    {
        $this->classMap->addClass($className, $classPath);
        return $this;
    }
206458
public static function loadEncryptionKey(string $filePath): EncryptionKey
    {
        if (!\is_readable($filePath)) {
            throw new CannotPerformOperation(
                'Cannot read keyfile: '. $filePath
            );
        }
        return new EncryptionKey(
            self::loadKeyFile($filePath)
        );
    }
520219
protected function importAsset($absolutePath, $relativePath)
    {
        /** @var AssetHandler $assetHandler */
        foreach ($this->assetHandlers as $assetHandler) {
            if ($assetHandler->isApplicable($relativePath)) {
                $info = $assetHandler->handle($absolutePath, $relativePath);

                if ($relativePath != ltrim($info['uri'], '/')) {
                    $this->setItemContent(str_replace($relativePath, $info['uri'], $this->getItemContent()));
                }

                //Break chain of asset handler, first applicable is taken
                return;
            }
        }
        throw new AssetManagerException('Unable to import auxiliary & dependency files. No asset handler applicable to file : ' . $relativePath);
    }
460272
private function loadModule($modulePath)
    {
        $module = oxNew(\OxidEsales\Eshop\Core\Module\Module::class);
        if (!$module->loadByDir($modulePath)) {
            throw new Exception("Module not found");
        }
        return $module;
    }
654923
public function importedAsset($path, $parameters = array())
  {
    if ($this->useController) {
      $path = $this->router->generate(
        "_assetic_" . $this->res->getFormulaeName($path),
        $parameters
      );
    } else {
      $path = $this->assets->getAssetUrl(
        ltrim($path, "/")
      );
    }

    return $path;
  }
357678
protected function registerMigrationFiles($packagePath)
    {
        $packagePath = rtrim($packagePath, '/');
        $packageKey = substr($packagePath, strrpos($packagePath, '/') + 1);
        $migrationsDirectory = Files::concatenatePaths(array($packagePath, 'Migrations/Code'));
        if (!is_dir($migrationsDirectory)) {
            return;
        }

        foreach (Files::getRecursiveDirectoryGenerator($migrationsDirectory, '.php') as $filenameAndPath) {
            /** @noinspection PhpIncludeInspection */
            require_once($filenameAndPath);
            $baseFilename = basename($filenameAndPath, '.php');
            $className = '\\Neos\\Flow\\Core\\Migrations\\' . $baseFilename;
            /** @var AbstractMigration $migration */
            $migration = new $className($this, $packageKey);
            $this->migrations[$migration->getVersionNumber()] = $migration;
        }
    }
449163
public function loadPlugins(string $pluginsPath)
    {
        $directories = Collection::make((new Filesystem())->directories($this->mupluginsPath()))
            ->map(function ($directory) {
                return ltrim(substr($directory, strrpos($directory, DS)), '\/');
            })->toArray();

        (new PluginsRepository($this, new Filesystem(), $pluginsPath, $this->getCachedPluginsPath()))
            ->load($directories);
    }
441583
public function addGlobPath($globPath) {
    foreach(glob($globPath, GLOB_BRACE) as $definitionFile) {
      $this->addDefinitions($definitionFile);
    }
    return $this;
  }
1323663
public function import($filePath, array $options)
    {
        $file = new \SplFileObject($filePath);
        $requestParams = $this->buildRequestParams($file, $options);

        return $this->apiRequester->request('POST', $this->url(), $requestParams);
    }