2017 © Pedro Peláez
 

library preconditions

Preconditions for PHP

image

mehr-als-nix/preconditions

Preconditions for PHP

  • Sunday, December 6, 2015
  • by siad007
  • Repository
  • 2 Watchers
  • 1 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Preconditions

Build Status, (*1)

Preconditions are meant to be an alternative way to ensure that a precondition for a specific method is given., (*2)

Available checks

  • checkArgument()
  • checkArgNotNull()
  • checkNotNull()
  • checkElementIndex()
  • checkPositionIndex()
  • checkPositionIndexes()
  • checkState()
  • checkValue()

Additional exceptions

  • IndexOutOfBoundsException
  • NullPointerException
  • IllegalStateException

Example

Instead of writing, (*3)

    if ($count <= 0) {
        throw new \InvalidArgumentException("must be positive: " . $count);
    }

you could use a precondition like, (*4)

    use \MehrAlsNix\Preconditions\PreconditionUtil;
    //...
    PreconditionUtil::checkArgument($count <= 0, 'must be positive: %s', $count);

The Versions

06/12 2015

dev-develop

dev-develop http://mehralsnix.github.io/Preconditions/

Preconditions for PHP

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Siad Ardroumli

15/11 2015

dev-master

9999999-dev http://mehralsnix.github.io/Preconditions/

Preconditions for PHP

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Siad Ardroumli

15/11 2015

v0.0.3

0.0.3.0 http://mehralsnix.github.io/Preconditions/

Preconditions for PHP

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Siad Ardroumli

01/11 2015

v0.0.2

0.0.2.0 http://mehralsnix.github.io/Preconditions/

Preconditions for PHP

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Siad Ardroumli

31/10 2015

v0.0.1

0.0.1.0

Preconditions for PHP

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Siad Ardroumli