Example #1
0
 /**
  * @param $arguments
  * @return mixed
  * @throws \Genkgo\Xsl\Schema\Exception\UnknownSequenceItemException
  */
 public static function call(...$arguments)
 {
     return XsSequence::fromArray($arguments);
 }
Example #2
0
 /**
  * @param $elements
  * @param $position
  * @param null $length
  * @return XsSequence
  * @throws \Genkgo\Xsl\Schema\Exception\UnknownSequenceItemException
  */
 public static function subsequence($elements, $position, $length = null)
 {
     return XsSequence::fromArray(array_slice($elements, $position - 1, $length));
 }
Example #3
0
 /**
  * @param $haystack
  * @param $needle
  * @return bool|int
  */
 public static function indexOf($haystack, $needle)
 {
     if (is_string($haystack)) {
         $position = strpos($haystack, $needle);
         if ($position === false) {
             return false;
         }
         return $position + 1;
     }
     $index = 1;
     $sequence = XsSequence::fromArray($haystack);
     foreach ($sequence->documentElement->childNodes as $childNode) {
         if ($needle === $childNode->nodeValue) {
             return $index;
         }
         $index++;
     }
     return false;
 }
Example #4
0
File: Text.php Project: Samshal/xsl
 /**
  * @param $elements
  * @return DOMDocument
  */
 public static function inScopePrefixes($elements)
 {
     Assert::assertArray($elements);
     $listOfPrefixes = [];
     foreach ($elements as $element) {
         $listOfPrefixes = array_merge($listOfPrefixes, array_keys(FetchNamespacesFromNode::fetch($element)));
     }
     return XsSequence::fromArray($listOfPrefixes);
 }
Example #5
0
 /**
  * @param $first
  * @param $last
  * @return mixed
  * @throws \Genkgo\Xsl\Schema\Exception\UnknownSequenceItemException
  */
 public static function call($first, $last)
 {
     return XsSequence::fromArray(range($first, $last));
 }