/JUI/Components/Converters/Substr.php
PHP | 26 lines | 15 code | 6 blank | 5 comment | 1 complexity | f119546a10e2c105b9ce5f47c2defe76 MD5 | raw file
- <?php
- /**
- * @author Jakub Kuritka <jakub.kuritka@outlook.com>
- * @copyright (c) 2012, Jakub Kuritka
- * @license LGPL
- */
- namespace JUI\Components;
- class Substr extends Component implements IConverter {
- public function __construct(){
- parent::__construct();
- $this->dp("start");
- $this->dp("length");
- }
- public function convert($data){
- if(!is_numeric($this->length))
- return substr($data, (int)$this->start);
- return substr($data, (int)$this->start, (int)$this->length);
- }
- }
- ?>