src/PHPGames/Console/Helper/HAL.php
public function sayHello()
    {
        $text = $this->getHALLogo();

        if ($this->showText) {
            $text .= $this->getHelloDave();
        }

        $lines = explode("\n", $text);

        $spaces = '';
        if ($this->center) {
            $max_length = 0;
            foreach ($lines as $line) {
                $max_length = max($max_length, Helper::strlenWithoutDecoration($this->output->getFormatter(), $line));
            }

            $numberOfSpaces = floor(($this->screenSize[0] - $max_length) / 2);
            if ($numberOfSpaces > 0) {
                $spaces = str_repeat(' ', $numberOfSpaces);
            }
        }

        foreach ($lines as $line) {
            $this->output->writeln($spaces.$line);
        }
    }
public function sayHello()
    {
        $text = $this->getHALLogo();

        if ($this->showText) {
            $text .= $this->getHelloDave();
        }

        $lines = explode("\n", $text);

        $spaces = '';
        if ($this->center) {
            $max_length = 0;
            foreach ($lines as $line) {
                $max_length = max($max_length, Helper::strlenWithoutDecoration($this->output->getFormatter(), $line));
            }

            $numberOfSpaces = floor(($this->screenSize[0] - $max_length) / 2);
            if ($numberOfSpaces > 0) {
                $spaces = str_repeat(' ', $numberOfSpaces);
            }
        }

        foreach ($lines as $line) {
            $this->output->writeln($spaces.$line);
        }
    }
public function sayHello ( ) { $ text = $ this -> getHALLogo ( ) ; if ( $ this -> showText ) { $ text .= $ this -> getHelloDave ( ) ; } $ lines = explode ( "\n" , $ text ) ; $ spaces = '' ; if ( $ this -> center ) { $ max_length = 0 ; foreach ( $ lines as $ line ) { $ max_length = max ( $ max_length , Helper :: strlenWithoutDecoration ( $ this -> output -> getFormatter ( ) , $ line ) ) ; } $ numberOfSpaces = floor ( ( $ this -> screenSize [ 0 ] - $ max_length ) / 2 ) ; if ( $ numberOfSpaces > 0 ) { $ spaces = str_repeat ( ' ' , $ numberOfSpaces ) ; } } foreach ( $ lines as $ line ) { $ this -> output -> writeln ( $ spaces . $ line ) ; } }
Writes HAL Logo
Writes HAL Logo