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:
@@ -144,7 +144,6 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $directoryPath
|
||||
* @return $this
|
||||
@@ -206,7 +205,6 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
return $content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $pathInArchive
|
||||
* @return $this
|
||||
@@ -292,6 +290,7 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
* This throws TarArchiveBuilderException if
|
||||
* the archive is not valid.
|
||||
*/
|
||||
|
||||
return $tar->setEnvironment($tar->environment);
|
||||
}
|
||||
|
||||
@@ -383,7 +382,6 @@ class TarArchiveBuilder extends AbstractArchiveBuilder
|
||||
|
||||
$this->compressionEntryPoint();
|
||||
|
||||
|
||||
} catch (\BadMethodCallException $e) {
|
||||
/**
|
||||
* This should not happen
|
||||
|
||||
@@ -47,7 +47,7 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
* On the destruction of the class,
|
||||
* remove the temporary file.
|
||||
*/
|
||||
function __destruct()
|
||||
public function __destruct()
|
||||
{
|
||||
if ($this->zip instanceof \ZipArchive) {
|
||||
@$this->zip->close();
|
||||
@@ -244,6 +244,7 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
if (preg_match("#\/?[^\/]+\/[^\/]+\/?#", $initialString)) {
|
||||
$initialString = "/" . $initialString;
|
||||
}
|
||||
|
||||
return $initialString;
|
||||
}
|
||||
|
||||
@@ -531,6 +532,7 @@ class ZipArchiveBuilder extends AbstractArchiveBuilder
|
||||
if (preg_match("#\/?[^\/]+\/[^/]+\/?#", $initialString)) {
|
||||
$initialString = "/" . $initialString;
|
||||
}
|
||||
|
||||
return $initialString;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
namespace Thelia\Core\FileFormat\Archive;
|
||||
|
||||
|
||||
/**
|
||||
* Interface ArchiveBuilderInterface
|
||||
* @package Thelia\Core\FileFormat\Archive
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
namespace Thelia\Tests\FileFormat\Archive\ArchiveBuilder;
|
||||
use Thelia\Core\FileFormat\Archive\ArchiveBuilder\TarGzArchiveBuilder;
|
||||
use Thelia\Core\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Class TarGzArchiveBuilderTest
|
||||
|
||||
Reference in New Issue
Block a user