2017 © Pedro Peláez
 

library phlist

collection modelled after python's list data type.

image

lucid/phlist

collection modelled after python's list data type.

  • Saturday, November 12, 2016
  • by iwyg
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Python List-Like Data Structure For php.

Author Source Code Software License, (*1)

Build Status Code Coverage, (*2)

Requirements

php >= 7.0master

Installation

$ composer require lucid/phlist

Phlist class

The Phlist class implements a ListInterface and is modelled after pythons list., (*3)

<?php

use Lucid\Phlist\Phlist;

$list = new Phlist('foo', 'bar', ...);

ListInterface API

ListInterface ListInterface::push(mixed $value), (*4)

<?php
$list = new Phlist('foo');
$list->push('bar'); 
$list->toArray(); // => ['foo', 'bar']

ListInterface ListInterface::insert(int $index, mixed $value), (*5)

<?php
$list = new Phlist(1, 2, 3);
$list->insert(1, 1.5); 
$list->toArray(); // => [1, 1.5, 2]

mixed ListInterface::pop(void), (*6)

<?php
$list = new Phlist(1, 2, 3);
$list->pop(); // => 3

ListInterface ListInterface::remove(mixed $value), (*7)

<?php
$list = new Phlist(1, 2, 3);
$list->remove(2); 
$list->toArray(); // [1, 3]

ListInterface ListInterface::sort(callable $sort|null), (*8)

<?php
$list = new Phlist(1, 4, 3, 2);
$list->sort(); 
$list->toArray(); // [1, 2, 3, 4]

$list = new Phlist(1, 4, 3, 2);
$list->sort(function ($a, $b) {
    return $a > $b ? 1 : -1;
}); 
$list->toArray(); // [1, 2, 3, 4]

ListInterface ListInterface::reverse(void), (*9)

<?php
$list = new Phlist(1, 2, 3);
$list->reverse();
$list->toArray(); // =>[3, 2, 1]

ListInterface ListInterface::countValue(mixed $value), (*10)

<?php
$list = new Phlist(1, 2, 3, 4, 2, 5);
$list->countValue(5); // => 1
$list->countValue(2); // => 2

ListInterface ListInterface::extend(ListInterface $list), (*11)

<?php
$listA = new Phlist('a', 'b');
$listB = new Phlist('c', 'd');
$listA->extend($listB);
$listA->toArray() // => ['a', 'b', 'c', 'd'];

The Versions

12/11 2016

dev-master

9999999-dev

collection modelled after python's list data type.

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Avatar iwyg

collection data lists

12/11 2016

v1.0.0

1.0.0.0

collection modelled after python's list data type.

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Avatar iwyg

collection data lists

12/11 2016

dev-develop

dev-develop

collection modelled after python's list data type.

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by Avatar iwyg

collection data lists