Completed
Push — master ( 99e244...bf2eb3 )
by Paweł
204:07 queued 189:10
created

FailedGenerationException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sylius\Component\Promotion\Exception;
13
14
use Sylius\Component\Promotion\Generator\InstructionInterface;
15
16
/**
17
 * @author Arkadiusz Krakowiak <[email protected]>
18
 */
19
class FailedGenerationException extends \InvalidArgumentException
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function __construct(InstructionInterface $instruction, $exceptionCode = 0, \Exception $previousException = null)
25
    {
26
        $message = sprintf(
27
            'Invalid coupon code length or coupons amount. It is not possible to generate %d unique coupons with %d code length',
28
            $instruction->getAmount(),
29
            $instruction->getCodeLength()
30
        );
31
32
        parent::__construct($message, $exceptionCode, $previousException);
33
    }
34
}
35