Completed
Pull Request — master (#29)
by Tom
03:12
created

ExceptionFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace TomPHP\ConfigServiceProvider\Exception;
4
5
use Exception as PHPException;
6
7
trait ExceptionFactory
8
{
9
    /**
10
     * @param  string $message
11
     * @param  mixed  ...$params
12
     *
13
     * @return self
14
     */
15
    protected static function create($message)
16
    {
17
        $params = func_get_args();
18
        array_shift($params);
19
20
        return new self(vsprintf($message, $params));
0 ignored issues
show
Unused Code introduced by
The call to ExceptionFactory::__construct() has too many arguments starting with vsprintf($message, $params).

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
21
    }
22
}
23