2017 © Pedro PelĂĄez
 

project boolean

Lightweight boolean container with stand-alone converter

image

granam/boolean

Lightweight boolean container with stand-alone converter

  • Tuesday, July 17, 2018
  • by jaroslavtyc
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6,140 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 3 % Grown

The README.md

Converter and object wrapper for an boolean

Build Status Test Coverage, (*1)

Hint

First of all, make sure you don't need just a simple built-in bool validation ., (*2)

Internally behaves same way as (bool)$value, but, (*3)

  • non-scalar values (arrays, resources, objects without __toString etc.) raises exception
  • objects with __toString magic method are converted to string by that, then to bool
  • null can be rejected by raise of an exception, if desired
<?php
use Granam\Boolean\Boolean;

$booleanFromInteger = new Boolean(12345);
// bool(true)
var_dump($booleanFromInteger->getValue());

$booleanFromString = new Boolean('124578');
// bool(true)
var_dump($booleanFromString->getValue());

$booleanFromFloatString = new Boolean('987.654');
// bool(true)
var_dump($booleanFromFloatString->getValue());

$booleanFromZero = new Boolean(0);
// bool(false)
var_dump($booleanFromZero->getValue());

$booleanFromNull = new Boolean(null, false /* not strict */);
// bool(false)
var_dump($booleanFromNull->getValue());
// ...

// exception is raised (\Granam\Boolean\Tools\Exceptions\WrongParameterType)
new Boolean(null); // implicitly strict - NULL is "unknown" state and therefore forbidden

The Versions

17/07 2018

dev-master

9999999-dev https://github.com/jaroslavtyc/granam-boolean

Lightweight boolean container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter boolean

17/07 2018

3.1.x-dev

3.1.9999999.9999999-dev https://github.com/jaroslavtyc/granam-boolean

Lightweight boolean container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter boolean

17/07 2018

3.1.0

3.1.0.0 https://github.com/jaroslavtyc/granam-boolean

Lightweight boolean container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter boolean

08/05 2018

3.0.x-dev

3.0.9999999.9999999-dev https://github.com/jaroslavtyc/granam-boolean

Lightweight boolean container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter boolean

08/05 2018

3.0.0

3.0.0.0 https://github.com/jaroslavtyc/granam-boolean

Lightweight boolean container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter boolean

19/02 2017

2.0.x-dev

2.0.9999999.9999999-dev https://github.com/jaroslavtyc/granam-boolean

Lightweight boolean container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter boolean

19/02 2017

2.0.1

2.0.1.0 https://github.com/jaroslavtyc/granam-boolean

Lightweight boolean container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter boolean

18/02 2017

2.0.0

2.0.0.0 https://github.com/jaroslavtyc/granam-boolean

Lightweight boolean container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter boolean

02/11 2015

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/jaroslavtyc/granam-boolean

Lightweight boolean container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter boolean

02/11 2015

1.0.1

1.0.1.0 https://github.com/jaroslavtyc/granam-boolean

Lightweight boolean container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter boolean

02/11 2015

1.0.0

1.0.0.0 https://github.com/jaroslavtyc/granam-boolean

Lightweight boolean container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter boolean