SimpleXMLElement.php in Service Container 7        
                          
                  
                        
  
  
  
  
File
  modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/SimpleXMLElement.php
  
    View source  
  <?php
namespace Symfony\Component\DependencyInjection;
trigger_error('The ' . __NAMESPACE__ . '\\SimpleXMLElement method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
use Symfony\Component\Config\Util\XmlUtils;
use Symfony\Component\ExpressionLanguage\Expression;
class SimpleXMLElement extends \SimpleXMLElement {
  
  public function getAttributeAsPhp($name) {
    return self::phpize($this[$name]);
  }
  
  public function getArgumentsAsPhp($name, $lowercase = true) {
    $arguments = array();
    foreach ($this->{$name} as $arg) {
      if (isset($arg['name'])) {
        $arg['key'] = (string) $arg['name'];
      }
      $key = isset($arg['key']) ? (string) $arg['key'] : (!$arguments ? 0 : max(array_keys($arguments)) + 1);
      
      if ('parameter' == $name && $lowercase) {
        $key = strtolower($key);
      }
      
      if (isset($arg['index'])) {
        $key = 'index_' . $arg['index'];
      }
      switch ($arg['type']) {
        case 'service':
          $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE;
          if (isset($arg['on-invalid']) && 'ignore' == $arg['on-invalid']) {
            $invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
          }
          elseif (isset($arg['on-invalid']) && 'null' == $arg['on-invalid']) {
            $invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;
          }
          if (isset($arg['strict'])) {
            $strict = self::phpize($arg['strict']);
          }
          else {
            $strict = true;
          }
          $arguments[$key] = new Reference((string) $arg['id'], $invalidBehavior, $strict);
          break;
        case 'expression':
          $arguments[$key] = new Expression((string) $arg);
          break;
        case 'collection':
          $arguments[$key] = $arg
            ->getArgumentsAsPhp($name, false);
          break;
        case 'string':
          $arguments[$key] = (string) $arg;
          break;
        case 'constant':
          $arguments[$key] = constant((string) $arg);
          break;
        default:
          $arguments[$key] = self::phpize($arg);
      }
    }
    return $arguments;
  }
  
  public static function phpize($value) {
    return XmlUtils::phpize($value);
  }
}