2017 © Pedro Peláez
 

library exception-constructor-tools

A simple PHP trait which makes creating static constructors for exceptions nicer.

image

tomphp/exception-constructor-tools

A simple PHP trait which makes creating static constructors for exceptions nicer.

  • Sunday, September 18, 2016
  • by tomphp
  • Repository
  • 1 Watchers
  • 0 Stars
  • 32,857 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 8 % Grown

The README.md

Exception Constructor Tools

Build Status Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

A simple PHP trait which makes creating static constructors for exceptions nicer., (*2)

Installation

$ composer require tomphp/exception-constructor-tools

Usage

Define your exception:, (*3)

<?php

use TomPHP\ExceptionConstructorTools\ExceptionConstructorTools;

class MyExceptionClass extends \RuntimeException
{
    use ExceptionConstructorTools;

    public static function forEntity($entity)
    {
        return self::create(
            'There was an error with an entity of type %s with value of %s.',
            [
                self::typeToString($entity)
                self::valueToString($entity)
            ]
        );
    }
}

Throw your exception:, (*4)

if ($errorOccurred) {
    throw MyExceptionClass::forEntity($entity);
}

The Versions

18/09 2016

dev-master

9999999-dev https://github.com/tomphp/exception-constructor-tools

A simple PHP trait which makes creating static constructors for exceptions nicer.

  Sources   Download

MIT

The Requires

  • php ^5.6|^7.0

 

The Development Requires

exception static constructor

09/09 2016

v1.0.0

1.0.0.0 https://github.com/tomphp/exception-constructor-tools

A simple PHP trait which makes creating static constructors for exceptions nicer.

  Sources   Download

MIT

The Requires

  • php ^5.6|^7.0

 

The Development Requires

exception static constructor

08/09 2016

v0.1.0

0.1.0.0 https://github.com/tomphp/exception-constructor-tools

A simple PHP trait which makes creating static constructors for exceptions nicer.

  Sources   Download

MIT

The Requires

  • php ^5.6|^7.0

 

The Development Requires

exception static constructor