• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SAML-Toolkits / php-saml / #3

pending completion
#3

push

pitbulk
Fix tests

10 of 10 new or added lines in 2 files covered. (100.0%)

1994 of 2430 relevant lines covered (82.06%)

2.98 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.14
/src/Saml2/ValidationError.php
1
<?php
2
/**
3
 * This file is part of php-saml.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @package OneLogin
9
 * @author  Sixto Martin <sixto.martin.garcia@gmail.com>
10
 * @license MIT https://github.com/SAML-Toolkits/php-saml/blob/master/LICENSE
11
 * @link    https://github.com/SAML-Toolkits/php-saml
12
 */
13

14
namespace OneLogin\Saml2;
15

16
use Exception;
17

18
/**
19
 * ValidationError class of SAML PHP Toolkit
20
 *
21
 * This class implements another custom Exception handler,
22
 * related to exceptions that happens during validation process.
23
 */
24
class ValidationError extends Exception
25
{
26
    // Validation Errors
27
    const UNSUPPORTED_SAML_VERSION = 0;
28
    const MISSING_ID = 1;
29
    const WRONG_NUMBER_OF_ASSERTIONS = 2;
30
    const MISSING_STATUS = 3;
31
    const MISSING_STATUS_CODE = 4;
32
    const STATUS_CODE_IS_NOT_SUCCESS = 5;
33
    const WRONG_SIGNED_ELEMENT = 6;
34
    const ID_NOT_FOUND_IN_SIGNED_ELEMENT = 7;
35
    const DUPLICATED_ID_IN_SIGNED_ELEMENTS = 8;
36
    const INVALID_SIGNED_ELEMENT = 9;
37
    const DUPLICATED_REFERENCE_IN_SIGNED_ELEMENTS = 10;
38
    const UNEXPECTED_SIGNED_ELEMENTS = 11;
39
    const WRONG_NUMBER_OF_SIGNATURES_IN_RESPONSE = 12;
40
    const WRONG_NUMBER_OF_SIGNATURES_IN_ASSERTION = 13;
41
    const INVALID_XML_FORMAT = 14;
42
    const WRONG_INRESPONSETO = 15;
43
    const NO_ENCRYPTED_ASSERTION = 16;
44
    const NO_ENCRYPTED_NAMEID = 17;
45
    const MISSING_CONDITIONS = 18;
46
    const ASSERTION_TOO_EARLY = 19;
47
    const ASSERTION_EXPIRED = 20;
48
    const WRONG_NUMBER_OF_AUTHSTATEMENTS = 21;
49
    const NO_ATTRIBUTESTATEMENT = 22;
50
    const ENCRYPTED_ATTRIBUTES = 23;
51
    const WRONG_DESTINATION = 24;
52
    const EMPTY_DESTINATION = 25;
53
    const WRONG_AUDIENCE = 26;
54
    const ISSUER_MULTIPLE_IN_RESPONSE = 27;
55
    const ISSUER_NOT_FOUND_IN_ASSERTION = 28;
56
    const WRONG_ISSUER = 29;
57
    const SESSION_EXPIRED = 30;
58
    const WRONG_SUBJECTCONFIRMATION = 31;
59
    const NO_SIGNED_MESSAGE = 32;
60
    const NO_SIGNED_ASSERTION = 33;
61
    const NO_SIGNATURE_FOUND = 34;
62
    const KEYINFO_NOT_FOUND_IN_ENCRYPTED_DATA = 35;
63
    const CHILDREN_NODE_NOT_FOUND_IN_KEYINFO = 36;
64
    const UNSUPPORTED_RETRIEVAL_METHOD = 37;
65
    const NO_NAMEID = 38;
66
    const EMPTY_NAMEID = 39;
67
    const SP_NAME_QUALIFIER_NAME_MISMATCH = 40;
68
    const DUPLICATED_ATTRIBUTE_NAME_FOUND = 41;
69
    const INVALID_SIGNATURE = 42;
70
    const WRONG_NUMBER_OF_SIGNATURES = 43;
71
    const RESPONSE_EXPIRED = 44;
72
    const UNEXPECTED_REFERENCE = 45;
73
    const NOT_SUPPORTED = 46;
74
    const KEY_ALGORITHM_ERROR = 47;
75
    const MISSING_ENCRYPTED_ELEMENT = 48;
76

77

78
    /**
79
     * Constructor
80
     *
81
     * @param string     $msg  Describes the error.
82
     * @param int        $code The code error (defined in the error class).
83
     * @param array|null $args Arguments used in the message that describes the error.
84
     */
85
    public function __construct($msg, $code = 0, $args = array())
86
    {
87
        assert(is_string($msg));
88
        assert(is_int($code));
89

90
        if (!isset($args)) {
1✔
91
            $args = array();
×
92
        }
93
        if (!empty($args)) {
1✔
94
            $params = array_merge(array($msg), $args);
×
95
            $message = call_user_func_array('sprintf', $params);
×
96
        } else {
97
            $message = $msg;
1✔
98
        }
99

100
        parent::__construct($message, $code);
1✔
101
    }
102
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc