1: <?php
2: /**
3: * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
4: * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
5: *
6: * Licensed under The MIT License
7: * Redistributions of files must retain the above copyright notice.
8: *
9: * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
10: * @since 3.0.0
11: * @license https://opensource.org/licenses/mit-license.php MIT License
12: */
13: namespace Cake\Routing\Exception;
14:
15: use Cake\Core\Exception\Exception;
16:
17: /**
18: * Exception raised when a URL cannot be reverse routed
19: * or when a URL cannot be parsed.
20: */
21: class MissingRouteException extends Exception
22: {
23:
24: /**
25: * {@inheritDoc}
26: */
27: protected $_messageTemplate = 'A route matching "%s" could not be found.';
28:
29: /**
30: * Message template to use when the requested method is included.
31: *
32: * @var string
33: */
34: protected $_messageTemplateWithMethod = 'A "%s" route matching "%s" could not be found.';
35:
36: /**
37: * {@inheritDoc}
38: */
39: public function __construct($message, $code = 404, $previous = null)
40: {
41: if (is_array($message)) {
42: if (isset($message['message'])) {
43: $this->_messageTemplate = $message['message'];
44: } elseif (isset($message['method']) && $message['method']) {
45: $this->_messageTemplate = $this->_messageTemplateWithMethod;
46: }
47: }
48: parent::__construct($message, $code, $previous);
49: }
50: }
51: