Created
December 31, 2011 20:56
-
-
Save thiagophx/1545323 to your computer and use it in GitHub Desktop.
Documentator Specification
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 CompaniaAerea | |
{ | |
protected $politicaOverbooking; | |
public function fazReserva(Voo $voo, $numPassageiros) | |
{ | |
if (!$this->politicaOverbooking->permitida($voo, $numPassageiros)) | |
throw new Exception('BLA'); | |
$voo->numPassageiros += $numPassageiros; | |
return true; | |
} | |
} | |
class Voo | |
{ | |
public $capacidadePassageiros = 300; | |
public $numPassageiros = 120; | |
} | |
class PoliticaOverbooking | |
{ | |
public function permitida(Voo $voo, $numPassageiros) | |
{ | |
if (($voo->numPassageiros + $numPassageiros) > ($voo->capacidadePassageiros * 1.1)) | |
return false; | |
return true; | |
} | |
} | |
/* | |
Apartir de um parsing, seria possivel gerar uma documentação assim: | |
Compania Aerea faz reserva se a politica overbooking é permitida | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment