Blame view

helpers/XmlHelper.php 1.04 KB
cfcd8d20   Alexey Boroda   -Yml update 3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  <?php

      

      namespace artweb\artbox\ecommerce\helpers;

      

      use yii\base\Object;

      

      class XmlHelper extends Object

      {

          public static function createElement(string $name, string $value = '', array $attributes = [])

          {

              $element = '<' . $name;

              foreach ($attributes as $key => $attribute) {

                  $element .= ' ' . $key . '="' . $attribute . '"';

              }

              $element .= '>' . $value . '</' . $name . '>';

              return $element;

          }

94580277   Alexey Boroda   -Yaml controller ...
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
      

          public static function createOpeningElement(string $name, array $attributes = [])

          {

              $element = '<' . $name;

              foreach ($attributes as $key => $attribute) {

                  $element .= ' ' . $key . '="' . $attribute . '"';

              }

              $element .= '>';

              return $element;

          }

      

          public static function createClosingElement(string $name)

          {

              $element = '</' . $name . '>';

              return $element;

          }

cfcd8d20   Alexey Boroda   -Yml update 3
34
      }