Creates a subscription description with specified XML string.

@param string $subscriptionDescriptionXml An XML based subscription
description

@return SubscriptionDescription
439739
public static function create($subscriptionDescriptionXml)
    {
        $subscriptionDescription = new self();
        $root = simplexml_load_string(
            $subscriptionDescriptionXml
        );
        $subscriptionDescriptionArray = (array) $root;
        if (array_key_exists('LockDuration', $subscriptionDescriptionArray)) {
            $subscriptionDescription->setLockDuration(
                (string) $subscriptionDescriptionArray['LockDuration']
            );
        }

        if (array_key_exists('RequiresSession', $subscriptionDescriptionArray)) {
            $subscriptionDescription->setRequiresSession(
                (bool) $subscriptionDescriptionArray['RequiresSession']
            );
        }

        if (array_key_exists(
            'DefaultMessageTimeToLive',
            $subscriptionDescriptionArray
        )
        ) {
            $subscriptionDescription->setDefaultMessageTimeToLive(
                (string) $subscriptionDescriptionArray['DefaultMessageTimeToLive']
            );
        }

        if (array_key_exists(
            'DeadLetteringOnMessageExpiration',
            $subscriptionDescriptionArray
        )
        ) {
            $subscriptionDescription->setDeadLetteringOnMessageExpiration(
                (string) $subscriptionDescriptionArray[
                'DeadLetteringOnMessageExpiration'
                ]
            );
        }

        if (array_key_exists(
            'DeadLetteringOnFilterEvaluationException',
            $subscriptionDescriptionArray
        )
        ) {
            $subscriptionDescription->setDeadLetteringOnFilterEvaluationExceptions(
                (string) $subscriptionDescriptionArray[
                    'DeadLetteringOnFilterEvaluationException'
                ]
            );
        }

        if (array_key_exists(
            'DefaultRuleDescription',
            $subscriptionDescriptionArray
        )
        ) {
            $subscriptionDescription->setDefaultRuleDescription(
                (string) $subscriptionDescriptionArray['DefaultRuleDescription']
            );
        }

        if (array_key_exists('MessageCount', $subscriptionDescriptionArray)) {
            $subscriptionDescription->setMessageCount(
                (string) $subscriptionDescriptionArray['MessageCount']
            );
        }

        if (array_key_exists('MaxDeliveryCount', $subscriptionDescriptionArray)) {
            $subscriptionDescription->setMaxDeliveryCount(
                (string) $subscriptionDescriptionArray['MaxDeliveryCount']
            );
        }

        if (array_key_exists(
            'EnableBatchedOperations',
            $subscriptionDescriptionArray
        )
        ) {
            $subscriptionDescription->setEnableBatchedOperations(
                (bool) $subscriptionDescriptionArray['EnableBatchedOperations']
            );
        }

        return $subscriptionDescription;
    }
934499
public function createResponseFromXml($xml)
    {
        $dom = new \DomDocument($xml);
        if (!$dom->loadXML($xml)) {
            return;
        }

        $data = array();

        foreach($dom->childNodes as $root) {
            if ($root->nodeType !== XML_ELEMENT_NODE) {
                continue;
            }
            foreach($root->childNodes as $node) {
                $name = $node->nodeName;
                $text = $node->textContent;
                $data[$name] = $text;
            }
        }

        return new Response($data);
    }
1064173
public static function fromXml(\DOMElement $xml)
    {
        $static = new static();
        $static->libraryItemMetadata = LibraryItemMetadata::fromXml($xml);

        $expenseId = $xml->getElementsByTagName('id');
        $static->expenseId = StringLiteral::fromXml($expenseId);

        $date = $xml->getElementsByTagName('date');
        $static->date = DateTime::fromXml($date);

        $amount = $xml->getElementsByTagName('amount');
        $static->amount = FloatLiteral::fromXml($amount);

        $stringLiterals = array(
            'title' => $xml->getElementsByTagName('title'),
            'description' => $xml->getElementsByTagName('description'),
            'type' => $xml->getElementsByTagName('type'),
        );
        foreach ($stringLiterals as $propertyName => $xmlTag) {
            $static->$propertyName = StringLiteral::fromXml($xmlTag);
        }

        return $static;
    }
