Completed
Push — master ( 33e560...941fa0 )
by ReliQ
01:39
created

PublicationFailed   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 1
dl 0
loc 21
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ReliqArts\Docweaver\Exception\Product;
6
7
use ReliqArts\Docweaver\Contract\Exception as ExceptionContract;
8
use ReliqArts\Docweaver\Exception\Exception;
9
use ReliqArts\Docweaver\Model\Product;
10
11
class PublicationFailed extends Exception
12
{
13
    private const CODE = 8001;
14
15
    /**
16
     * @var Product
17
     */
18
    protected Product $product;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_STRING, expecting T_FUNCTION or T_CONST
Loading history...
19
20
    public static function forProductVersion(
21
        Product $product,
22
        string $version,
23
        Exception $previous = null
24
    ): ExceptionContract {
25
        $message = sprintf('Failed to publish version `%s` of product `%s`.', $version, $product->getName());
26
        $self = new self($message, self::CODE, $previous);
27
        $self->product = $product;
28
29
        return $self;
30
    }
31
}
32