siwayll / kapow
simple base for customizing exceptions
1.2
2017-12-28 11:29 UTC
Requires
- php: >=7.1
Requires (Dev)
- atoum/atoum: 3.2.*
- atoum/bdd-extension: ^2.1
- atoum/stubs: ^2.5
- phpmd/phpmd: ^2.6
- squizlabs/php_codesniffer: ^3.2
This package is not auto-updated.
Last update: 2024-12-22 06:26:28 UTC
README
Kapow !
Simple exception with variables in it.
Quick examples
Create an Exception
use Siwayll\Kapow\Exception as Kapow; use Siwayll\Kapow\Level; ... class DodgeSpecialAttack extends Kapow { protected $superVillain; protected $superHero; protected $specialAttack; /** * Message of the exception */ public $message = 'The super villain {superVillain} has dodge {superHero} super hero special attack {specialAttack}'; public $code = Level::CRITICAL; public function __construct(Mutant $superVillain, Mutant $superHero, string $specialAttack) { $this->superVillain = $superVillain->getName(); $this->superHero = $superHero->getName(); $this->specialAttack = $specialAttack; } }
Throw it !
throw new DodgeSpecialAttack($villan, $hero, 'ultra smash 2');
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
Running the tests
make install ./bin/atoum
License
MIT