1 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/**
|
|
|
4 |
* Licensed to Jasig under one or more contributor license
|
|
|
5 |
* agreements. See the NOTICE file distributed with this work for
|
|
|
6 |
* additional information regarding copyright ownership.
|
|
|
7 |
*
|
|
|
8 |
* Jasig licenses this file to you under the Apache License,
|
|
|
9 |
* Version 2.0 (the "License"); you may not use this file except in
|
|
|
10 |
* compliance with the License. You may obtain a copy of the License at:
|
|
|
11 |
*
|
|
|
12 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
13 |
*
|
|
|
14 |
* Unless required by applicable law or agreed to in writing, software
|
|
|
15 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
16 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
17 |
* See the License for the specific language governing permissions and
|
|
|
18 |
* limitations under the License.
|
|
|
19 |
*
|
|
|
20 |
* PHP Version 7
|
|
|
21 |
*
|
|
|
22 |
* @file CAS/InvalidArgumentException.php
|
|
|
23 |
* @category Authentication
|
|
|
24 |
* @package PhpCAS
|
|
|
25 |
* @author Adam Franco <afranco@middlebury.edu>
|
|
|
26 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
|
|
27 |
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
|
|
28 |
*/
|
|
|
29 |
|
|
|
30 |
/**
|
|
|
31 |
* Exception that denotes invalid arguments were passed.
|
|
|
32 |
*
|
|
|
33 |
* @class CAS_InvalidArgumentException
|
|
|
34 |
* @category Authentication
|
|
|
35 |
* @package PhpCAS
|
|
|
36 |
* @author Adam Franco <afranco@middlebury.edu>
|
|
|
37 |
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
|
|
|
38 |
* @link https://wiki.jasig.org/display/CASC/phpCAS
|
|
|
39 |
*/
|
|
|
40 |
class CAS_TypeMismatchException
|
|
|
41 |
extends CAS_InvalidArgumentException
|
|
|
42 |
{
|
|
|
43 |
/**
|
|
|
44 |
* Constructor, provides a nice message.
|
|
|
45 |
*
|
|
|
46 |
* @param mixed $argument Argument
|
|
|
47 |
* @param string $argumentName Argument Name
|
|
|
48 |
* @param string $type Type
|
|
|
49 |
* @param string $message Error Message
|
|
|
50 |
* @param integer $code Code
|
|
|
51 |
*
|
|
|
52 |
* @return void
|
|
|
53 |
*/
|
|
|
54 |
public function __construct (
|
|
|
55 |
$argument, $argumentName, $type, $message = '', $code = 0
|
|
|
56 |
) {
|
|
|
57 |
if (is_object($argument)) {
|
|
|
58 |
$foundType = get_class($argument).' object';
|
|
|
59 |
} else {
|
|
|
60 |
$foundType = gettype($argument);
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
parent::__construct(
|
|
|
64 |
'type mismatched for parameter '
|
|
|
65 |
. $argumentName . ' (should be \'' . $type .' \'), '
|
|
|
66 |
. $foundType . ' given. ' . $message, $code
|
|
|
67 |
);
|
|
|
68 |
}
|
|
|
69 |
}
|
|
|
70 |
?>
|