2017 © Pedro PelĆ”ez
 

library iterators

tools ala iterators

image

h4kuna/iterators

tools ala iterators

  • Tuesday, January 3, 2017
  • by h4kuna
  • Repository
  • 2 Watchers
  • 4 Stars
  • 897 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

Moved to h4kuna/data-type

h4kuna\iterators

Downloads this Month Latest Stable Version Total Downloads License, (*1)

Best way to install h4kuna\iterators is using composer., (*2)

$ composer require h4kuna/iterators

TextIterator

Read the text line by line., (*3)

$incomingString = "  foo

bar
joe";

$textIterator = new TextIterator($incomingString);
$textIterator->setFlags($textIterator::SKIP_EMPTY_LINE | $textIterator::TRIM_LINE);
foreach($textIterator as $line) {
    echo $line;
}
/*
 * output will be trimed
foo
bar
joe
*/

FlattenArrayIterator

Make one level array from multidimensional with to use delimiter for join keys., (*4)

use h4kuna\Iterators\FlattenArrayRecursiveIterator;

$input = [
    'address' => [
        'street' => 'foo',
        'zip' => 29404,
        'c' => [
            'p' => '5',
            'e' => 10.6,
        ],
    ],
    'main' => ['a', 'b', 'c'],
    'email' => 'exampl@foo.com',
];

$iterator = new FlattenArrayRecursiveIterator($input, '%');
$output = [];
foreach ($iterator as $key => $item) {
    $output[$key] = $item;
}

// output is
// [
//    'address%street' => 'foo',
//    'address%zip' => 29404,
//    'address%c%p' => '5',
//    'address%c%e' => 10.6,
//    'main%0' => 'a',
//    'main%1' => 'b',
//    'main%2' => 'c',
//    'email' => 'exampl@foo.com',
// ]

PeriodDayFactory

Iterate between dates by days. A time is reset to midnight., (*5)

use h4kuna\Iterators\PeriodDayFactory;
$endDate = new \DateTime('1996-04-09 08:00:00');
$period = PeriodDayFactory::createExFromInTo(new \DateTime('1989-02-01 07:00:00'), $endDate);

foreach ($period as $date) {
    // first date is 1989-02-02
    // last date is 1996-04-09
}

The Versions

03/01 2017

dev-master

9999999-dev https://github.com/h4kuna/iterators

tools ala iterators

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Milan Matějček

03/01 2017

v1.2.2

1.2.2.0 https://github.com/h4kuna/iterators

tools ala iterators

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Milan Matějček

23/12 2015

v1.2.1

1.2.1.0 https://github.com/h4kuna/iterators

tools ala iterators

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Milan Matějček

21/06 2015

v1.2.0

1.2.0.0 https://github.com/h4kuna/iterators

tools ala iterators

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Milan Matějček

14/01 2015

v1.1.0

1.1.0.0 https://github.com/h4kuna/iterators

tools ala iterators

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Milan Matějček

14/01 2015

dev-php-unit

dev-php-unit https://github.com/h4kuna/iterators

tools ala iterators

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Milan Matějček

03/04 2013

v1.0.6

1.0.6.0 https://github.com/h4kuna/iterators

tools ala iterators

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

by Milan Matějček

21/02 2013

v1.0.5

1.0.5.0 https://github.com/h4kuna/iterators

tools ala iterators

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

by Milan Matějček

24/01 2013

v1.0.4

1.0.4.0 https://github.com/h4kuna/iterators

tools ala iterators

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

by Milan Matějček

27/10 2012

v1.0.2

1.0.2.0 https://github.com/h4kuna/iterators

tools ala iterators

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

by Milan Matějček

12/10 2012

v1.0.1

1.0.1.0 https://github.com/h4kuna/iterators

lock thred

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

by Milan Matějček

12/10 2012

v1.0.0

1.0.0.0 https://github.com/h4kuna/text-iterator

lock thred

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

by Milan Matějček