Completed
Push — 4-cactus ( 339538...3ebc54 )
by Alberto
39s queued 26s
created

UserExistsException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
rs 10
c 1
b 0
f 0
1
<?php
2
/**
3
 * BEdita, API-first content management framework
4
 * Copyright 2022 ChannelWeb Srl, Chialab Srl
5
 *
6
 * This file is part of BEdita: you can redistribute it and/or modify
7
 * it under the terms of the GNU Lesser General Public License as published
8
 * by the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * See LICENSE.LGPL or <http://gnu.org/licenses/lgpl-3.0.html> for more details.
12
 */
13
14
namespace BEdita\Core\Exception;
15
16
use Cake\Core\Exception\Exception;
17
18
/**
19
 * Exception raised when an already existing user is found.
20
 */
21
class UserExistsException extends Exception
22
{
23
    /**
24
     * Application error code
25
     *
26
     * @var string
27
     */
28
    public const BE_USER_EXISTS = 'be_user_exists';
29
30
    /**
31
     * {@inheritDoc}
32
     *
33
     * Use 400 as HTTP status code and add options details array to internal attributes.
34
     *
35
     * @codeCoverageIgnore
36
     */
37
    public function __construct(string $message, ?array $details = null)
38
    {
39
        parent::__construct($message, 400);
40
        $this->_attributes['code'] = static::BE_USER_EXISTS;
41
        $this->_attributes['detail'] = $details;
42
    }
43
}
44