Code Duplication    Length = 23-23 lines in 2 locations

src/Api/Type/MissingParameterException.php 1 location

@@ 24-46 (lines=23) @@
21
 *
22
 * @author Bernhard Schussek <[email protected]>
23
 */
24
class MissingParameterException extends RuntimeException
25
{
26
    /**
27
     * Creates a new exception for the given parameter name.
28
     *
29
     * @param string         $parameterName The name of the parameter that was
30
     *                                      missing.
31
     * @param string         $typeName      The name of the type that the
32
     *                                      parameter was searched on.
33
     * @param Exception|null $cause         The exception that caused this
34
     *                                      exception.
35
     *
36
     * @return static The created exception.
37
     */
38
    public static function forParameterName($parameterName, $typeName, Exception $cause = null)
39
    {
40
        return new static(sprintf(
41
            'The parameter "%s" is required for type "%s".',
42
            $parameterName,
43
            $typeName
44
        ), 0, $cause);
45
    }
46
}
47

src/Api/Type/NoSuchParameterException.php 1 location

@@ 24-46 (lines=23) @@
21
 *
22
 * @author Bernhard Schussek <[email protected]>
23
 */
24
class NoSuchParameterException extends RuntimeException
25
{
26
    /**
27
     * Creates a new exception for the given parameter name.
28
     *
29
     * @param string         $parameterName The name of the parameter that was
30
     *                                      not found.
31
     * @param string         $typeName      The name of the type that the
32
     *                                      parameter was searched on.
33
     * @param Exception|null $cause         The exception that caused this
34
     *                                      exception.
35
     *
36
     * @return static The created exception.
37
     */
38
    public static function forParameterName($parameterName, $typeName, Exception $cause = null)
39
    {
40
        return new static(sprintf(
41
            'The parameter "%s" does not exist for type "%s".',
42
            $parameterName,
43
            $typeName
44
        ), 0, $cause);
45
    }
46
}
47