mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 20:13:28 +00:00

Conflicts: bin/console lib/Alchemy/Phrasea/Controller/Api/V1.php lib/Alchemy/Phrasea/Controller/Prod/Edit.php lib/Alchemy/Phrasea/Core/Version.php lib/classes/API/V1/Interface.php lib/classes/API/V1/adapter.php lib/classes/Feed/XML/Abstract.php lib/classes/Feed/XML/Cooliris.php lib/classes/User/Adapter.php lib/classes/media/Permalink/Adapter.php lib/classes/media/abstract.php lib/classes/media/subdef.php lib/classes/p4file.php lib/classes/record/preview.php lib/conf.d/_GV_template.inc tests/Alchemy/Tests/Phrasea/Controller/Api/ApiTestCase.php tests/Alchemy/Tests/Phrasea/Core/Provider/FileServeServiceProviderTest.php tests/classes/media/Permalink/media_Permalink_AdapterTest.php
69 lines
1.3 KiB
PHP
69 lines
1.3 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Phraseanet
|
|
*
|
|
* (c) 2005-2014 Alchemy
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Alchemy\Phrasea\Http;
|
|
|
|
use Alchemy\Phrasea\Exception\InvalidArgumentException;
|
|
|
|
abstract class AbstractServerMode
|
|
{
|
|
protected $mapping = [];
|
|
|
|
/**
|
|
* @params array $mapping
|
|
*
|
|
* @throws InvalidArgumentException if mapping is invalid;
|
|
*/
|
|
public function __construct(array $mapping)
|
|
{
|
|
$this->setMapping($mapping);
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function getMapping()
|
|
{
|
|
return $this->mapping;
|
|
}
|
|
|
|
/**
|
|
* @params array $mapping
|
|
*
|
|
* @throws InvalidArgumentException if mapping is invalid;
|
|
*/
|
|
abstract public function setMapping(array $mapping);
|
|
|
|
/**
|
|
* Sanitizes path directory.
|
|
*
|
|
* @param string $path
|
|
*
|
|
* @return string
|
|
*/
|
|
protected function sanitizePath($path)
|
|
{
|
|
return sprintf('/%s', trim($path, '/'));
|
|
}
|
|
|
|
/**
|
|
* Sanitizes a mount point.
|
|
*
|
|
* @param string $mountPoint
|
|
*
|
|
* @return string
|
|
*/
|
|
protected function sanitizeMountPoint($mountPoint)
|
|
{
|
|
return sprintf('/%s', trim($mountPoint, '/'));
|
|
}
|
|
}
|