2017 © Pedro Peláez
 

library ibm-data-struct

A quick library for creating string length data structures to communicate with IBM services

image

rtablada/ibm-data-struct

A quick library for creating string length data structures to communicate with IBM services

  • Wednesday, February 12, 2014
  • by rtablada
  • Repository
  • 1 Watchers
  • 0 Stars
  • 26 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

IBM Data Struct Library

When communicating with IBM based web services you may be required to create data structures represented by strings of varied lengths. This can be a bit tedious to have to remember string lengths and various requirements and create these data structures from varied inputs., (*1)

This library gives you a simple API for creating these structures in a manageable and configurable way., (*2)

Installation

This library can be installed using composer and requiring rtablada/ibm-data-struct., (*3)

Use

To create a data structure and get the string representation you just need to pass a set of input values and rules to create the structure. The rules will be parsed in order to create the string. If a rule is not defined as a map, then the default mutation of length will be used., (*4)

$values = [
    'name_long' => 'Ryan Tablada',
    'name_short' => 'Ryan Tablada',
];

$rules = [
    'name_short' => 22, // Pad length to take up 22 chars
    'name_long' => ['length' => 10], // Trim to 10 chars
];

$structure = new Rtablada\IbmDataStruct\IbmStructBuilder($values, $rules);

$stringValue = (string) $structure;
$stringValue = $structure->getString();

The Versions

12/02 2014

dev-master

9999999-dev

A quick library for creating string length data structures to communicate with IBM services

  Sources   Download

MIT