Passed
Pull Request — main (#18)
by
unknown
07:12 queued 03:32
created

PublisherException::collision()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of Blitz PHP framework.
5
 *
6
 * (c) 2022 Dimitri Sitchet Tomkeu <[email protected]>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace BlitzPHP\Exceptions;
13
14
/**
15
 * Publisher Exception Class
16
 *
17
 * Gère les exceptions liées aux actions entreprises par un Publisher.
18
 */
19
class PublisherException extends FrameworkException
20
{
21
    /**
22
     * Lève lorsqu'un fichier doit être écrasé mais ne le peut pas.
23
     *
24
     * @param string $from Le fichier source
25
     * @param string $to   The destination file
26
     */
27
    public static function collision(string $from, string $to)
28
    {
29 4
        return new static(lang('Publisher.collision', [filetype($to), $from, $to]));
30
    }
31
32
    /**
33
     * Lève une fois donnée une destination qui ne figure pas dans la liste des répertoires autorisés.
34
     */
35
    public static function destinationNotAllowed(string $destination)
36
    {
37 2
        return new static(lang('Publisher.destinationNotAllowed', [$destination]));
38
    }
39
40
    /**
41
     * Lève lorsqu'un fichier ne correspond pas au modèle autorisé pour sa destination.
42
     */
43
    public static function fileNotAllowed(string $file, string $directory, string $pattern)
44
    {
45 2
        return new static(lang('Publisher.fileNotAllowed', [$file, $directory, $pattern]));
46
    }
47
}
48