@param string $container
@param string $name
@param string $localFileName
@param string $type

@throws DfException
@throws \Exception
976475
public function putBlobFromFile($container = '', $name = '', $localFileName = null, $type = '')
    {
        $this->checkConnection();
        try {
            /** @var Container $container */
            $container = $this->blobConn->getContainer($container);
            if (empty($container)) {
                throw new \Exception("No container named '$container'");
            }

            $params = ['name' => $name];
            if (!empty($type)) {
                $params['content_type'] = $type;
            }

            $container->uploadObject($name, file_get_contents($localFileName), $params);
        } catch (\Exception $ex) {
            static::handleGuzzleException($ex);
            throw new DfException("Failed to create blob '$name': " . $ex->getMessage());
        }
    }
43938
public function executePostActions(DataContainerInterface $container)
    {
        \header('Content-Type: text/html; charset=' . $GLOBALS['TL_CONFIG']['characterSet']);

        $this->objDc = $container;

        $action = $this->getEnvironment()->getInputProvider()->getValue('action');

        if (\in_array(
            $action,
            [
                // This is impossible to handle generically in DcGeneral.
                'toggleFeatured',
                // DcGeneral handles sub palettes differently.
                'toggleSubpalette'
            ]
        )) {
            return;
        }

        if (\in_array(
            $action,
            [
                // Load nodes of the page structure tree. Compatible between 2.X and 3.X.
                'loadStructure',
                // Load nodes of the file manager tree.
                'loadFileManager',
                // Load nodes of the page tree.
                'loadPagetree',
                // Load nodes of the file tree.
                'loadFiletree',
                // Reload the page/file picker.
                'reloadPagetree',
                'reloadFiletree',
                'setLegendState'
            ]
        )) {
            $this->{$action}();
            return;
        }

        $ajax = new ContaoAjax($action);
        $ajax->executePreActions();
        $ajax->executePostActions(new DcCompat($this->getEnvironment(), $this->getActiveModel()));
    }
763691
private function buildElement(string $type, string $name): ElementInterface
    {
        if (class_exists($type)) {
            $element = new $type($name);

            if (! $element instanceof ElementInterface) {
                throw new InvalidClassException(
                    sprintf(
                        'The given type "%s" does not implement %s.',
                        $type,
                        ElementInterface::class
                    )
                );
            }

            return $element;
        }

        if (isset($this->typeToElement[$type])) {
            return new $this->typeToElement[$type]($name);
        }

        throw new UnknownTypeException(
            sprintf(
                'The given type "%s" will not create a valid class which implements "%s"',
                $type,
                ElementInterface::class
            )
        );
    }
114020
private static void defineField(Map<String, FieldType> container, String name, FieldType type)
   {
      defineField(container, name, type, null);
   }
612299
public function process(\Symfony\Component\DependencyInjection\ContainerBuilder $container)
    {
        if (!$container->hasDefinition("thelia.admin.resources")) {
            return;
        }

        /** @var \Symfony\Component\DependencyInjection\Definition $adminResources */
        $adminResources = $container->getDefinition("thelia.admin.resources");

        $adminResources->addMethodCall("addModuleResources", [$this->getResources(), $this->getModuleCode()]);
    }
1205740
public function putBlobFromFile($container, $name, $localFileName = '', $type = '')
    {
        $blob = file_get_contents($localFileName);
        if (false === $blob) {
            throw new InternalServerErrorException("Failed to get contents of uploaded file.");
        }

        $this->putBlobData($container, $name, $blob, $type);
    }
39844
public function addResource($resource, string $type = 'file'): void
    {
        if (is_array($resource)) {
            $this->addResourceArray($resource);
            return;
        }

        if (is_string($resource)) {
            switch ($type) {
                case 'json':
                    $this->addResourceString($resource);
                    break;
                case 'file':
                    $this->addResourceFile($resource);
                    break;
                default:
                    throw new \InvalidArgumentException("Invalid resource type");
            }
        }
    }
390896
public function moveFile($container, $path, $local_path, $check_exist = true)
    {
        // does local file exist?
        if (!file_exists($local_path)) {
            throw new NotFoundException("File '$local_path' does not exist.");
        }
        // does this file already exist?
        if ($this->fileExists($container, $path)) {
            if (($check_exist)) {
                throw new BadRequestException("File '$path' already exists.");
            }
        }
        // does this file's parent folder exist?
        $parent = FileUtilities::getParentFolder($path);
        if (!empty($parent) && (!$this->folderExists($container, $parent))) {
            throw new NotFoundException("Folder '$parent' does not exist.");
        }

        // create the file
        $this->checkContainerForWrite($container); // need to be able to write to storage
        $file = static::addContainerToName($container, $path);
        if (!rename($local_path, $file)) {
            throw new InternalServerErrorException("Failed to move file '$path'");
        }
    }
