Skip to content

dmelin/php-tantrum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tantrum

The throwable with the energy of a 6 year old.

Installation

composer require dmelin/tantrum

Usage

use DMelin\Tantrum\Tantrum;

throw new Tantrum('cant open file.', 2);

Output:

CANT. OPEN. FILE!

Rage Levels

Tantrum accepts a rage level from 1 to 3. Values outside this range are clamped. Default rage is 1.

Rage 1

throw new Tantrum('cant open file.', 1);
CANT OPEN FILE!

Rage 2

throw new Tantrum('cant open file.', 2);
CANT. OPEN. FILE!

Rage 3

throw new Tantrum('cant open file.', 3);
٩(ఠ益ఠ)۶ CANT! OPEN! FILE!!!

Behavior

  • Messages are converted to uppercase
  • Periods become exclamation marks
  • Rage 2 replaces spaces with .
  • Rage 3 replaces spaces with ! and triples the final exclamation marks
  • Extends RuntimeException and can be caught as such
  • Supports exception chaining via the optional third parameter

Testing

composer install
vendor/bin/phpunit

License

MIT

About

The throwable with the energy of a 6 year old.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages