PHP code example of siwayll / kapow

1. Go to this page and download the library: Download siwayll/kapow library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

siwayll / kapow example snippets


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');