Verzeichnisstruktur phpBB-3.1.0
- Veröffentlicht
- 27.10.2014
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ParameterNotFoundException.php
01 <?php
02
03 /*
04 * This file is part of the Symfony package.
05 *
06 * (c) Fabien Potencier <fabien@symfony.com>
07 *
08 * For the full copyright and license information, please view the LICENSE
09 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\DependencyInjection\Exception;
13
14 /**
15 * This exception is thrown when a non-existent parameter is used.
16 *
17 * @author Fabien Potencier <fabien@symfony.com>
18 */
19 class ParameterNotFoundException extends InvalidArgumentException
20 {
21 private $key;
22 private $sourceId;
23 private $sourceKey;
24 private $alternatives;
25
26 /**
27 * Constructor.
28 *
29 * @param string $key The requested parameter key
30 * @param string $sourceId The service id that references the non-existent parameter
31 * @param string $sourceKey The parameter key that references the non-existent parameter
32 * @param \Exception $previous The previous exception
33 * @param string[] $alternatives Some parameter name alternatives
34 */
35 public function __construct($key, $sourceId = null, $sourceKey = null, \Exception $previous = null, array $alternatives = array())
36 {
37 $this->key = $key;
38 $this->sourceId = $sourceId;
39 $this->sourceKey = $sourceKey;
40 $this->alternatives = $alternatives;
41
42 parent::__construct('', 0, $previous);
43
44 $this->updateRepr();
45 }
46
47 public function updateRepr()
48 {
49 if (null !== $this->sourceId) {
50 $this->message = sprintf('The service "%s" has a dependency on a non-existent parameter "%s".', $this->sourceId, $this->key);
51 } elseif (null !== $this->sourceKey) {
52 $this->message = sprintf('The parameter "%s" has a dependency on a non-existent parameter "%s".', $this->sourceKey, $this->key);
53 } else {
54 $this->message = sprintf('You have requested a non-existent parameter "%s".', $this->key);
55 }
56
57 if ($this->alternatives) {
58 if (1 == count($this->alternatives)) {
59 $this->message .= ' Did you mean this: "';
60 } else {
61 $this->message .= ' Did you mean one of these: "';
62 }
63 $this->message .= implode('", "', $this->alternatives).'"?';
64 }
65 }
66
67 public function getKey()
68 {
69 return $this->key;
70 }
71
72 public function getSourceId()
73 {
74 return $this->sourceId;
75 }
76
77 public function getSourceKey()
78 {
79 return $this->sourceKey;
80 }
81
82 public function setSourceId($sourceId)
83 {
84 $this->sourceId = $sourceId;
85
86 $this->updateRepr();
87 }
88
89 public function setSourceKey($sourceKey)
90 {
91 $this->sourceKey = $sourceKey;
92
93 $this->updateRepr();
94 }
95 }
96