PHP Classes

File: docs/AsittagSummary.md

Recommend this page to a friend!
  Classes of Kjell-Inge Gustafsson   Asit PHP Collection Class   docs/AsittagSummary.md   Download  
File: docs/AsittagSummary.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: Asit PHP Collection Class
Manages collections of elements stored in arrays
Author: By
Last change: 1.4.10
Date: 4 years ago
Size: 5,979 bytes
 

Contents

Class file image Download

[comment]: # (This file is part of Asit, manages array collections. Copyright 2020 Kjell-Inge Gustafsson, kigkonsult, All rights reserved, licence LGPL 3.0)

Asittag/Asmittag Summary

> Class Asittag * extends [Asit] * (unique) primary key for each collection element

> Class Asmittag * extends [Asmit] * accepts multiple (unique) primary keys for (each) collection element

Also secondary keys, additional (non-unique) tags (aka attributes?) may be set for each element. Tags are of int or string valueType.

Collection elements are searchable using * Iterator (et al.) methods * primary key(s) * tag(s) * primary key(s) + tag(s)

For non-assoc arrays, * primary key is the (numeric) array index * may also have tags

Asittag class extends : * [AsittagList], assert collection elements of expected valueType

Asmittag class extends : * [AsmittagList], assert collection elements of expected valueType

Inherited methods

Inherited methods from [It] - [Asit]

Pkey - Tag methods

* Return all primary keys, primary keys for collection elements using tag or empty array on not found
* Override parent
* ```tag``` _int_|_string_
* ```sortFlag``` _int_ default _SORT_REGULAR_
* Return _array_

  • Return all tags, tags for one collection element using the primary key or empty array on not found
  • 
    
  • Return _array_
* Return tags for one collection element using the primary key or empty array on not found
* Convenient getTags method alias
* ```pKey``` _int_|_string_
* ```sortFlag``` _int_ default _SORT_REGULAR_
* Return _array_

  • Return bool true if element (identified by pKey) has tag(s), not found pKey/tag return false
  • 
    
  • Return _bool_

Tag methods

* Assert tag, int and string allowed
* ```tag``` _mixed_
* Return _void_
* Throws TagException
* Static

  • Return bool true if single or any tag in array are set
  • 
    
  • Return _bool_
* Return tags for ```current```
* Return _array_
* Throws RuntimeException

  • Return bool true if ```current``` has tag(s)
  • 
    
  • Return _bool_
  • Throws RuntimeException
* Return count of collection element using the tag, not found return 0
* ```tag``` _int_|_string_
* Return _bool_

#### Get methods

  • Return (non-assoc) array of element(s) in collection, opt using primary keys and/or tag(s)
  • If primary keys are given, the return collection element includes only these matching the primary keys.
  • Then, and if tags are given and if union is bool true, the result collection element hits match all tags, false match any tag.
  • Hits with exclTags are excluded
  • Override parent
  • 
    
  • 
    
  • 
    
  • Return _array_
  • Throws SortException
* Return (non-assoc array) sub-set of element(s) in collection using tags
* If union is bool true, the result collection element hits match all tags, false match any tag.
* Convenient get method alias
* ```tags``` _int_|_string_|_array_   none-used tag is skipped
* ```union``` _bool_ default true
* ```exclTags``` _int_|_string_|_array_ tags to exclude
* ```sortParam``` _int_|_callable_  asort sort_flags or uasort callable
* Return _array_
* Throws SortException

#### Set methods

  • Append element to (array) collection, opt with primary key and/or tags (secondary keys)
  • Note, last appended element is always ```current```
  • Override parent
  • 
    
  • 
    
  • Return _static_
  • Throws PkeyException, TagException
* Add tag (secondary key) for primary key element
* ```pKey``` _int_|_string_
* ```tag``` _int_|_string_
* Return _static_
* Throws PkeyException, TagException

  • Add tag (secondary key) for ```current```
  • 
    
  • Return _static_
  • Throws RuntimeException, TagException

Remove methods

* Remove tag (secondary key) for primary key element
* ```pKey``` _int_|_string_
* ```tag``` _int_|_string_
* Return _static_
* Throws PkeyException

  • Remove tag (secondary key) for ```current```
  • 
    
  • Return _static_
  • Throws RuntimeException

Current element tag methods summary

* Return bool true if ```current``` has tag(s)
* Throws RuntimeException

  • Add tag (secondary key) for ```current```
  • Throws RuntimeException, TagException
* Remove tag (secondary key) for ```current```
* Throws RuntimeException

  • Append element to (array) collection, with primary key and/or tags (secondary keys)
  • Note, last appended element is always ```current```
  • Throws PkeyException, TagException

Go to [README] - [It] summary - [Asit] / [Asmit] summary - [AsittagList] / [AsmittagList] summary

[It]:ItSummary.md [Asit]:AsitSummary.md [Asmit]:AsitSummary.md [AsittagList]:ListSummary.md [AsmittagList]:ListSummary.md [README]:../README.md