WMarkDown/PHP/Abstracts/WMarkDown.Abstracts.Modules.php

52 lines
1.3 KiB
PHP
Raw Permalink Normal View History

<?php
namespace WMarkDown\Abstracts;
abstract class Modules implements \WMarkDown\Interfaces\Modules{
protected $wmarkdown;
protected $more = true;
protected $from = -1;
protected $length = 0;
protected $to = 0;
protected $content = '';
protected $html = '';
protected $matches = null;
public function __construct($wmarkdown){
$this->wmarkdown = $wmarkdown;
}
public function reset(){
$this->more = true;
$this->from = -1;
}
public function set_position($new_position){
$this->from -= $new_position;
$this->to -= $new_position;
}
public function get_position($string){
if($this->from < 0 && $this->more)
$this->get_next_position($string);
return $this->more ? $this->from : null;
}
public function has_more(){return !!$this->more;}
public function get_from(){return 0 | $this->from;}
public function get_length(){return 0 | $this->length;}
public function get_to(){return 0 | $this->to;}
public function get_content(){return "" . $this->content;}
public function get_html(){return "" . $this->html;}
}