PageRenderTime 38ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/Haanga/Extension/Filter/Substr.php

https://github.com/djanku/Haanga-web
PHP | 16 lines | 15 code | 1 blank | 0 comment | 3 complexity | b0ea7ff4b2895ef3a1dd3ce02cfcb6ca MD5 | raw file
  1. <?php
  2. class Haanga_Extension_Filter_Substr
  3. {
  4. public static function generator($compiler, $args)
  5. {
  6. if (count($args) != 2) {
  7. $cmp->Error("substr parameter must have one param");
  8. }
  9. if (!isset($args[1]['string'])) {
  10. $cmp->Error("substr parameter must be a string");
  11. }
  12. list($start, $end) = explode(",", $args[1]['string']);
  13. return hexec('substr', $args[0], (int)$start, (int)$end);
  14. }
  15. }