866011
private function prepareCreateXMLChildObject()
    {
        $fragment = new CNabuPHPMethodBuilder(
            $this, 'createXMLChildObject', CNabuPHPMethodBuilder::METHOD_PROTECTED,
            false, false, false, true, 'CNabuXMLDataObject'
        );
        $this->getDocument()->addUse('\nabu\xml\CNabuXMLDataObject');

        $fragment->addComment("Create the XML Child object filled with their Data Object.");
        $fragment->addComment("@return CNabuXMLDataObject Returns a XML instance with the child data object instance.");

        $fragment->addParam(
            'nb_child', 'CNabuDataObject', true, null, 'CNabuDataObject',
            'Child data object.'
        );
        $this->getDocument()->addUse('\nabu\data\CNabuDataObject');

        $class_name = preg_replace('/List(Base)*$/', '', $this->class_name);
        $class_ns = preg_replace('/\\\\base$/', '', $this->class_namespace);

        $fragment->addFragment("return new $class_name(\$nb_child);");
        $this->getDocument()->addUse("\\$class_ns\\$class_name");

        $this->addFragment($fragment);
    }
325075
@XmlElementDecl(namespace = "urn:oasis:names:tc:xacml:3.0:core:schema:wd-17", name = "Description")
    public JAXBElement<String> createDescription(String value) {
        return new JAXBElement<String>(_Description_QNAME, String.class, null, value);
    }
