Creates container for storing export files.

@param string $resource Path to the file
@param string $key Configuration key prefix for the container type/format/options keys
@return \Aimeos\MW\Container\Iface Container item
186854
protected function createContainer( $resource, $key )
	{
		$config = $this->getContext()->getConfig();

		$type = $config->get( $key . '/type', 'Zip' );
		$format = $config->get( $key . '/format', 'CSV' );
		$options = $config->get( $key . '/options', [] );

		return \Aimeos\MW\Container\Factory::getContainer( $resource, $type, $format, $options );
	}
557505
public static function getMappings($resource, $key = 'default')
	{
		$resourceName = $resource;

		if( is_object($resource) )
		{
			$resourceName = get_class($resource);
		}

		$mappings = [];
		if( isset(self::$mappers[$key]) )
		{
			$mappings = array_merge_recursive( $mappings, call_user_func(self::$mappers[$key], $resourceName) );
		}

		if( isset(self::$mappings[$key]) && isset(self::$mappings[$key][$resourceName]) )
		{
			$mappings = array_merge_recursive( $mappings, (array) self::$mappings[$key][$resourceName] );
		}

		return $mappings;
	}
204376
public static function collection($resource)
    {
        return tap(new AnonymousResourceCollection($resource, static::class), function ($collection) {
            if (property_exists(static::class, 'preserveKeys')) {
                $collection->preserveKeys = (new static([]))->preserveKeys === true;
            }
        });
    }
441959
public static function get($key = null)
    {
        if ($key === null) {
            return self::self()->getContainer()['settings'];
        } else {
            return self::self()->getContainer()['settings'][$key];
        }
    }
897531
public function get( $key ) {

		if ( $this->has( $key ) ) {
			return $this->container[strtolower( $key )];
		}

		throw new InvalidArgumentException( "{$key} is unknown" );
	}
594052
private function saveKeyToFile($key)
    {
        $tmpDir = sys_get_temp_dir();
        $keyPath = $tmpDir . '/' . sha1($key) . '.key';

        if (file_exists($keyPath)) {
            return 'file://' . $keyPath;
        }

        if (!touch($keyPath)) {
            // @codeCoverageIgnoreStart
            throw new RuntimeException(sprintf('"%s" key file could not be created', $keyPath));
            // @codeCoverageIgnoreEnd
        }

        if (file_put_contents($keyPath, $key) === false) {
            // @codeCoverageIgnoreStart
            throw new RuntimeException(sprintf('Unable to write key file to temporary directory "%s"', $tmpDir));
            // @codeCoverageIgnoreEnd
        }

        if (chmod($keyPath, 0600) === false) {
            // @codeCoverageIgnoreStart
            throw new RuntimeException(sprintf('The key file "%s" file mode could not be changed with chmod to 600', $keyPath));
            // @codeCoverageIgnoreEnd
        }

        return 'file://' . $keyPath;
    }
755028
public function create(string $key) : string
    {
        $headers = [
            'Upload-Length' => $this->fileSize,
            'Upload-Key' => $key,
            'Upload-Checksum' => $this->getUploadChecksumHeader(),
            'Upload-Metadata' => 'filename ' . base64_encode($this->fileName),
        ];

        if ($this->isPartial()) {
            $headers += ['Upload-Concat' => 'partial'];
        }

        $response = $this->getClient()->post($this->apiPath, [
            'headers' => $headers,
        ]);

        $statusCode = $response->getStatusCode();

        if (HttpResponse::HTTP_CREATED !== $statusCode) {
            throw new FileException('Unable to create resource.');
        }

        $uploadLocation = current($response->getHeader('location'));

        $this->getCache()->set($this->getKey(), [
            'location' => $uploadLocation,
            'expires_at' => Carbon::now()->addSeconds($this->getCache()->getTtl())->format($this->getCache()::RFC_7231),
        ]);

        return $uploadLocation;
    }
153831
protected function createParsedResource($resource): ResourceInterface
    {
        \assert(
            $this->schemaContainer->hasSchema($resource),
            'No Schema found for resource `' . \get_class($resource) . '`.'
        );

        return $this->factory->createParsedResource(
            $this->position,
            $this->schemaContainer,
            $resource
        );
    }
244144
public final function makeReleaseFile(AbstractResourceFile $resource) {
        if (!isset($this->__release__file__map[$resource->getMemberId()])) {
            $this->__release__file__map[$resource->getMemberId()] = new File($this->makeReleaseRelativePath($resource), $this->getReleaseDir()->getAbsolutePath());
        }
        return $this->__release__file__map[$resource->getMemberId()];
    }
90776
protected function export( \Aimeos\MW\Container\Iface $container, $default = true )
	{
		$domains = array( 'attribute', 'media', 'price', 'product', 'text' );

		$domains = $this->getConfig( 'domains', $domains );
		$maxItems = $this->getConfig( 'max-items', 10000 );
		$maxQuery = $this->getConfig( 'max-query', 1000 );

		$start = 0; $filenum = 1;
		$names = [];

		$manager = \Aimeos\MShop::create( $this->getContext(), 'product' );

		$search = $manager->createSearch( $default );
		$search->setSortations( array( $search->sort( '+', 'product.id' ) ) );
		$search->setSlice( 0, $maxQuery );

		$content = $this->createContent( $container, $filenum );
		$names[] = $content->getResource();

		do
		{
			$items = $manager->searchItems( $search, $domains );
			$free = $maxItems * $filenum - $start;
			$count = count( $items );

			if( $free < $count )
			{
				$this->addItems( $content, array_slice( $items, 0, $free, true ) );
				$items = array_slice( $items, $free, null, true );

				$this->closeContent( $content );
				$content = $this->createContent( $container, ++$filenum );
				$names[] = $content->getResource();
			}

			$this->addItems( $content, $items );

			$start += $count;
			$search->setSlice( $start, $maxQuery );
		}
		while( $count >= $search->getSliceSize() );

		$this->closeContent( $content );

		return $names;
	}
1014523
public function get($key)
    {
        if (array_key_exists($key, $this->container)) {
            return $this->container[$key];
        }

        return null;
    }
1361145
public function getDataItemStreamWrapper(string $key): \BearFramework\App\IDataItemStreamWrapper
    {
        return new \BearFramework\App\FileDataItemStreamWrapper($key, $this->dir);
    }
1071026
public function make($key)
    {
        switch ($key) {
            case 'config': return $this->config;
            case 'em': return $this->entityManager;
            case 'extension': return $this->extensionManager;
            case 'migration': return $this->migrationManager;
            case 'log': return $this->logger;
            case 'file': return $this->files;
            default: return $this;
        }
    }
968198
public function appendResource($resource) {
		$resource = $this->handleResource($resource);
		
		$this->resources[] = $resource;
		return $resource;
	}
1283478
public static function fileConfig($resource)
    {
        self::$config = new Config($resource, new ConfigLoader());
        self::$config->load();
        self::$config->configure();
    }
90602
protected function createCacheItem(/*# string */ $key)/*# : CacheItemExtendedInterface */
    {
        if (is_callable($this->item_factory)) {
            $func = $this->item_factory;
            $item = $func($key, $this);
        } else {
            $item = new CacheItem($key, $this);
        }

        return $item;
    }
1194619
public static function get($key, $child = null, $forceNew = false)
    {
        $container = static::getContainer($child);

        return $container->get($key, $forceNew);
    }