PageRenderTime 892ms CodeModel.GetById 37ms RepoModel.GetById 6ms app.codeStats 0ms

/JUI/Components/Converters/Substr.php

https://bitbucket.org/kuritkaj/php_jui_git
PHP | 26 lines | 15 code | 6 blank | 5 comment | 1 complexity | f119546a10e2c105b9ce5f47c2defe76 MD5 | raw file
  1. <?php
  2. /**
  3. * @author Jakub Kuritka <jakub.kuritka@outlook.com>
  4. * @copyright (c) 2012, Jakub Kuritka
  5. * @license LGPL
  6. */
  7. namespace JUI\Components;
  8. class Substr extends Component implements IConverter {
  9. public function __construct(){
  10. parent::__construct();
  11. $this->dp("start");
  12. $this->dp("length");
  13. }
  14. public function convert($data){
  15. if(!is_numeric($this->length))
  16. return substr($data, (int)$this->start);
  17. return substr($data, (int)$this->start, (int)$this->length);
  18. }
  19. }
  20. ?>