Deserialize a PlayReadyLicenseResponseTemplate xml into a PlayReadyLicenseResponseTemplate object.

@param string $template Array containing values for object properties

@return PlayReadyLicenseResponseTemplate
557551
public static function deserialize($template)
    {
        $xml = simplexml_load_string($template);
        $result = new PlayReadyLicenseResponseTemplate();

        // Validation
        if ($xml->getName() !== 'PlayReadyLicenseResponseTemplate') {
            throw new \RuntimeException("This is not a PlayReadyLicenseResponseTemplate, it is a '{$xml->getName()}'");
        }
        if (!isset($xml->LicenseTemplates)) {
            throw new \RuntimeException(
                "The PlayReadyLicenseResponseTemplate must contains an 'LicenseTemplates' element"
            );
        }

        // decoding
        $result->setLicenseTemplates(self::deserializeLicenseTemplates($xml->LicenseTemplates));

        if (isset($xml->ResponseCustomData)) {
            $result->setResponseCustomData((string) $xml->ResponseCustomData);
        }

        self::ValidateLicenseResponseTemplate($result);

        return $result;
    }
827298
protected function mapProperty(array $template = [], $props = [])
    {
        // No values set
        if (is_array($props) === false) {
            return null;
        }

        foreach($template as $key => $value) {
            if ($key[0] !== '@') {
                $template[$key] = $this->getArrValue($props, $key, '');
            }
        }

        return array_filter($template);
    }
200649
protected function copyTemplate($template, $dest)
    {
        $source = __DIR__.'/../../templates/'.$template;
        if (file_exists($source)) {
            return file_put_contents($dest, file_get_contents($source));
        }
    }
624329
private function buildParts($template)
    {
        $template[0] = str_replace([
            '$NAMESPACE$',
            '$CLASS$',
            '$RULES$'
        ], [
            $this->namespace,
            'Create' . $this->className,
            $this->buildRules(0),
        ], $template[0]);

        $template[1] = str_replace([
            '$NAMESPACE$',
            '$CLASS$',
            '$RULES$'
        ], [
            $this->namespace,
            'Update' . $this->className,
            $this->buildRules(1),
        ], $template[1]);

        return $template;
    }
778777
public function setLayout( $template )
	{
		$template = str_replace( get_stylesheet_directory().'/templates/', '', $template );
		$this->template = UtilityFacade::trimRight( $template, '.php' );
		return $this->get( apply_filters( 'castor/templates/layout', 'layouts/default' ));
	}
837038
public function getTemplateQuery($template)
    {
        if(isset($this->template[$template]))
        {
            return $this->template[$template];
        }

        return FALSE;
    }
675466
public function publish($template): string
    {
        $template = $template instanceof Template ? $template : Template::fromArray($template);

        $response = $this->client->publishTemplate($template);

        $etag = $response->getHeader('ETag');

        return array_shift($etag);
    }
276190
protected function load($template){
		$template = get_stylesheet_directory()."/templates/admin/{$template}.php";
		/**
		 * wpametu_admin_screen_template
		 *
		 * @param string $template
		 * @param string $class_name
		 * @return string
		 */
		$template = apply_filters('wpametu_admin_screen_template', $template, get_called_class());
		if( file_exists($template) ){
			include $template;
		}
	}
1292625
protected function getTemplate($template)
    {
        $source = __DIR__.'/../../templates/'.$template;
        return file_exists($source) ? file_get_contents($source) : null;
    }
966833
public function serialize(Template $template, array $options = [])
    {
        $serialized = [
            'id' => $template->getUuid(),
            'name' => $template->getName(),
            'type' => $this->serializer->serialize($template->getType()),
            'title' => $template->getTitle(),
            'content' => $template->getContent(),
            'lang' => $template->getLang(),
            'localized' => $this->serializeLocalized($template),
        ];

        return $serialized;
    }
502877
protected function resolveTemplate($template)
    {
        if (!$this->pathCache[$template]) {

            foreach (array_reverse($this->templateDirs) as $dir) {
                $path = $dir . DIRECTORY_SEPARATOR . $template .'.'. $this->getFileExtension();
                if (is_readable($path)) {
                    $this->pathCache[$template] = $path;
                    break;
                }
            }

        }

        return $this->pathCache[$template];
    }
