/** * {@inheritdoc} */ public function shouldSplit(Model $model) { if (trim(substr($model->getText(), 0, $model->getPosition())) === '') { return false; } return true; }
private static function prevCharIsDash(Model $model) { if ($model->getPrevChar() === '-') { $prev2 = $model->getCharPos() - 2; $text = $model->getText(); if ($prev2 > 0 && $text[$prev2] === '-') { return true; } } return false; }
/** * {@inheritdoc} */ public function shouldSplit(Model $model) { $position = $model->getPosition(); $text = $model->getText(); if ($position != 0 && $position < strlen($text) - 1) { $prevChar = substr($text, $position - 1, 1); $nextChar = substr($text, $position + 1, 1); if (is_numeric($prevChar) && is_numeric($nextChar)) { return false; } } return true; }
public function index() { $model = new Model(); $view = new View(); $view->render($model->getText()); }