Salva o arquivo no storage

@param string $name     Name Original
@param string $source   Source File
@param string $folder   Remote Folder
@param bool   $override Override?

@return array [name,path,url]|false
426099
public function save($name, $source, $folder, $override = false)
    {
        $return = false;

        try {
            if (!$this->storage->exists($folder)) {
                $this->storage->createFolder($folder);
            }

            $path = $this->setFilename($name, $folder, $override);
            
            $this->storage->upload($source, $path, $override);

            $return = array(
                'name' => $name,
                'path' => $path,
                'url'  => $this->storage->getUrl($path),
            );
            $this->error = null;

        } catch(Exception $e) {
            $this->error = $e;
            $return = false;
        }
        return $return;
    }
438658
public function fileExists($name, $dir = null)
    {
//        $this->dump($name . ':' . $dir);
        $reflection = new \ReflectionClass(get_class($this));
        if(($themeBundle = $this->getParam("themeBundle", 'eDemyMainBundle', "eDemyThemeBundle")) !== 'themeBundle') {
            $dir = $this->getBundlePath($themeBundle, true) . '/Resources/views/' . $dir;
        }
        // Si se está ejecutando desde la caché
        if(strpos($reflection->getFileName(), '/cache/')) {
            // subimos hasta el directorio raíz de la aplicación (3 niveles)
            $basedir = dirname($reflection->getFileName()) . '/../../..';
        } else {
            // si no subimos 6 niveles hasta el directorio raíz de la aplicación
            $basedir = dirname($reflection->getFileName()) . '/../../../../../..';
        }
        $fs = new Filesystem();
        //die(var_dump($basedir . $dir . $name));
        //if($fs->exists($basedir . $dir . $name)) {
        if($fs->exists($dir . $name)) {

            return true;
        }

        return false;
    }
1178136
public static function getFile($tmp = true, $name = null)
    {
        return ($tmp ? realpath(sys_get_temp_dir()) : '').'/'.(null === $name ? uniqid() : $name);
    }
587168
public function load( string $name, bool $returnStorage = false )
	{
		$path = $this->cacheDir . DIRECTORY_SEPARATOR . $name;
		$res  = @fopen($path, 'r');

		if ($res == false)
			return false;

		/** @var FileCacheStorage $storage */
		$storage = @unserialize(fread($res, filesize($path)));

		fclose($res);
		if ($returnStorage)
			return $storage;

		return $storage->data;
	}
319523
public function create(bool $override): bool {
        if ($this->isFile() && !$override) return false;
        $handle = @fopen($this->path, 'w');
        if (false === $handle) return false;
        fclose($handle);
        return true;
    }
1123889
protected function rmdir($name = '')
    {
        $result = true;
        $name = preg_replace(array('!\.{1,2}/!', '!^/!', '!/$!'), '', $name);
        $name = $this->dirData.$name;
        if (is_dir($name))
        {
            $files = glob($name.'/{.*,*}', GLOB_BRACE);
            for ($i = 0; $i < count($files); $i++)
            {
                if (substr($files[$i], -2) == '/.' || substr($files[$i], -3) == '/..') continue;
                if (is_dir($files[$i])) $result = $this->rmdir(substr($files[$i], strlen($this->dirData)));
                elseif (is_file($files[$i])) $result = filedelete($files[$i]);
                if (!$result) break;
            }
            if ($result) $result = rmdir($name);
        }
        return $result;
    }
307876
function createSubNode( $node, $name )
    {
        $namedChildrenArray = $node->childrenByName( $name );
        $subNode = false;

        //pk
        if ( !$node->canCreate() )
        {
            $this->setError( self::ERROR_ACCESSDENIED, ezpI18n::tr( 'extension/ezodf/import/error', "Folder for images could not be created, access denied." ) );
            return false;
        }

        if ( empty( $namedChildrenArray ) )
        {
            $class = eZContentClass::fetchByIdentifier( "folder" );
            {
                $creatorID = $this->currentUserID;
                //$creatorID = 14; // 14 == admin
                $parentNodeID = $placeNodeID;
                $contentObject = $class->instantiate( $creatorID, 1 );

                $nodeAssignment = eZNodeAssignment::create( array(
                                                                 'contentobject_id' => $contentObject->attribute( 'id' ),
                                                                 'contentobject_version' => $contentObject->attribute( 'current_version' ),
                                                                 'parent_node' => $node->attribute( 'node_id' ),
                                                                 'is_main' => 1
                                                                 )
                                                             );
                $nodeAssignment->store();

                $version = $contentObject->version( 1 );
                $version->setAttribute( 'modified', eZDateTime::currentTimeStamp() );
                $version->setAttribute( 'status', eZContentObjectVersion::STATUS_DRAFT );
                $version->store();

                $contentObjectID = $contentObject->attribute( 'id' );
                $dataMap = $contentObject->dataMap();

                $titleAttribudeIdentifier = 'name';

                $dataMap[$titleAttribudeIdentifier]->setAttribute( 'data_text', $name );
                $dataMap[$titleAttribudeIdentifier]->store();

                $operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObjectID,
                                                                                             'version' => 1 ) );

                $subNode = $contentObject->mainNode();
            }
        }
        else
        {
            if ( count( $namedChildrenArray ) == 1 )
            {
                $subNode = $namedChildrenArray[0];
            }
        }

        return $subNode;
    }