1333263
public function render($template = '')
    {
        $result = $template;
        if (is_array($template) || is_object($template)) {
            // Recursively go down into an object/array to tokenize.
            foreach ($result as &$val) {
                $val = $this->render($val);
            }
        } elseif (
            is_string($template)
            && strlen($template) >= self::TEMPLATE_MIN_LENGTH
            && false !== strpos($template, self::TOKEN_KEY_START)
            && false !== strpos($template, self::TOKEN_KEY_END)
        ) {
            if (isset($this->renderCache[$template])) {
                // Already tokenized this exact string.
                $result = $this->renderCache[$template];
            } else {
                // A new or non-tokenized string.
                $this->lastTemplate = $template;
                set_error_handler([$this, 'handleMustacheErrors'], E_WARNING | E_NOTICE);
                $result = $this->engine->render($template, $this->context);
                restore_error_handler();
                if (null !== $result && '' !== $result) {
                    // Store the result in cache for faster lookup later.
                    $this->renderCache[$template] = $result;
                }
            }
        }

        return $result;
    }
321115
public function resolve($template)
    {
        if (! isset($this->templates[$template])) {
            throw new UnexpectedValueException(sprintf(
                'Unexpected template name "%s" provided.',
                is_string($template) ? $template : gettype($template)
            ));
        }

        return $this->templates[$template];
    }
156846
public function setTemplate($template)
    {
        if (is_readable($template) === false) {
            throw new RuntimeException("Unable to read template file “{$template}”.");
        }

        $this->template = $template;

        return $this;
    }
534368
public function setTemplate($template)
    {
        if (!(is_string($template) || $template instanceof TemplateReferenceInterface)) {
            throw new \InvalidArgumentException('The template should be a string or implement TemplateReferenceInterface');
        }
        $this->template = $template;

        return $this;
    }
522291
private function loadTemplate($template)
    {
        if (!array_key_exists($template, $this->templateCache)) {
            $this->templateCache[$template] = $this->twig->loadTemplate($template);
        }

        return $this->templateCache[$template];
    }
460409
private static function deserializePlayReadyLicenseTemplate($xmlElement)
    {
        if (!isset($xmlElement->PlayRight)) {
            throw new \RuntimeException("The PlayReadyLicenseTemplate must contains an 'PlayRight' element");
        }

        if (!isset($xmlElement->ContentKey)) {
            throw new \RuntimeException("The PlayReadyLicenseTemplate must contains an 'ContentKey' element");
        }

        $result = new PlayReadyLicenseTemplate();

        if (isset($xmlElement->AllowTestDevices)) {
            $result->setAllowTestDevices($xmlElement->AllowTestDevices == 'true');
        }

        if (isset($xmlElement->BeginDate)) {
            if (isset($xmlElement->BeginDate->attributes(Resources::XSI_XML_NAMESPACE)->nil) &&
                $xmlElement->BeginDate->attributes(Resources::XSI_XML_NAMESPACE)->nil == 'true') {
                $result->setBeginDate(null);
            } else {
                $result->setBeginDate(new \DateTime((string) $xmlElement->BeginDate));
            }
        }

        if (isset($xmlElement->ExpirationDate)) {
            if (isset($xmlElement->ExpirationDate->attributes(Resources::XSI_XML_NAMESPACE)->nil) &&
               $xmlElement->ExpirationDate->attributes(Resources::XSI_XML_NAMESPACE)->nil == 'true') {
                $result->setExpirationDate(null);
            } else {
                $result->setExpirationDate(new \DateTime((string) $xmlElement->setExpirationDate));
            }
        }

        if (isset($xmlElement->RelativeBeginDate)) {
            $result->setRelativeBeginDate(new \DateInterval((string) $xmlElement->RelativeBeginDate));
        }

        if (isset($xmlElement->RelativeExpirationDate)) {
            $result->setRelativeExpirationDate(new \DateInterval((string) $xmlElement->RelativeExpirationDate));
        }

        if (isset($xmlElement->GracePeriod)) {
            $result->setGracePeriod(new \DateInterval((string) $xmlElement->GracePeriod));
        }

        $result->setPlayRight(self::deserializePlayReadyPlayRight($xmlElement->PlayRight));

        if (isset($xmlElement->LicenseType)) {
            $result->setLicenseType((string) $xmlElement->LicenseType);
        }

        $result->setContentKey(self::deserializePlayReadyContentKey($xmlElement->ContentKey));

        return $result;
    }