Copy the asset files of the PIC to the item exporter and return the list of copied assets
@param $replacementList
@return array
18441
public function copyAssetFiles(&$replacementList){
        $object = $this->object;
        $portableAssetsToExport = [];
        $service = new PortableElementService();
        $service->setServiceLocator(ServiceManager::getServiceManager());
        $files = $object->getModel()->getValidator()->getAssets($object, 'runtime');
        $baseUrl = $this->qtiItemExporter->buildBasePath() . DIRECTORY_SEPARATOR . $object->getTypeIdentifier();
        foreach ($files as $url) {
            // Skip shared libraries into portable element
            if (strpos($url, './') !== 0) {
                \common_Logger::i('Shared libraries skipped : ' . $url);
                $portableAssetsToExport[$url] = $url;
                continue;
            }
            $stream = $service->getFileStream($object, $url);
            $replacement = $this->qtiItemExporter->copyAssetFile($stream, $baseUrl, $url, $replacementList);
            $portableAssetToExport = preg_replace('/^(.\/)(.*)/', $object->getTypeIdentifier() . "/$2", $replacement);
            $portableAssetsToExport[$url] = $portableAssetToExport;
            \common_Logger::i('File copied: "' . $url . '" for portable element ' . $object->getTypeIdentifier());
        }
        return $this->portableAssetsToExport = $portableAssetsToExport;
    }
762680
public function prepare($fileContent)
    {
        $replacings = [
            '{name}',
            '{namespace}',
            '{testNamespace}',
            '{table}',
            '{getters}',
            '{interfaceGetters}',
            '{fillable}',
            '{repository}',
            '{directory}',
            '{eloquentTest}',
            '{repositoryTest}',
            '{repositoryTestData}',
        ];

        $replacements = [
            $this->getProvidedName(),
            $this->getAppNamespace(),
            $this->getTestsNamespace(),
            $this->getTable(),
            $this->getSettersGetters($this->fields),
            $this->getSettersGetters($this->fields, true),
            $this->getFillable($this->fields),
            $this->getRepositoryPayloads($this->fields),
            $this->getDirectory(),
            $this->getEloquentTests($this->fields),
            $this->getRepositoryTests($this->fields),
            $this->getRepositoryDataTests($this->fields),
        ];

        return str_replace($replacings, $replacements, $fileContent);
    }
653920
private static function getReplacements()
    {
        if (null !== self::$replacements) {
            return self::$replacements;
        }

        self::$replacements = array(
            // Trailing single-wildcard with separator prefix
            '/\\\\\.\\\\\*$/'     => '(?:\.\w+)?',
            // Single-wildcard with separator prefix
            '/\\\\\.\\\\\*/'      => '(?:\.\w+)',
            // Single-wildcard without separator prefix
            '/(?<!\\\\\.)\\\\\*/' => '(?:\w+)',
        );

        // preg_quote() escapes `#` in PHP 7.3+
        if (PHP_VERSION_ID >= 70300) {
            self::$replacements += array(
                // Multi-wildcard with separator prefix
                '/\\\\\.\\\\\#/'      => '(?:\.\w+)*',
                // Multi-wildcard without separator prefix
                '/(?<!\\\\\.)\\\\\#/' => '(?:|\w+(?:\.\w+)*)',
            );
        } else {
            self::$replacements += array(
                // Multi-wildcard with separator prefix
                '/\\\\\.#/'      => '(?:\.\w+)*',
                // Multi-wildcard without separator prefix
                '/(?<!\\\\\.)#/' => '(?:|\w+(?:\.\w+)*)',
            );
        }

        return self::$replacements;
    }
1207711
public function files()
    {
        $filesList = array_filter($this->items, function($item) {
            return ($item['instance'] instanceof FileInterface);
        });

        $filesList = array_map(function($item) {
            return $item['instance'];
        }, $filesList);

        return new Collection($filesList);
    }
1021362
public function setReplacementSources(array $replacementSources)
    {
        $replacementSources = array_filter($replacementSources, function ($source) {
            return ($source instanceof ReplacementSourceInterface);
        });

        $this->replacementSources = $replacementSources;
    }
