2017 © Pedro PelĂĄez
 

project integer

Lightweight integer container with stand-alone converter

image

granam/integer

Lightweight integer container with stand-alone converter

  • Tuesday, July 10, 2018
  • by jaroslavtyc
  • Repository
  • 1 Watchers
  • 1 Stars
  • 7,468 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 22 Versions
  • 5 % Grown

The README.md

Converter and object wrapper for an integer

Build Status, (*1)

Hint

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

Versions requirements

  • 6.* requires PHP 7.1+ composer require granam/integer:6.*
  • 5.* requires PHP 7.0+ composer require granam/integer:5.*
  • 4.* requires PHP 5.6+ composer require granam/integer:4.*
  • 3.* requires PHP 5.4+ composer require granam/integer:3.*
<?php
use Granam\Integer\IntegerObject;
use Granam\Integer\Tools\Exceptions\WrongParameterType;

$integer = new IntegerObject(12345);

// int(12345)
var_dump($integer->getValue());

$integerFromString = new IntegerObject('124578');
// int(124578)
var_dump($integerFromString->getValue());

$integerFromFloatString = new IntegerObject('987.0');
// int(987)
var_dump($integerFromFloatString->getValue());

try {
    new IntegerObject(987.123);
} catch (WrongParameterType $integerException) {
   // Something get wrong: Some value has been lost on cast. Got '987.456', cast into integer 987
   echo('Something get wrong: ' . $integerException->getMessage() . "\n");
 }

$integerFromTrue = new IntegerObject(true);
// int(1)
var_dump($integerFromTrue->getValue());

$integerFromNull = new IntegerObject(null);
// int(0)
var_dump($integerFromNull->getValue());
// ...

$stringWithAlmostInteger = '0.9999999999999999';
$integerFromStringWithAlmostInteger = new IntegerObject($stringWithAlmostInteger);
// int(1)
var_dump($integerFromStringWithAlmostInteger->getValue());
// int(0) -- because of (int)(float)$value
var_dump((int)$stringWithAlmostInteger);

The Versions

10/07 2018

6.0.x-dev

6.0.9999999.9999999-dev https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

10/07 2018

6.1.0

6.1.0.0 https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

10/07 2018

dev-master

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

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

29/11 2017

6.0.1

6.0.1.0 https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

08/07 2017

6.0.0

6.0.0.0 https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

08/07 2017

3.0.x-dev

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

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

08/07 2017

4.0.x-dev

4.0.9999999.9999999-dev https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

08/07 2017

5.0.x-dev

5.0.9999999.9999999-dev https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

19/02 2017

5.0.3

5.0.3.0 https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

19/02 2017

5.0.2

5.0.2.0 https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

19/02 2017

5.0.1

5.0.1.0 https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

18/02 2017

5.0.0

5.0.0.0 https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

15/02 2017

4.0.0

4.0.0.0 https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

10/09 2015

3.0.3

3.0.3.0 https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

02/09 2015

3.0.2

3.0.2.0 https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

18/08 2015

3.0.1

3.0.1.0 https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

17/08 2015

3.0.0

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

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

03/08 2015

1.0.x-dev

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

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

03/08 2015

2.0.x-dev

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

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

03/08 2015

1.0.2

1.0.2.0 https://github.com/jaroslavtyc/granam-integer

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

03/08 2015

2.0.0

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

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer

21/07 2015

1.0.1

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

Lightweight integer container with stand-alone converter

  Sources   Download

MIT

The Requires

 

The Development Requires

php converter integer