Skip to content

Commit

Permalink
The third year
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesChou committed Nov 7, 2021
1 parent 9a48aaf commit c034a92
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions helloworld.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,60 @@
* Used to display the phrase "Hello World!" in a console.
*
* @author Miles
* @license MIT
* @version 1.2
* @see echo
* @see README
* @todo Create factory methods
* @link https://github.com/MilesChou/helloworld
*/
class HelloWorld
{
/**
* The phrase to display in the console
* The default phrase to display in the console
*/
public const PHRASE = 'Hello World!';

/**
* Main method
* The phrase to display in the console
*/
private $hello_world;

/**
* Constructor
*
* @param string $hw The phrase to display in the console
*/
public function __construct(string $hw)
{
$this->hello_world = $hw;
}

/**
* Display the phrase "Hello World!" in a console
*
* @return void
*/
public static function main(): void
public function sayPhrase(): void
{
// Displays our phrase in a console.
echo self::PHRASE;
echo $this->hello_world;
}

/**
* Main method
*
* @return void
*/
public static function main()
{
$hw = new self(self::PHRASE);

try {
$hw->sayPhrase();
} catch (Exception $e) {
// Do nothing!
}
}
}

Expand Down

0 comments on commit c034a92

Please sign in to comment.