754811
@Override
    public ConsumerSession createConsumerSessionForDurableSubscription(String subscriptionName,
                                                                       boolean enableReadAhead,
                                                                       Reliability unrecoverableReliability,
                                                                       boolean bifurcatable)

                    throws SIConnectionUnavailableException, SIConnectionDroppedException,
                    SIErrorException,
                    SIDurableSubscriptionNotFoundException, SIDurableSubscriptionMismatchException,
                    SIDestinationLockedException, SIIncorrectCallException, SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.entry(
                        CoreSPIConnection.tc,
                        "createConsumerSessionForDurableSubscription",
                        new Object[] {
                                      this,
                                      subscriptionName,
                                      Boolean.valueOf(enableReadAhead),
                                      unrecoverableReliability,
                                      Boolean.valueOf(bifurcatable) });

        // Do not need to check that the destination information is correct.
        // As we are using the subscription data straight from the named subscription

        // Find the ConsumerDispatcher for this subscription
        // Note that it must be homed on this ME
        HashMap durableSubs = _destinationManager.getDurableSubscriptionsTable();

        ConsumerDispatcher cd = null;
        synchronized (durableSubs)
        {
            //Look up the consumer dispatcher for this subId in the system durable subs list
            cd =
                            (ConsumerDispatcher) durableSubs.get(subscriptionName);

            // Check that the durable subscription exists
            if (cd == null)
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "createConsumerSessionForDurableSubscription");

                throw new SIDurableSubscriptionNotFoundException(
                                nls.getFormattedMessage(
                                                        "SUBSCRIPTION_DOESNT_EXIST_ERROR_CWSIP0072",
                                                        new Object[] { subscriptionName,
                                                                      _messageProcessor.getMessagingEngineName() },
                                                        null));
            }
        }

        //Get the destinationHandler from the ConsumerDispatcher
        //Note that we know it is PubSub  
        DestinationHandler destination = cd.getDestination();
        SIDestinationAddress destinationAddress = SIMPUtils.createJsDestinationAddress(
                                                                                       destination.getName(),
                                                                                       _messageProcessor.getMessagingEngineUuid());

        //Get the state object representing the subscription from the ConsumerDispatcher
        ConsumerDispatcherState subState = cd.getConsumerDispatcherState();

        ConsumerSessionImpl consumer = null;

        // Synchronize on the close object, we don't want the connection closing
        // while we try to add the subscription.
        synchronized (this)
        {
            // See if this connection has been closed
            checkNotClosed();

            //create the consumer session for this subscription
            try
            {
                consumer =
                                new ConsumerSessionImpl(destination,
                                                destinationAddress,
                                                subState,
                                                this,
                                                enableReadAhead,
                                                false,
                                                unrecoverableReliability,
                                                bifurcatable,
                                                true,
                                                false);
            } catch (SINotPossibleInCurrentConfigurationException e)
            {
                // No FFDC code needed
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "createConsumerSessionForDurableSubscription", "SIErrorException");
                throw new SIErrorException(e);
            } catch (SISessionUnavailableException e)
            {
                // FFDC
                FFDCFilter
                                .processException(
                                                  e,
                                                  "com.ibm.ws.sib.processor.impl.ConnectionImpl.createConsumerSessionForDurableSubscription",
                                                  "1:2129:1.347.1.25",
                                                  this);

                SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                            new Object[] {
                                          "com.ibm.ws.sib.processor.impl.ConnectionImpl",
                                          "1:1809:1.285",
                                          e });

                // This should never be thrown
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "createConsumerSessionForDurableSubscription", "SIErrorException");
                throw new SIErrorException(
                                nls.getFormattedMessage(
                                                        "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                                                        new Object[] {
                                                                      "com.ibm.ws.sib.processor.impl.ConnectionImpl",
                                                                      "1:2146:1.347.1.25",
                                                                      e },
                                                        null),
                                e);
            } catch (SITemporaryDestinationNotFoundException e)
            {
                // FFDC
                FFDCFilter
                                .processException(
                                                  e,
                                                  "com.ibm.ws.sib.processor.impl.ConnectionImpl.createConsumerSessionForDurableSubscription",
                                                  "1:2159:1.347.1.25",
                                                  this);

                SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                            new Object[] {
                                          "com.ibm.ws.sib.processor.impl.ConnectionImpl",
                                          "1:2165:1.347.1.25",
                                          e });

                // This should never be thrown
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "createConsumerSessionForDurableSubscription", "SIErrorException");
                throw new SIErrorException(
                                nls.getFormattedMessage(
                                                        "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                                                        new Object[] {
                                                                      "com.ibm.ws.sib.processor.impl.ConnectionImpl",
                                                                      "1:2176:1.347.1.25",
                                                                      e },
                                                        null),
                                e);
            } catch (SINonDurableSubscriptionMismatchException e)
            {
                SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                            new Object[] {
                                          "com.ibm.ws.sib.processor.impl.ConnectionImpl",
                                          "1:1953:1.347.1.25",
                                          e });

                // This should never be thrown
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "createConsumerSessionForDurableSubscription", "SIErrorException");
                throw new SIErrorException(
                                nls.getFormattedMessage(
                                                        "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                                                        new Object[] {
                                                                      "com.ibm.ws.sib.processor.impl.ConnectionImpl",
                                                                      "1:1964:1.347.1.25",
                                                                      e },
                                                        null),
                                e);
            }

            synchronized (_consumers)
            {
                //store a reference
                _consumers.add(consumer);
            }

            _messageProcessor.addConsumer(consumer);
        }

        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.exit(CoreSPIConnection.tc, "createConsumerSessionForDurableSubscription", consumer);
        return consumer;
    }
