Fix cs
modifié: core/lib/Thelia/Core/FileFormat/Archive/AbstractArchiveBuilder.php modifié: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/Exception/TarArchiveException.php modifié: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/Exception/ZipArchiveException.php modifié: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilder.php modifié: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarBz2ArchiveBuilder.php modifié: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/TarGzArchiveBuilder.php modifié: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilder/ZipArchiveBuilder.php modifié: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilderInterface.php modifié: core/lib/Thelia/Core/FileFormat/Archive/ArchiveBuilderManager.php modifié: core/lib/Thelia/Core/FileFormat/FormatInterface.php modifié: core/lib/Thelia/Core/FileFormat/Formatter/AbstractFormatter.php modifié: core/lib/Thelia/Core/FileFormat/Formatter/Exception/BadFormattedStringException.php nouveau fichier: core/lib/Thelia/Core/FileFormat/Formatter/FormatterData.php nouveau fichier: core/lib/Thelia/Core/FileFormat/Formatter/FormatterInterface.php modifié: core/lib/Thelia/Core/FileFormat/Formatter/FormatterManager.php modifié: core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarArchiveBuilderTest.php modifié: core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarBz2ArchiveBuilderTest.php modifié: core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/TarGzArchiveBuilderTest.php modifié: core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilder/ZipArchiveBuilderTest.php modifié: core/lib/Thelia/Tests/FileFormat/Archive/ArchiveBuilderManagerTest.php modifié: core/lib/Thelia/Tests/FileFormat/Formatter/FormatterManagerTest.php modifié: core/lib/Thelia/Tests/Tools/FakeFileDownloader.php modifié: core/lib/Thelia/Tests/Tools/FileDownloaderTest.php
This commit is contained in:
@@ -258,8 +258,12 @@ abstract class AbstractArchiveBuilder implements FormatInterface, ArchiveBuilder
|
||||
=======
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* @param string $environment
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
=======
|
||||
* @param string $environment
|
||||
>>>>>>> Fix cs
|
||||
* @return $this
|
||||
*
|
||||
* Sets the execution environment of the Kernel,
|
||||
@@ -270,6 +274,7 @@ abstract class AbstractArchiveBuilder implements FormatInterface, ArchiveBuilder
|
||||
$this->environment = $environment;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
@@ -283,3 +288,6 @@ abstract class AbstractArchiveBuilder implements FormatInterface, ArchiveBuilder
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -20,8 +20,12 @@ namespace Thelia\Core\FileFormat\Archive\ArchiveBuilder\Exception;
|
||||
class TarArchiveException extends \Exception
|
||||
{
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -109,6 +109,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
* @param string $directoryInArchive This is the directory where it will be stored in the archive
|
||||
* @param null|string $name The name of the file in the archive. if it null or empty, it keeps the same name
|
||||
* @param bool $isOnline
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
}*/
|
||||
=======
|
||||
@@ -121,6 +122,8 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
* @param null|string $name The name of the file in the archive. if it null or empty, it keeps the same name
|
||||
* @param bool $isOnline
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
>>>>>>> Fix cs
|
||||
* @return $this
|
||||
* @throws \Thelia\Exception\FileNotFoundException
|
||||
* @throws \Thelia\Exception\FileNotReadableException
|
||||
@@ -184,11 +187,15 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
/**
|
||||
* @param $content
|
||||
* @param $name
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $directoryInArchive
|
||||
=======
|
||||
* @param string $directoryInArchive
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
* @param string $directoryInArchive
|
||||
>>>>>>> Fix cs
|
||||
* @return mixed
|
||||
* @throws \ErrorException
|
||||
*
|
||||
@@ -213,11 +220,15 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
try {
|
||||
$this->tar->addFromString($name, $content);
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
} catch (\Exception $e) {
|
||||
=======
|
||||
} catch(\Exception $e) {
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
} catch (\Exception $e) {
|
||||
>>>>>>> Fix cs
|
||||
throw new \ErrorException(
|
||||
$this->translator->trans(
|
||||
"Error while writing the file into the archive, error message: %errmes",
|
||||
@@ -229,10 +240,13 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
>>>>>>> Fix cs
|
||||
/**
|
||||
* @param $directoryPath
|
||||
* @return $this
|
||||
@@ -248,11 +262,15 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
|
||||
try {
|
||||
$this->tar->addEmptyDir($directoryInArchive);
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
} catch (\Exception $e) {
|
||||
=======
|
||||
} catch(\Exception $e) {
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
} catch (\Exception $e) {
|
||||
>>>>>>> Fix cs
|
||||
throw new \ErrorException(
|
||||
$this->translator->trans(
|
||||
"The directory %dir has not been created in the archive",
|
||||
@@ -268,11 +286,15 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $pathToFile
|
||||
=======
|
||||
* @param string $pathToFile
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
* @param string $pathToFile
|
||||
>>>>>>> Fix cs
|
||||
* @return null|string
|
||||
* @throws \Thelia\Exception\FileNotFoundException
|
||||
* @throws \Thelia\Exception\FileNotReadableException
|
||||
@@ -315,6 +337,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
return $content;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
=======
|
||||
@@ -324,6 +347,8 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
|
||||
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
>>>>>>> Fix cs
|
||||
/**
|
||||
* @param $pathInArchive
|
||||
* @return $this
|
||||
@@ -424,11 +449,18 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* @param string $pathToArchive
|
||||
* @param string $environment
|
||||
* @param bool $isOnline
|
||||
* @param FileDownloaderInterface $fileDownloader
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
* @param string $pathToArchive
|
||||
* @param string $environment
|
||||
* @param bool $isOnline
|
||||
* @param FileDownloaderInterface $fileDownloader
|
||||
>>>>>>> Fix cs
|
||||
* @return $this
|
||||
* @throws \Thelia\Exception\FileNotFoundException
|
||||
* @throws \Thelia\Exception\HttpUrlException
|
||||
@@ -483,6 +515,9 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> Fix cs
|
||||
|
||||
return $tar->setEnvironment($tar->environment);
|
||||
=======
|
||||
@@ -512,31 +547,43 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
/** @var \PharFileInfo $fileInfo */
|
||||
$fileInfo = $this->tar[$pathToFile];
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
if ($fileInfo->isFile()) {
|
||||
=======
|
||||
if($fileInfo->isFile()) {
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
if ($fileInfo->isFile()) {
|
||||
>>>>>>> Fix cs
|
||||
$isFile = true;
|
||||
}
|
||||
/**
|
||||
* Catch the exception to avoid its displaying.
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
} catch (\BadMethodCallException $e) {}
|
||||
=======
|
||||
} catch(\BadMethodCallException $e) {}
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
} catch (\BadMethodCallException $e) {}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
return $isFile;
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $directory
|
||||
=======
|
||||
* @param string $directory
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
* @param string $directory
|
||||
>>>>>>> Fix cs
|
||||
* @return bool
|
||||
*
|
||||
* Check if the archive has a directory
|
||||
@@ -550,31 +597,43 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
/** @var \PharFileInfo $fileInfo */
|
||||
$fileInfo = $this->tar[$pathToDir];
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
if ($fileInfo->isDir()) {
|
||||
=======
|
||||
if($fileInfo->isDir()) {
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
if ($fileInfo->isDir()) {
|
||||
>>>>>>> Fix cs
|
||||
$isDir = true;
|
||||
}
|
||||
/**
|
||||
* Catch the exception to avoid its displaying.
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
} catch (\BadMethodCallException $e) {}
|
||||
=======
|
||||
} catch(\BadMethodCallException $e) {}
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
} catch (\BadMethodCallException $e) {}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
return $isDir;
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $environment
|
||||
=======
|
||||
* @param string $environment
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
* @param string $environment
|
||||
>>>>>>> Fix cs
|
||||
* @return $this
|
||||
*
|
||||
* Sets the execution environment of the Kernel,
|
||||
@@ -619,6 +678,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
$this->compressionEntryPoint();
|
||||
|
||||
} catch (\BadMethodCallException $e) {
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
switch ($this->compression) {
|
||||
case "gz":
|
||||
@@ -637,15 +697,21 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
|
||||
} catch(\BadMethodCallException $e) {
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
>>>>>>> Fix cs
|
||||
/**
|
||||
* This should not happen
|
||||
*/
|
||||
$errorMessage = "You have badly called the method setEnvironment twice for %file";
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
=======
|
||||
} catch(\UnexpectedValueException $e) {
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
>>>>>>> Fix cs
|
||||
$errorMessage = "The file %file is corrupted";
|
||||
}
|
||||
|
||||
@@ -674,11 +740,15 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $initialString
|
||||
=======
|
||||
* @param string $initialString
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
* @param string $initialString
|
||||
>>>>>>> Fix cs
|
||||
* @return string
|
||||
*
|
||||
* Gives a valid file path for \ZipArchive
|
||||
@@ -699,11 +769,15 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $initialString
|
||||
=======
|
||||
* @param string $initialString
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
* @param string $initialString
|
||||
>>>>>>> Fix cs
|
||||
* @return string
|
||||
*
|
||||
* Gives a valid directory path for \ZipArchive
|
||||
@@ -811,5 +885,9 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
{
|
||||
return $this->compression;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -45,7 +45,11 @@ class TarBz2ArchiveBuilder extends TarArchiveBuilder
|
||||
return $this;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -49,8 +49,12 @@ class TarGzArchiveBuilder extends TarArchiveBuilder
|
||||
return $this;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -94,11 +94,15 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
* On the destruction of the class,
|
||||
* remove the temporary file.
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
public function __destruct()
|
||||
=======
|
||||
function __destruct()
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
public function __destruct()
|
||||
>>>>>>> Fix cs
|
||||
{
|
||||
if ($this->zip instanceof \ZipArchive) {
|
||||
@$this->zip->close();
|
||||
@@ -126,10 +130,14 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> Fix cs
|
||||
* @param string $filePath It is the path to access the file.
|
||||
* @param string $directoryInArchive This is the directory where it will be stored in the archive
|
||||
* @param null|string $name The name of the file in the archive. if it null or empty, it keeps the same name
|
||||
* @param bool $isOnline
|
||||
<<<<<<< HEAD
|
||||
* @return $this
|
||||
* @throws \Thelia\Exception\FileNotFoundException
|
||||
* @throws \Thelia\Exception\FileNotReadableException
|
||||
@@ -139,6 +147,8 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
* @param string $directoryInArchive This is the directory where it will be stored in the archive
|
||||
* @param null|string $name The name of the file in the archive. if it null or empty, it keeps the same name
|
||||
* @param bool $isOnline
|
||||
=======
|
||||
>>>>>>> Fix cs
|
||||
* @return $this
|
||||
* @throws \Thelia\Exception\FileNotFoundException
|
||||
* @throws \Thelia\Exception\FileNotReadableException
|
||||
@@ -163,6 +173,7 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
*/
|
||||
|
||||
if (!empty($directoryInArchive)) {
|
||||
<<<<<<< HEAD
|
||||
$this->addDirectory($directoryInArchive);
|
||||
}
|
||||
|
||||
@@ -270,6 +281,8 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
*/
|
||||
|
||||
if(!empty($directoryInArchive)) {
|
||||
=======
|
||||
>>>>>>> Fix cs
|
||||
$this->addDirectory($directoryInArchive);
|
||||
}
|
||||
|
||||
@@ -560,6 +573,7 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
if (preg_match("#\/?[^\/]+\/[^\/]+\/?#", $initialString)) {
|
||||
$initialString = "/" . $initialString;
|
||||
}
|
||||
|
||||
return $initialString;
|
||||
}
|
||||
|
||||
@@ -717,6 +731,7 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $pathToArchive
|
||||
* @param bool $isOnline
|
||||
@@ -730,6 +745,11 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
* @return $this
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
=======
|
||||
* @param string $pathToArchive
|
||||
* @param bool $isOnline
|
||||
* @param FileDownloaderInterface $fileDownloader
|
||||
>>>>>>> Fix cs
|
||||
* @return ZipArchiveBuilder
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
* @throws \Thelia\Exception\FileNotFoundException
|
||||
@@ -828,11 +848,15 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $directory
|
||||
=======
|
||||
* @param string $directory
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
* @param string $directory
|
||||
>>>>>>> Fix cs
|
||||
* @return bool
|
||||
*
|
||||
* Checks if the link $directory exists and if it's not a file.
|
||||
@@ -853,11 +877,15 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $environment
|
||||
=======
|
||||
* @param string $environment
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
* @param string $environment
|
||||
>>>>>>> Fix cs
|
||||
* @return $this
|
||||
*
|
||||
* Sets the execution environment of the Kernel,
|
||||
@@ -927,6 +955,7 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
\ZipArchive::CREATE
|
||||
);
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
if ($opening !== true) {
|
||||
throw new \ErrorException(
|
||||
@@ -934,6 +963,9 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
"An unknown error append"
|
||||
=======
|
||||
if($opening !== true) {
|
||||
=======
|
||||
if ($opening !== true) {
|
||||
>>>>>>> Fix cs
|
||||
throw new \ErrorException(
|
||||
$this->translator->trans(
|
||||
<<<<<<< HEAD
|
||||
@@ -1052,11 +1084,15 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $initialString
|
||||
=======
|
||||
* @param string $initialString
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
* @param string $initialString
|
||||
>>>>>>> Fix cs
|
||||
* @return string
|
||||
*
|
||||
* Gives a valid file path for \ZipArchive
|
||||
@@ -1085,18 +1121,26 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
$initialString = "/" . $initialString;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
|
||||
>>>>>>> Fix cs
|
||||
return $initialString;
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $initialString
|
||||
=======
|
||||
* @param string $initialString
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
* @param string $initialString
|
||||
>>>>>>> Fix cs
|
||||
* @return string
|
||||
*
|
||||
* Gives a valid directory path for \ZipArchive
|
||||
@@ -1219,6 +1263,7 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
|
||||
@@ -1240,3 +1285,6 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
namespace Thelia\Core\FileFormat\Archive;
|
||||
|
||||
|
||||
/**
|
||||
* Interface ArchiveBuilderInterface
|
||||
* @package Thelia\Core\FileFormat\Archive
|
||||
@@ -32,10 +31,14 @@ interface ArchiveBuilderInterface
|
||||
{
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> Fix cs
|
||||
* @param string $filePath It is the path to access the file.
|
||||
* @param string $directoryInArchive This is the directory where it will be stored in the archive
|
||||
* @param null|string $name The name of the file in the archive. if it null or empty, it keeps the same name
|
||||
* @param bool $isOnline
|
||||
<<<<<<< HEAD
|
||||
* @return $this
|
||||
* @throws \Thelia\Exception\FileNotFoundException
|
||||
* @throws \Thelia\Exception\FileNotReadableException
|
||||
@@ -45,6 +48,8 @@ interface ArchiveBuilderInterface
|
||||
* @param string $directoryInArchive This is the directory where it will be stored in the archive
|
||||
* @param null|string $name The name of the file in the archive. if it null or empty, it keeps the same name
|
||||
* @param bool $isOnline
|
||||
=======
|
||||
>>>>>>> Fix cs
|
||||
* @return $this
|
||||
* @throws \Thelia\Exception\FileNotFoundException
|
||||
* @throws \Thelia\Exception\FileNotReadableException
|
||||
@@ -69,8 +74,12 @@ interface ArchiveBuilderInterface
|
||||
=======
|
||||
* @param $content
|
||||
* @param $name
|
||||
<<<<<<< HEAD
|
||||
* @param string $directoryInArchive
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
* @param string $directoryInArchive
|
||||
>>>>>>> Fix cs
|
||||
* @return mixed
|
||||
* @throws \ErrorException
|
||||
*
|
||||
@@ -79,11 +88,15 @@ interface ArchiveBuilderInterface
|
||||
public function addFileFromString($content, $name, $directoryInArchive = "/");
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $pathToFile
|
||||
=======
|
||||
* @param string $pathToFile
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
* @param string $pathToFile
|
||||
>>>>>>> Fix cs
|
||||
* @return null|string
|
||||
* @throws \Thelia\Exception\FileNotFoundException
|
||||
* @throws \Thelia\Exception\FileNotReadableException
|
||||
@@ -149,6 +162,7 @@ interface ArchiveBuilderInterface
|
||||
public function buildArchiveResponse();
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* @param string $pathToArchive
|
||||
* @param bool $isOnline
|
||||
<<<<<<< HEAD
|
||||
@@ -159,6 +173,10 @@ interface ArchiveBuilderInterface
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
=======
|
||||
* @param string $pathToArchive
|
||||
* @param bool $isOnline
|
||||
>>>>>>> Fix cs
|
||||
* @return $this
|
||||
* @throws \Thelia\Exception\FileNotFoundException
|
||||
* @throws \Thelia\Exception\HttpUrlException
|
||||
@@ -188,17 +206,22 @@ interface ArchiveBuilderInterface
|
||||
public function hasFile($pathToFile);
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $directory
|
||||
=======
|
||||
* @param string $directory
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
* @param string $directory
|
||||
>>>>>>> Fix cs
|
||||
* @return bool
|
||||
*
|
||||
* Check if the archive has a directory
|
||||
*/
|
||||
public function hasDirectory($directory);
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
@@ -216,3 +239,6 @@ interface ArchiveBuilderInterface
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -34,6 +34,7 @@ class ArchiveBuilderManager
|
||||
$this->environment = $environment;
|
||||
}
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param AbstractArchiveBuilder $archiveBuilder
|
||||
* @return $this
|
||||
@@ -46,6 +47,9 @@ class ArchiveBuilderManager
|
||||
$this->archiveBuilders[$archiveBuilder->getName()] = $archiveBuilder;
|
||||
=======
|
||||
* @param AbstractArchiveBuilder $archiveCreator
|
||||
=======
|
||||
* @param AbstractArchiveBuilder $archiveCreator
|
||||
>>>>>>> Fix cs
|
||||
* @return $this
|
||||
*/
|
||||
public function add(AbstractArchiveBuilder $archiveCreator)
|
||||
@@ -143,5 +147,9 @@ class ArchiveBuilderManager
|
||||
{
|
||||
return $this->archiveCreators;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -56,7 +56,11 @@ interface FormatInterface
|
||||
*/
|
||||
public function getMimeType();
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -18,24 +18,7 @@ use Thelia\Core\FileFormat\FormatInterface;
|
||||
* @package Thelia\Core\FileFormat\Formatter
|
||||
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||
*/
|
||||
abstract class AbstractFormatter implements FormatInterface
|
||||
abstract class AbstractFormatter implements FormatInterface, FormatterInterface
|
||||
{
|
||||
/**
|
||||
* @param array $data
|
||||
* @return mixed
|
||||
*
|
||||
* Encodes an array to the desired format.
|
||||
* $data array only contains array and scalar data.
|
||||
*/
|
||||
abstract public function encode(array $data);
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @return array
|
||||
* @throws \Thelia\Core\FileFormat\Formatter\Exception\BadFormattedStringException
|
||||
*
|
||||
* this method must do exactly the opposite of encode and return
|
||||
* an array composed of array and scalar data.
|
||||
*/
|
||||
abstract public function decode($data);
|
||||
}
|
||||
23
core/lib/Thelia/Core/FileFormat/Formatter/FormatterData.php
Normal file
23
core/lib/Thelia/Core/FileFormat/Formatter/FormatterData.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\FileFormat\Formatter;
|
||||
|
||||
/**
|
||||
* Class FormatterData
|
||||
* @package Thelia\Core\FileFormat\Formatter
|
||||
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||
*/
|
||||
class FormatterData
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* This file is part of the Thelia package. */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : dev@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE.txt */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Core\FileFormat\Formatter;
|
||||
|
||||
/**
|
||||
* Interface FormatterInterface
|
||||
* @package Thelia\Core\FileFormat\Formatter
|
||||
* @author Benjamin Perche <bperche@openstudio.fr>
|
||||
*/
|
||||
interface FormatterInterface
|
||||
{
|
||||
/**
|
||||
* @param FormatterData $data
|
||||
* @return mixed
|
||||
*
|
||||
* This method must use a FormatterData object and output
|
||||
* a formatted value.
|
||||
*/
|
||||
public function encode(FormatterData $data);
|
||||
|
||||
/**
|
||||
* @param $rawData
|
||||
* @return FormatterData
|
||||
*
|
||||
* This must takes raw data as argument and outputs
|
||||
* a FormatterData object.
|
||||
*/
|
||||
public function decode($rawData);
|
||||
}
|
||||
@@ -522,5 +522,9 @@ class TarArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->tar->getCompression()
|
||||
);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -36,7 +36,11 @@ class TarBz2ArchiveBuilderTest extends TarArchiveBuilderTest
|
||||
);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -13,9 +13,12 @@
|
||||
namespace Thelia\Tests\FileFormat\Archive\ArchiveBuilder;
|
||||
use Thelia\Core\FileFormat\Archive\ArchiveBuilder\TarGzArchiveBuilder;
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
=======
|
||||
>>>>>>> Fix cs
|
||||
|
||||
/**
|
||||
* Class TarGzArchiveBuilderTest
|
||||
@@ -40,7 +43,11 @@ class TarGzArchiveBuilderTest extends TarArchiveBuilderTest
|
||||
);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish tar, tar.gz, tar.bz2 and tests
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -693,6 +693,7 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
@@ -701,3 +702,6 @@ class ZipArchiveBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
=======
|
||||
}
|
||||
>>>>>>> Finish implementing and testing zip
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -72,8 +72,12 @@ class ArchiveBuilderManagerTest extends \PHPUnit_Framework_TestCase
|
||||
$this->manager->delete("foo");
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -22,6 +22,7 @@ use Thelia\Tools\FileDownload\FileDownloader;
|
||||
class FakeFileDownloader extends FileDownloader
|
||||
{
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
* @param string $url
|
||||
* @param string $pathToStore
|
||||
@@ -29,6 +30,10 @@ class FakeFileDownloader extends FileDownloader
|
||||
* @param string $url
|
||||
* @param string $pathToStore
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
* @param string $url
|
||||
* @param string $pathToStore
|
||||
>>>>>>> Fix cs
|
||||
* @throws \Thelia\Exception\FileNotFoundException
|
||||
* @throws \ErrorException
|
||||
* @throws \HttpUrlException
|
||||
@@ -46,8 +51,12 @@ class FakeFileDownloader extends FileDownloader
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
@@ -69,7 +69,11 @@ class FileDownloaderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->downloader->download("https://github.com/thelia/thelia", "php://temp");
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> Define archive builders and formatters
|
||||
=======
|
||||
}
|
||||
>>>>>>> Fix cs
|
||||
|
||||
Reference in New Issue
Block a user