Exception::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 5
cp 0
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 3
crap 6
1
<?php
2
3
namespace OpenBuildings\PayPal;
4
5
/**
6
 * @author Haralan Dobrev <[email protected]>
7
 * @copyright 2013 OpenBuildings, Inc.
8
 * @license http://spdx.org/licenses/BSD-3-Clause
9
 */
10
class Exception extends \Exception {
11
12
	public function __construct($message, $variables = array(), \Exception $previous = NULL)
13
	{
14
		if ($variables)
0 ignored issues
show
Bug Best Practice introduced by
The expression $variables of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
15
		{
16
			$message = strtr($message, $variables);
17
		}
18
19
		parent::__construct($message, 0, $previous);
20
	}
21
}