358593
public function onFunctionCallExpression($functionDescription, $params) {
        $prefix = $this->_iterName;
        switch ($functionDescription->functionName) {
            case ODataConstants::STRFUN_COMPARE:
                return $prefix.self::STRFUN_COMPARE.self::OPEN_BRAKET.$params[0].self::COMMA.$params[1].self::CLOSE_BRACKET;
                break;
            case ODataConstants::STRFUN_ENDSWITH:
                return $prefix.self::STRFUN_ENDSWITH.self::OPEN_BRAKET.$params[0].self::COMMA.$params[1].self::CLOSE_BRACKET;
                break;
            case ODataConstants::STRFUN_INDEXOF:
                return $prefix.self::STRFUN_INDEXOF.self::OPEN_BRAKET.$params[0].self::COMMA.$params[1].self::CLOSE_BRACKET;
                break;
            case ODataConstants::STRFUN_REPLACE:
                return $prefix.self::STRFUN_REPLACE.self::OPEN_BRAKET.$params[0].self::COMMA.$params[1].self::COMMA.$params[2].self::CLOSE_BRACKET;
                break;
            case ODataConstants::STRFUN_STARTSWITH:
                return $prefix.self::STRFUN_STARTSWITH.self::OPEN_BRAKET.$params[0].self::COMMA.$params[1].self::CLOSE_BRACKET;
                break;
            case ODataConstants::STRFUN_TOLOWER:
                 return $prefix.self::STRFUN_TOLOWER.self::OPEN_BRAKET.$params[0].self::CLOSE_BRACKET;
                break;
            case ODataConstants::STRFUN_TOUPPER:
                return $prefix.self::STRFUN_TOUPPER.self::OPEN_BRAKET.$params[0].self::CLOSE_BRACKET;
                break;
            case ODataConstants::STRFUN_TRIM:
                return $prefix.self::STRFUN_TRIM.self::OPEN_BRAKET.$params[0].self::CLOSE_BRACKET;
                break;
            case ODataConstants::STRFUN_SUBSTRING:
                return $prefix.self::STRFUN_SUBSTRING.self::OPEN_BRAKET.$params[0].self::COMMA.$params[1]
                    .(count($params) == 3 ? (self::COMMA.$params[2]) : '').self::CLOSE_BRACKET;
                break;
            case ODataConstants::STRFUN_SUBSTRINGOF:
                return $prefix.self::STRFUN_SUBSTRINGOF.self::OPEN_BRAKET.$params[0].self::COMMA.$params[1].self::CLOSE_BRACKET;
                break;
            case ODataConstants::STRFUN_CONCAT:
                return $prefix.self::STRFUN_CONCAT.self::OPEN_BRAKET.$params[0].self::COMMA.$params[1].self::CLOSE_BRACKET;
                break; 
            case ODataConstants::STRFUN_LENGTH:
                return $prefix.self::STRFUN_LENGTH.self::OPEN_BRAKET.$params[0].self::CLOSE_BRACKET;
                break;
            case ODataConstants::GUIDFUN_EQUAL:
                return $prefix.self::GUIDFUN_EQUAL.self::OPEN_BRAKET.$params[0].self::COMMA.$params[1].self::CLOSE_BRACKET;
                break;
            case ODataConstants::DATETIME_COMPARE:
//                exit($prefix.self::DATETIME_COMPARE.self::OPEN_BRAKET.$params[0].self::COMMA.$params[1].self::CLOSE_BRACKET);
                return $prefix.self::DATETIME_COMPARE.self::OPEN_BRAKET.$params[0].self::COMMA.$params[1].self::CLOSE_BRACKET;
                break;
            case ODataConstants::DATETIME_YEAR:
                return $prefix.self::DATETIME_YEAR.self::OPEN_BRAKET.$params[0].self::CLOSE_BRACKET;
                break;
            case ODataConstants::DATETIME_MONTH:
                return $prefix.self::DATETIME_MONTH.self::OPEN_BRAKET.$params[0].self::CLOSE_BRACKET;
                break;
            case ODataConstants::DATETIME_DAY:
                return $prefix.self::DATETIME_DAY.self::OPEN_BRAKET.$params[0].self::CLOSE_BRACKET;
                break;
            case ODataConstants::DATETIME_HOUR:
                return $prefix.self::DATETIME_HOUR.self::OPEN_BRAKET.$params[0].self::CLOSE_BRACKET;
                break;
            case ODataConstants::DATETIME_MINUTE:
                return $prefix.self::DATETIME_MINUTE.self::OPEN_BRAKET.$params[0].self::CLOSE_BRACKET;
                break;
            case ODataConstants::DATETIME_SECOND:
                return $prefix.self::DATETIME_SECOND.self::OPEN_BRAKET.$params[0].self::CLOSE_BRACKET;
                break;
            case ODataConstants::MATHFUN_ROUND:
                return $prefix.self::MATHFUN_ROUND.self::OPEN_BRAKET.$params[0].self::CLOSE_BRACKET;
                break;
            case ODataConstants::MATHFUN_CEILING:
                return $prefix.self::MATHFUN_CEILING.self::OPEN_BRAKET.$params[0].self::CLOSE_BRACKET;
                break;
            case ODataConstants::MATHFUN_FLOOR:
                return $prefix.self::MATHFUN_FLOOR.self::OPEN_BRAKET.$params[0].self::CLOSE_BRACKET;
                break;
            case ODataConstants::BINFUL_EQUAL:
                return "($params[0] = $params[1])";
                break;
            case 'is_null':
                return "is_null($params[0])";
                break;

            default:
                throw new \InvalidArgumentException('onFunctionCallExpression');
        }
    }
