Skip to content

Instantly share code, notes, and snippets.

@RedDevilHat
Last active February 9, 2017 20:22
Show Gist options
  • Save RedDevilHat/fab22dc4991f9c245a7d67dcab810e04 to your computer and use it in GitHub Desktop.
Save RedDevilHat/fab22dc4991f9c245a7d67dcab810e04 to your computer and use it in GitHub Desktop.
<?php
/**
* Class GovnoCheck
*/
class GovnoCheck
{
private $value;
/**
* GovnoCheck constructor.
* @param $value
*/
public function __construct(bool $value)
{
$this->value = $value;
}
/**
* @return string
*/
public function check() : string
{
switch ($this->value){
case true :
return "1";
break;
case false:
return "0";
break;
default:
return "Kak tak-to?";
break;
}
}
}
/**
* Class CreateBoolTrue
*/
class CreateBoolTrue
{
private $value;
/**
* CreateBoolTrue constructor.
* @param $value
*/
public function __construct(bool $value)
{
$this->value = $this->setTrue($value);
}
/**
* @param bool $value
* @return bool
*/
private function setTrue(bool $value) : bool
{
switch ($value){
case true :
return true;
break;
case false:
die;
break;
default :
die;
}
}
public function get()
{
return $this->value;
}
}
class CreateBoolFalse
{
private $value;
/**
* CreateBoolTrue constructor.
* @param $value
*/
public function __construct(bool $value)
{
$this->value = $this->setFalse($value);
}
/**
* @param bool $value
* @return bool
*/
private function setFalse(bool $value) : bool
{
switch ($value){
case true :
die;
break;
case false:
return false;
break;
default :
die;
}
}
public function get()
{
return $this->value;
}
}
/**
* Class GovnoWorker
*/
class GovnoWorker
{
/**
* @param bool $value
* @return string
*/
public function work(bool $value) : string
{
$dump = '';
switch ($value){
case true :
$createTrue = new CreateBoolTrue($value);
$dump = $createTrue->get();
break;
case false:
$createFalse = new CreateBoolFalse($value);
$dump = $createFalse->get();
break;
default :
die;
}
$check = new GovnoCheck($dump);
return $check->check();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment