[ Index ] |
PHP Cross Reference of phpBB-3.1.12-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <fabien@symfony.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12 namespace Symfony\Component\DependencyInjection; 13 14 use Symfony\Component\Config\Util\XmlUtils; 15 16 /** 17 * SimpleXMLElement class. 18 * 19 * @author Fabien Potencier <fabien@symfony.com> 20 */ 21 class SimpleXMLElement extends \SimpleXMLElement 22 { 23 /** 24 * Converts an attribute as a PHP type. 25 * 26 * @param string $name 27 * 28 * @return mixed 29 */ 30 public function getAttributeAsPhp($name) 31 { 32 return self::phpize($this[$name]); 33 } 34 35 /** 36 * Returns arguments as valid PHP types. 37 * 38 * @param string $name 39 * @param bool $lowercase 40 * 41 * @return mixed 42 */ 43 public function getArgumentsAsPhp($name, $lowercase = true) 44 { 45 $arguments = array(); 46 foreach ($this->$name as $arg) { 47 if (isset($arg['name'])) { 48 $arg['key'] = (string) $arg['name']; 49 } 50 $key = isset($arg['key']) ? (string) $arg['key'] : (!$arguments ? 0 : max(array_keys($arguments)) + 1); 51 52 // parameter keys are case insensitive 53 if ('parameter' == $name && $lowercase) { 54 $key = strtolower($key); 55 } 56 57 // this is used by DefinitionDecorator to overwrite a specific 58 // argument of the parent definition 59 if (isset($arg['index'])) { 60 $key = 'index_'.$arg['index']; 61 } 62 63 switch ($arg['type']) { 64 case 'service': 65 $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE; 66 if (isset($arg['on-invalid']) && 'ignore' == $arg['on-invalid']) { 67 $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; 68 } elseif (isset($arg['on-invalid']) && 'null' == $arg['on-invalid']) { 69 $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE; 70 } 71 72 if (isset($arg['strict'])) { 73 $strict = self::phpize($arg['strict']); 74 } else { 75 $strict = true; 76 } 77 78 $arguments[$key] = new Reference((string) $arg['id'], $invalidBehavior, $strict); 79 break; 80 case 'collection': 81 $arguments[$key] = $arg->getArgumentsAsPhp($name, false); 82 break; 83 case 'string': 84 $arguments[$key] = (string) $arg; 85 break; 86 case 'constant': 87 $arguments[$key] = constant((string) $arg); 88 break; 89 default: 90 $arguments[$key] = self::phpize($arg); 91 } 92 } 93 94 return $arguments; 95 } 96 97 /** 98 * Converts an xml value to a PHP type. 99 * 100 * @param mixed $value 101 * 102 * @return mixed 103 */ 104 public static function phpize($value) 105 { 106 return XmlUtils::phpize($value); 107 } 108 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Jan 11 00:25:41 2018 | Cross-referenced by PHPXref 0.7.1 |