925330
public static function createByXml(\SimpleXMLElement $xml, \SplPriorityQueue $namespaces = null)
    {
        $type = (string) XmlHelper::get($xml, 'type', 'text');

        if (class_exists($type)) {
            $class = $type;
        } else {
            $class = (string) static::findFieldClass($type, $namespaces);
        }

        if (!class_exists($class)) {
            // Fallback to TextField
            $class = static::$defaultNamespace . '\\TextField';
        }

        return new $class($xml);
    }
423160
public function setSchemaDescription($schemaDescription, $locale = null)
    {
        $this->translate($locale, false)->setSchemaDescription($schemaDescription);
        $this->mergeNewTranslations();

        return $this;
    }
607250
private function createSubscriberDefinition(
        $adapterName,
        $subscriberName,
        $configuration,
        ContainerBuilder $container
    ) {
        $parent = self::createServiceName('subscriber.'.$subscriberName);

        $subscriber = new DefinitionDecorator($parent);
        $subscriber->setClass($container->getDefinition($parent)->getClass());
        $subscriber->addTag(RegisterListenerCompilerPass::SUBSCRIBER_TAG, ['adapter' => $adapterName]);

        switch ($subscriberName) {
            case 'basic_auth':
                $this->configureBasicAuthSubscriberDefinition($subscriber, $configuration, $adapterName, $container);
                break;

            case 'cache':
                $this->configureCacheSubscriberDefinition($subscriber, $configuration, $adapterName, $container);
                break;

            case 'cookie':
                $this->configureCookieSubscriberDefinition($subscriber, $configuration);
                break;

            case 'history':
                $this->configureHistorySubscriberDefinition($subscriber, $configuration);
                break;

            case 'logger':
                $this->configureLoggerSubscriberDefinition($subscriber, $configuration);
                break;

            case 'redirect':
                $this->configureRedirectSubscriberDefinition($subscriber, $configuration, $adapterName, $container);
                break;

            case 'retry':
                $this->configureRetrySubscriberDefinition($subscriber, $adapterName, $container);
                break;

            case 'stopwatch':
                $this->configureStopwatchSubscriberDefinition($subscriber, $configuration);
                break;
        }

        return $subscriber;
    }
849394
public function reactivateSubscription($subscriptionId)
    {
        $requestData = new Reactivate\RequestData($subscriptionId);
        $request = new Reactivate\Request($requestData);

        return $this->sendRequest($request, Reactivate\ApiResponse::class);
    }
905113
public function fromXmlRpcResponse( Response $xmlRpcResponse )
    {
        $response = new HttpResponse();
        $response->setStatusCode( 200 );
        $response->headers->set( 'Content-Type', 'text/xml' );
        $response->setContent( $this->generateXml( $xmlRpcResponse->return ) );
        return $response;
    }