826200
public static function GetDetail ($name, $extension = null, $forced_obtain = false) {
		static $detail_list;

		$extension_name = $extension ?: 0;
		if (!isset($detail_list[$extension_name]) || $forced_obtain) {
			$detail_list[$extension_name] = ini_get_all($extension, true);
		}

		$detail = $detail_list[$extension_name];
		$detail = isset($detail[$name]) ? $detail[$name] : null;

		if ($detail === null){
			if ($extension) {
				throw CoreException::RaiseSystemError('未定義の設定名を渡されました。name:%s, extension:%s', [$name, $extension]);
			} else {
				throw CoreException::RaiseSystemError('未定義の設定名を渡されました。name:%s', [$name]);
			}
		}

		return $detail;
	}
404696
public function image($url, $target, $override = false)
    {
        if (!$this->download($url, $target, $override)) {
            return false;
        }

        // check file type
        $fi = new \finfo(FILEINFO_MIME_TYPE);
        if (strpos($fi->file($target), 'image/') !== 0) {
            unlink($target); // remove dangerous file
            return false;
        }

        return true;
    }
704068
public function build($name, $overrides = [])
    {
        $attributes = $this->getAttributes($name, $overrides);
        $class = $this->getFixture($name)->name;

        // We'll pass off the process of creating the entity.
        // That way, folks can use different persistence layers.

        return $this->model->build($class, $attributes);
    }
859197
protected function _mkdir($path, $name) {
		
		$newkey = $this->_normpath($path);
		$newkey = preg_replace("/\/$/", "", $newkey);
		$newkey = "$newkey/$name/";

		try {
			$obj = $this->s3->PutObjectInline(array('Bucket' => $this->options['bucket'], 'Key' => $newkey , 'ContentLength' => 0, 'Data' => ''));
		} catch (Exception $e) {
		
		}
		
		if (isset($obj)) {
			return "$path/$name";
		}
		
		return false;
	}
1184422
public function createFolder(string $parentId, string $name, string $description = '', bool $overwrite = false):array
    {
        $parameters = $this->buildHttpQuery(
            [
                'overwrite'   => $overwrite,
                'passthrough' => false,
            ]
        );

        $data = [
            'name'        => $name,
            'description' => $description,
        ];

        return $this->post("Items({$parentId})/Folder?{$parameters}", $data);
    }
586793
public function load($url, $override = false)
    {
        $loaded = array();

        if (!$this->isLoaded($url))
        {
            $current  = $this->getLocale();
            $fallback = $this->getLocaleFallback();

            foreach($this->find($url) as $extension => $base)
            {
                $locales   = array($current);

                if ($current !== $fallback) {
                    array_unshift($locales, $fallback);
                }

                foreach ($locales as $locale)
                {
                    if (!JFactory::getLanguage()->load($extension, $base, $locale, true, false))
                    {
                        $file = glob(sprintf('%s/language/%s.*', $base, $locale));

                        if ($file) {
                            $loaded[] = ComKoowaTranslatorLanguage::loadFile(current($file), $extension, $this);
                        }
                    }
                    else $loaded[] = true;
                }
            }

            $this->setLoaded($url);
        }

        return in_array(true, $loaded);
    }
1043606
public function mkDir($name, $recursive = null, $chmod = null)
    {
        // test the recursive mode with default value
        $recursive = ($recursive === null) ? $this->recursiveDirectories : $recursive;
        // test the chmod with default value
        $chmod = ($chmod === null) ? $this->defCHMOD : $chmod;
        if (!is_dir($name)) {
            return (mkdir($name)) ? true : false;
        }

        return false;
    }
311792
public static function putContents(string $filename, $data, bool $override = false)
    {
        $dirname = dirname($filename);
        if (!file_exists($dirname)) {
            mkdir($dirname, 0700, true);
        }
        if (!file_exists($filename) || $override) {
            $result = file_put_contents($filename, $data);
        } else {
            throw new \Exception("{$filename} is already exists");
        }
        return $result;
    }
1374077
public function load($url, $override = false)
    {
        if (!$this->isLoaded($url))
        {
            $translations = array();

            foreach ($this->find($url) as $file)
            {
                try {
                    $loaded = $this->getObject('object.config.factory')->fromFile($file)->toArray();
                } catch (Exception $e) {
                    return false;
                }

                $translations = array_merge($translations, $loaded);
            }

            $this->getCatalogue()->add($translations, $override);

            $this->setLoaded($url);
        }

        return true;
    }
845393
public function resolveFile($name)
    {
        $components = $this->parseResource($name);
        foreach ($components['dirs'] as $dir) {
            if (is_file($file = $dir . ($dir ? '/' : '') .  $components['file'])) {
                return $file;
            }
        }
        return false;
    }