Skip to content

Instantly share code, notes, and snippets.

@weburnit
Last active February 14, 2017 09:21
Show Gist options
  • Save weburnit/0b6e80098c28b7bb963d069cd5ef0655 to your computer and use it in GitHub Desktop.
Save weburnit/0b6e80098c28b7bb963d069cd5ef0655 to your computer and use it in GitHub Desktop.
Wizeline Test in PHP
<?php
class Wizeline
{
private $range;
public function __construct(int $range)
{
$this->range = $range;
}
public function printNumbers(int $numbers = null)
{
$numbers = $numbers ?? $this->range;
foreach(range(1, $numers) as $value){
$this->printNumber($value);
}
}
private function printNumber(int $number)
{
if(0 === $number%15){
echo 'WizeLine'. PHP_EOL;
return;
}
if(0 === $number%5){
echo 'Line'. PHP_EOL;
return;
}
if(0 === $number%3){
echo 'Wize'. PHP_EOL;
return;
}
echo $number.PHP_EOL;
}
}
$tellme = new Wizeline(100);
$tellme->printNumbers();
$tellme->printNumbers(200);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment