siwayll/kapow

定制异常的简单基础

1.2 2017-12-28 11:29 UTC

This package is not auto-updated.

Last update: 2024-09-15 04:42:12 UTC


README

Kapow !

FOSSA Status Build Status Coverage Status

包含变量的简单异常。

快速示例

创建异常

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 new DodgeSpecialAttack($villan, $hero, 'ultra smash 2');

贡献

  • 分支它!
  • 创建你的功能分支:git checkout -b my-new-feature
  • 提交你的更改:git commit -am '添加一些功能'
  • 推送到分支:git push origin my-new-feature
  • 提交拉取请求

运行测试

make install
./bin/atoum

许可证

MIT

FOSSA Status