920812
protected function copyAssets()
    {
        $packagePath = $this->packagePath();

        if ($this->useWindows()) {
            $source = $packagePath."/public/assets";
        } else {
            $source = $packagePath."/public/assets/";
        }
        $destination = $this->normalizePath(public_path('assets'));
        if (! File::exists($source)) {
            File::makeDirectory($source);
        }
        if (! File::exists($destination)) {
            File::makeDirectory($destination);
        }
        $copyAssetsCommand = $this->copyCommand().' '.$this->copyOptions().' "'.$source.'" "'.$destination.'" > nul';

        shell_exec($copyAssetsCommand);
    }
705538
protected function prepareReplacements(Exception $exception): array
    {
        $statusCode = $this->getStatusCode($exception);

        if (!$message = $exception->getMessage()) {
            $message = sprintf('%d %s', $statusCode, Response::$statusTexts[$statusCode]);
        }

        $replacements['message'] = $message;

        if ($code = $exception->getCode()) {
            $replacements['code'] = $code;
        }

        $replacements['status_code'] = $statusCode;


        if ($exception instanceof ApiException && $exception->apiMessage->getErrors()) {
            $replacements['errors'] = $exception->apiMessage->getErrors();
        }


        if ($exception instanceof ApiException && null !== $exception->apiMessage->getHypermedia()) {
            $replacements += $exception->apiMessage->getHypermedia();
        }



        if ($this->runningInDebugMode()) {
            $replacements['debug'] = [
                'line'  => $exception->getLine(),
                'file'  => $exception->getFile(),
                'code'  => $exception->getCode(),
                'class' => \get_class($exception),
                'trace' => explode("\n", $exception->getTraceAsString()),
            ];
        }

        return array_merge($replacements, $this->replacements);
    }
1173800
public function expandProductListTransferWithProductListCompanyRelationTransfer(
        ProductListTransfer $productListTransfer
    ): ProductListTransfer {
        $productListTransfer = $this->getFactory()->createProductListTransferExpander()
            ->expandWithProductListCompanyRelationTransfer($productListTransfer);

        return $productListTransfer;
    }
396392
function copyAssets(output, plugin) {
    var logger = output.getLogger();
    var pluginRoot = plugin.getPath();
    var options = output.getOptions();

    var outputRoot = options.get('root');
    var assetOutputFolder = path.join(outputRoot, 'gitbook');
    var prefix = options.get('prefix');

    var assetFolder = path.join(pluginRoot, ASSET_FOLDER, prefix);

    if (!fs.existsSync(assetFolder)) {
        return Promise();
    }

    logger.debug.ln('copy assets from theme', assetFolder);
    return fs.copyDir(
        assetFolder,
        assetOutputFolder,
        {
            deleteFirst: false,
            overwrite: true,
            confirm: true
        }
    );
}
578350
public function getRequiredAssetsToOutput()
    {
        $required = $this->requiredAssetGroup->getAssetPointers();
        $assetPointers = array_filter($required, array('\Concrete\Core\Http\ResponseAssetGroup', 'filterProvidedAssets'));
        $assets = array();
        $al = AssetList::getInstance();
        foreach ($assetPointers as $ap) {
            $asset = $ap->getAsset();
            if ($asset instanceof Asset) {
                $assets[] = $asset;
            }
        }
        // also include any hard-passed $assets into the group. This is rare but it's used for handle-less
        // assets like layout css
        $assets = array_merge($this->requiredAssetGroup->getAssets(), $assets);

        return $assets;
    }
798500
public function findAssets () : array
    {
        $assets = [];

        foreach ($this->namespaces as $namespace => $dir)
        {
            if (!\is_dir($dir))
            {
                continue;
            }

            $finder = new Finder();

            $finder
                ->files()
                ->followLinks()
                ->in($dir);

            foreach ($finder as $foundFile)
            {
                $assets[] = new Asset($namespace, $foundFile->getRelativePathname());
            }
        }

        return $assets;
    }
643465
function copy()
    {
        $collection = clone $this;

        $db = eZDB::instance();
        $db->begin();
        $collection->store();

        $oldItems = $this->itemList();
        foreach ( $oldItems as $oldItem )
        {
            $item = $oldItem->copy( $collection->attribute( 'id' ) );
        }
        $db->commit();
        return $collection;
    }
