Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
66.67% covered (warning)
66.67%
2 / 3
CRAP
80.00% covered (warning)
80.00%
4 / 5
AbstractVault
0.00% covered (danger)
0.00%
0 / 1
66.67% covered (warning)
66.67%
2 / 3
11.97
80.00% covered (warning)
80.00%
4 / 5
 getLastMessage
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 generateKeys
n/a
0 / 0
1
n/a
0 / 0
 seal
n/a
0 / 0
1
n/a
0 / 0
 reveal
n/a
0 / 0
2
n/a
0 / 0
 remove
n/a
0 / 0
1
n/a
0 / 0
 list
n/a
0 / 0
1
n/a
0 / 0
 validateName
0.00% covered (danger)
0.00%
0 / 1
2.15
66.67% covered (warning)
66.67%
2 / 3
 getPrettyPath
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Symfony\Bundle\FrameworkBundle\Secrets;
/**
 * @author Nicolas Grekas <p@tchwork.com>
 *
 * @internal
 */
abstract class AbstractVault
{
    protected $lastMessage;
    public function getLastMessage(): ?string
    {
        return $this->lastMessage;
    }
    abstract public function generateKeys(bool $override = false): bool;
    abstract public function seal(string $name, string $value): void;
    abstract public function reveal(string $name): ?string;
    abstract public function remove(string $name): bool;
    abstract public function list(bool $reveal = false): array;
    protected function validateName(string $name): void
    {
        if (!preg_match('/^\w++$/D', $name)) {
            throw new \LogicException(sprintf('Invalid secret name "%s": only "word" characters are allowed.', $name));
        }
    }
    protected function getPrettyPath(string $path)
    {
        return str_replace(getcwd().\DIRECTORY_SEPARATOR, '', $path);
    }
}