1168606
public static function fromString(string $xml) : DOMDocument
    {
        if (trim($xml) === '') {
            throw InvalidArgumentException::invalidType('non-empty string', $xml);
        }

        $entityLoader = libxml_disable_entity_loader(true);
        $internalErrors = libxml_use_internal_errors(true);
        libxml_clear_errors();

        $domDocument = self::create();
        $options = LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_NONET;
        if (defined('LIBXML_COMPACT')) {
            $options |= LIBXML_COMPACT;
        }

        $loaded = $domDocument->loadXML($xml, $options);

        libxml_use_internal_errors($internalErrors);
        libxml_disable_entity_loader($entityLoader);

        if (!$loaded) {
            $error = libxml_get_last_error();
            libxml_clear_errors();

            throw new UnparseableXmlException($error);
        }

        libxml_clear_errors();

        foreach ($domDocument->childNodes as $child) {
            if ($child->nodeType === XML_DOCUMENT_TYPE_NODE) {
                throw new RuntimeException(
                    'Dangerous XML detected, DOCTYPE nodes are not allowed in the XML body'
                );
            }
        }

        return $domDocument;
    }
379136
function createDescription() {
    $cnt = count( $this->description );
    if( 0 >= $cnt )
      return;
    $descriptions    = null;
    foreach( $this->description as $description ) {
      $attributes    = $this->_createParams( $description['params'], array( 'ALTREP', 'LANGUAGE' ));
      $content       = $this->_strrep( $description['value'] );
      $descriptions .= $this->_createElement( 'DESCRIPTION', $attributes, $content );
    }
    return $descriptions;
  }
606404
public static function fromXML($xml)
    {
        $dom = new DOMDocument();
        $dom->loadXML($xml);
        $xpath = new DOMXPath($dom);
        $xpath->registerNamespace('a', self::getNamespace());
        $response = $xpath->query('//a:CaptureNotification');
        if ($response->length == 1) {
            return 
                new OffAmazonPaymentsNotifications_Model_CaptureNotification(
                    $response->item(0)
                );
        } else {
            throw new Exception(
                "Unable to construct " .
                "OffAmazonPaymentsNotifications_Model_CaptureNotification" .
                "from provided XML. Make sure that CaptureNotification" .
                "is a root element"
            );
        }
    }
251682
public static function create($topicDescriptionXml)
    {
        $topicDescription = new self();
        $root = simplexml_load_string($topicDescriptionXml);
        $topicDescriptionArray = (array) $root;

        if (array_key_exists('DefaultMessageToLive', $topicDescriptionArray)) {
            $topicDescription->setDefaultMessageTimeToLive(
                (string) $topicDescriptionArray['DefaultMessageToLive']
            );
        }

        if (array_key_exists('MaxSizeInMegabytes', $topicDescriptionArray)) {
            $topicDescription->setMaxSizeInMegabytes(
                (int) $topicDescriptionArray['MaxSizeInMegabytes']
            );
        }

        if (array_key_exists(
            'RequiresDuplicateDetection',
            $topicDescriptionArray
        )
        ) {
            $topicDescription->setRequiresDuplicateDetection(
                (bool) $topicDescriptionArray['RequiresDuplicateDetection']
            );
        }

        if (array_key_exists(
            'DuplicateDetectionHistoryTimeWindow',
            $topicDescriptionArray
        )
        ) {
            $topicDescription->setDuplicateDetectionHistoryTimeWindow(
                (string) $topicDescriptionArray['DuplicateDetectionHistoryTimeWindow']
            );
        }

        if (array_key_exists(
            'EnableBatchedOperations',
            $topicDescriptionArray
        )) {
            $topicDescription->setEnableBatchedOperations(
                (bool) $topicDescriptionArray['EnableBatchedOperations']
            );
        }

        return $topicDescription;
    }
1366912
public static function fromSimpleXml($xml, $userId = null)
  {
    $torrent = new NyaaTorrent();
    $torrent->title = (string)$xml->title;
    $torrent->setInfoFromDescription((string)$xml->description);
    $torrent->meta = NyaaMeta::createFromTitle($torrent->title);

    $torrent->torrentUrl = (string)$xml->link;
    $torrent->siteUrl = (string)$xml->guid;
    $torrent->category = (string)$xml->category;
    $torrent->publishDate = \DateTime::createFromFormat('D, d M Y H:i:s T', $xml->pubDate, new \DateTimeZone('UTC'));
    $torrent->userId = $userId;

    return $torrent;
  }