354333
private function fillTransforms($transforms): array
    {
        $r = [];

        $attributeName = self::$transformConfig->fillAttribute;
        $interval = self::$transformConfig->fillInterval;

        $r[] = $transforms[0];

        for ($i = 1, $l = \count($transforms); $i < $l; $i++) {
            $prevTransform = $transforms[$i - 1];
            $currentTransform = $transforms[$i];

            if (isset($prevTransform[$attributeName], $currentTransform[$attributeName])) {
                if ($prevTransform[$attributeName] < $currentTransform[$attributeName]) {
                    for ($num = $prevTransform[$attributeName] + $interval, $maxNum = $currentTransform[$attributeName]; $num < $maxNum; $num += $interval) {
                        $transformCopy = $prevTransform;
                        $transformCopy[$attributeName] = $num;
                        $r[] = $transformCopy;
                    }
                } else {
                    for ($num = $prevTransform[$attributeName] - $interval, $minNum = $currentTransform[$attributeName]; $num > $minNum; $num -= $interval) {
                        $transformCopy = $prevTransform;
                        $transformCopy[$attributeName] = $num;
                        $r[] = $transformCopy;
                    }
                }
            }

            $r[] = $currentTransform;
        }

        return $r;
    }
594386
public function getReplacements(): array
    {
        $replacements = [
            'blank' => '',
            'class' => $this->getClassName(),
            'message' => $this->getValue(),
        ];

        $traceReplacements = $this->getTraceReplacements();

        return array_merge($replacements, $traceReplacements);
    }
1190571
public function expand(ProductListTransfer $productListTransfer): ProductListTransfer
    {
        foreach ($this->productListTransferExpanderPlugins as $productListTransferExpanderPlugin) {
            $productListTransfer = $productListTransferExpanderPlugin->expandTransfer($productListTransfer);
        }

        return $productListTransfer;
    }
296005
public function getAssets($type = null, $relativeTo = self::RELATIVE_PATH)
    {
        $cssFiles = $this->cssFiles;
        $jsFiles = $this->jsFiles;

        if ($this->includeVendors !== false) {
            if ($this->includeVendors === true || in_array('css', $this->includeVendors)) {
                $cssFiles = array_merge($this->cssVendors, $cssFiles);
            }
            if ($this->includeVendors === true || in_array('js', $this->includeVendors)) {
                $jsFiles = array_merge($this->jsVendors, $jsFiles);
            }
        }

        if ($relativeTo) {
            $root = $this->getRelativeRoot($relativeTo, $this->basePath, $this->baseUrl);
            $cssFiles = $this->makeUriRelativeTo($cssFiles, $root);
            $jsFiles = $this->makeUriRelativeTo($jsFiles, $root);
        }

        $additionalAssets = $this->additionalAssets;
        // finds assets provided by collectors
        foreach ($this->debugBar->getCollectors() as $collector) {
            if (($collector instanceof AssetProvider) && !in_array($collector->getName(), $this->ignoredCollectors)) {
                $additionalAssets[] = $collector->getAssets();
            }
        }

        foreach ($additionalAssets as $assets) {
            $basePath = isset($assets['base_path']) ? $assets['base_path'] : null;
            $baseUrl = isset($assets['base_url']) ? $assets['base_url'] : null;
            $root = $this->getRelativeRoot($relativeTo,
                $this->makeUriRelativeTo($basePath, $this->basePath),
                $this->makeUriRelativeTo($baseUrl, $this->baseUrl));
            $cssFiles = array_merge($cssFiles, $this->makeUriRelativeTo((array) $assets['css'], $root));
            $jsFiles = array_merge($jsFiles, $this->makeUriRelativeTo((array) $assets['js'], $root));
        }

        return $this->filterAssetArray(array($cssFiles, $jsFiles), $type);
    }
540984
public function getFlatListOfFiles()
	{
		if (!isset($this->flatData))
		{
			$this->flatData = [];

			foreach ($this as $entity)
			{
				if ($entity->isFile())
				{
					$this->flatData[] = $entity;
				}
				else
				{
					// The result of this is already flat, so no need for recursion
					foreach ($entity->listContents(true) as $sub)
					{
						if ($sub->isfile())
						{
							$this->flatData[] = $sub;
						}
					}
				}
			}
		}

		return $this->flatData;
	}