Last active
February 9, 2017 20:22
-
-
Save RedDevilHat/fab22dc4991f9c245a7d67dcab810e04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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