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 |
SimpleXMLElement.php
001 <?php
002
003 /*
004 * This file is part of the Symfony package.
005 *
006 * (c) Fabien Potencier <fabien@symfony.com>
007 *
008 * For the full copyright and license information, please view the LICENSE
009 * file that was distributed with this source code.
010 */
011
012 namespace Symfony\Component\DependencyInjection;
013
014 use Symfony\Component\Config\Util\XmlUtils;
015
016 /**
017 * SimpleXMLElement class.
018 *
019 * @author Fabien Potencier <fabien@symfony.com>
020 */
021 class SimpleXMLElement extends \SimpleXMLElement
022 {
023 /**
024 * Converts an attribute as a PHP type.
025 *
026 * @param string $name
027 *
028 * @return mixed
029 */
030 public function getAttributeAsPhp($name)
031 {
032 return self::phpize($this[$name]);
033 }
034
035 /**
036 * Returns arguments as valid PHP types.
037 *
038 * @param string $name
039 * @param bool $lowercase
040 *
041 * @return mixed
042 */
043 public function getArgumentsAsPhp($name, $lowercase = true)
044 {
045 $arguments = array();
046 foreach ($this->$name as $arg) {
047 if (isset($arg['name'])) {
048 $arg['key'] = (string) $arg['name'];
049 }
050 $key = isset($arg['key']) ? (string) $arg['key'] : (!$arguments ? 0 : max(array_keys($arguments)) + 1);
051
052 // parameter keys are case insensitive
053 if ('parameter' == $name && $lowercase) {
054 $key = strtolower($key);
055 }
056
057 // this is used by DefinitionDecorator to overwrite a specific
058 // argument of the parent definition
059 if (isset($arg['index'])) {
060 $key = 'index_'.$arg['index'];
061 }
062
063 switch ($arg['type']) {
064 case 'service':
065 $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
066 if (isset($arg['on-invalid']) && 'ignore' == $arg['on-invalid']) {
067 $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
068 } elseif (isset($arg['on-invalid']) && 'null' == $arg['on-invalid']) {
069 $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;
070 }
071
072 if (isset($arg['strict'])) {
073 $strict = self::phpize($arg['strict']);
074 } else {
075 $strict = true;
076 }
077
078 $arguments[$key] = new Reference((string) $arg['id'], $invalidBehavior, $strict);
079 break;
080 case 'collection':
081 $arguments[$key] = $arg->getArgumentsAsPhp($name, false);
082 break;
083 case 'string':
084 $arguments[$key] = (string) $arg;
085 break;
086 case 'constant':
087 $arguments[$key] = constant((string) $arg);
088 break;
089 default:
090 $arguments[$key] = self::phpize($arg);
091 }
092 }
093
094 return $arguments;
095 }
096
097 /**
098 * Converts an xml value to a PHP type.
099 *
100 * @param mixed $value
101 *
102 * @return mixed
103 */
104 public static function phpize($value)
105 {
106 return XmlUtils::phpize($value);
107 }
108 }
109