Passed
Branch master (3fb2a1)
by Andrés
02:45
created

ErrorException::getTrimmedMessage()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 2
rs 10
1
<?php
2
3
/*
4
 * This file is part of the Magallanes package.
5
 *
6
 * (c) Andrés Montañez <[email protected]>
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 Mage\Task\Exception;
13
14
/**
15
 * The Task Failed, and it has a Custom Message
16
 *
17
 * @author Andrés Montañez <[email protected]>
18
 */
19
class ErrorException extends \Exception
20
{
21 7
    public function getTrimmedMessage(int $maxLength = 60): string
22
    {
23 7
        $message = $this->getMessage();
24
25 7
        if (strlen($message) > $maxLength) {
26 1
            $message = substr($message, 0, $maxLength) . '...';
27
        }
28
29 7
        return $message;
30
    }
31
}
32