924357
private function callCommandFile($type, $name = null, $stub = null, $options = [])
    {
        $this->call('generate:file', array_merge($options, [
            'name'    => ($name ? $name : $this->argument('resource')),
            '--type'  => $type,
            '--force' => $this->optionForce(),
            '--plain' => $this->optionPlain(),
            '--stub'  => ($stub ? $stub : $this->optionStub()),
        ]));
    }
493025
protected function write($name, $type, $controller) : Bool
    {
        if( ! empty($name) )
        {
            if( ! empty($this->settings['path']) )
            {
                $filePath = Base::suffix($this->settings['path'], '/') . $name;
            }
            else
            {
                $filePath = $name;
            }
    
            $file = $this->path($filePath, $type);
    
            if( ! is_file($file) )
            {
                if( file_put_contents($file, $controller) )
                {
                    return true;
                }
            }
        }
        
        return false;
    }
1067578
protected function validateContainerName($name)
    {
        if (empty($name)
            || (false !== strpos($name, '/'))
            || strlen($name) > CONTAINER_NAME_LIMIT) {
            throw new Exceptions\InvalidContainerName();
        }
    }
325088
public function containerExists($container = '')
    {
        $this->checkConnection();

        try {
            /** @var Container $container */
            $container = $this->blobConn->getContainer($container);

            return !empty($container);
        } catch (\Exception $ex) {
            if ($ex instanceof ClientErrorResponseException) {
                if ($ex->getCode() === 404 || str_contains($ex->getMessage(), '404')) {
                    return false;
                }
            }
            static::handleGuzzleException($ex);
            throw new DfException('Failed to list containers: ' . $ex->getMessage());
        }
    }
177769
public function createContainer($properties, $metadata = [])
    {
        $this->checkConnection();

        $name = array_get($properties, 'name', array_get($properties, 'path'));
        if (empty($name)) {
            throw new DfException('No name found for container in create request.');
        }
        $options = new CreateContainerOptions();
        $options->setMetadata($metadata);
//		$options->setPublicAccess('blob');

        $this->blobConn->createContainer($name, $options);

        return ['name' => $name, 'path' => $name];
    }
882385
public function deleteContainers($containers, $force = false)
    {
        if (!empty($containers)) {
            if (!isset($containers[0])) {
                // single folder, make into array
                $containers = [$containers];
            }
            foreach ($containers as $key => $folder) {
                try {
                    // path is full path, name is relative to root, take either
                    $name = array_get($folder, 'name', trim(array_get($folder, 'path'), '/'));
                    if (!empty($name)) {
                        $this->deleteContainer($name, $force);
                    } else {
                        throw new DfException('No name found for container in delete request.');
                    }
                } catch (\Exception $ex) {
                    // error whole batch here?
                    $containers[$key]['error'] = ['message' => $ex->getMessage(), 'code' => $ex->getCode()];
                }
            }
        }

        return $containers;
    }
1076970
public function build(ContainerInterface $container, BuildDataDefinitionEvent $event)
    {
        if (!$this->loadDca($container->getName(), $this->getDispatcher())) {
            return;
        }

        $this->parseCallbacks($container, $this->getDispatcher());
        $this->parseBasicDefinition($container);
        $this->parseDataProvider($container);
        $this->parseRootEntries($container);
        $this->parseParentChildConditions($container);
        $this->parseBackendView($container);
        $this->parsePalettes($container);
        $this->parseProperties($container);
        $this->parseOderPropertyInPalette($container);
    }
1272421
public function blobExists($container = '', $name = '')
    {
        $this->checkConnection();
        try {
            /** @var Container $container */
            $container = $this->blobConn->getContainer($container);
            if (empty($container)) {
                throw new \Exception("No container named '$container'");
            }

            $obj = $container->DataObject($name);

            return !empty($obj);
        } catch (\Exception $ex) {
        }

        return false;
    }
271549
protected function image($type, $thumb, $name, $func = null)
    {
        $func = strtolower(__FUNCTION__.$type);
        $rootPath = $this->rootDir.DS.str_replace(['/', '\\'], DS, $this->thumbPath).$name;
        /** @var $func TYPE_NAME */
        //if (is_callable($func)) {
        if (!$func($thumb, $rootPath)) {
            throw new \Exception('Unknown Exception while generating thumb image');
        }

        chmod($rootPath, 0777);
    }