Output/Element.php
/**
     * Renders element in termminal if it has changed.
     *
     * @access public
     * @return void
     */
Renders element in termminal if it has changed.
@access public
@return void
Renders element in termminal if it has changed . @access public @return void
public function render($force = false)
    {
        if (!$force && !$this->_hasChanges) {
            return;
        }
        $this->_beforeRender();
        $output = $this->getOutput();
        $width  = $this->getWidth();
        $height = $this->getHeight();
        $row = $this->_getStartRow($height);
        foreach ($this->_text as $line) {
            $len = mb_strlen($line['text']);
            $line = $this->_prepareLine($line);
            $col = $this->_getStartCol($len, $width);
            if ($row !== false) {
                $output->setPos($row, $col);
                echo $line;
                $row++;
            } else {
                $output->setCol($col);
                echo $line . "\n";
            }
        }
        $this->_hasChanges = false;
        return $this;
    }
public function render ( $ force = false ) { if ( ! $ force && ! $ this -> _hasChanges ) { return ; } $ this -> _beforeRender ( ) ; $ output = $ this -> getOutput ( ) ; $ width = $ this -> getWidth ( ) ; $ height = $ this -> getHeight ( ) ; $ row = $ this -> _getStartRow ( $ height ) ; foreach ( $ this -> _text as $ line ) { $ len = mb_strlen ( $ line [ 'text' ] ) ; $ line = $ this -> _prepareLine ( $ line ) ; $ col = $ this -> _getStartCol ( $ len , $ width ) ; if ( $ row !== false ) { $ output -> setPos ( $ row , $ col ) ; echo $ line ; $ row ++ ; } else { $ output -> setCol ( $ col ) ; echo $ line . " \n " ; } } $ this -> _hasChanges = false ; return $ this ; }
Renders element in termminal if it has changed.
Renders element in termminal if it has changed .