PhpSchool\CliMenu\Dialogue\Dialogue::calculateCoordinates PHP Метод

calculateCoordinates() защищенный Метод

Calculate the co-ordinates to write the messages
protected calculateCoordinates ( )
    protected function calculateCoordinates()
    {
        //y
        $textLines = count(explode("\n", $this->text)) + 2;
        $this->y = ceil($this->parentMenu->getCurrentFrame()->count() / 2) - ceil($textLines / 2) + 1;
        //x
        $parentStyle = $this->parentMenu->getStyle();
        $dialogueHalfLength = (mb_strlen($this->text) + $this->style->getPadding() * 2) / 2;
        $widthHalfLength = ceil($parentStyle->getWidth() / 2);
        $this->x = $widthHalfLength - $dialogueHalfLength;
    }