apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: Net_HL7_Segment

Source Location: /Net_HL7-0.1.1/Net/HL7/Segment.php

Class Overview




Methods


Child classes:

Net_HL7_Segments_MSH
MSH (message header) segment class

Inherited Variables

Inherited Methods


Class Details

[line 21]


[ Top ]


Method Detail

Net_HL7_Segment (Constructor)   [line 53]

Net_HL7_Segment Net_HL7_Segment( mixed $name, [array $fields = array()])

Create an instance of this segment. A segment may be created with just

a name or a name and a reference to an array of field values. If the name is not given, no segment is created. The segment name should be three characters long, and upper case. If it isn't, no segment is created, and undef is returned. If a reference to an array is given, all fields will be filled from that array. Note that for composed fields and subcomponents, the array may hold subarrays and subsubarrays. Repeated fields can not be supported the same way, since we can't distinguish between composed fields and repeated fields.

Example:

  1.  $seg =new Net_HL7_Segment("PID");
  2.  
  3.  $seg->setField(3"12345678");
  4.  echo $seg->getField(1);


Parameters:

mixed   $name   —  Name of the segment
array   $fields   —  Fields for segment

[ Top ]

getField   [line 124]

mixed getField( int $index)

Get the field at index. If the field is a composed field, you might

ask for the result to be an array like so:

  1.  $subfields $seg->getField(9)
otherwise the thing returned will be a reference to an array.

  • Return: The value of the field
  • Access: public

Parameters:

int   $index   —  Index of field

[ Top ]

getFields   [line 152]

array getFields( [int $from = 0], [int $to = 0])

Get the fields in the specified range, or all if nothing specified. If only the 'from' value is provided, all fields from this index till the end of the segment will be returned.
  • Return: List of fields
  • Access: public

Parameters:

int   $from   —  Start range at this index
int   $to   —  Stop range at this index

[ Top ]

getName   [line 168]

mixed getName( )

Get the name of the segment. This is basically the value at index 0
  • Return: Name of segment
  • Access: public

[ Top ]

setField   [line 95]

boolean setField( int $index, [mixed $value = ""])

Set the field specified by index to value, and return some true value

if the operation succeeded. Indices start at 1, to stay with the HL7 standard. Trying to set the value at index 0 has no effect. The value may also be a reference to an array (that may itself contain arrays) to support composed fields (and subcomponents).

To set a field to the HL7 null value, instead of omitting a field, can be achieved with the _Net_HL7_NULL type, like:

  1.    $segment->setField(8$_Net_HL7_NULL);
This will render the field as the double quote (""). If values are not provided at all, the method will just return.

  • Access: public

Overridden in child classes as:

Net_HL7_Segments_MSH::setField()
Set the field specified by index to value.

Parameters:

int   $index   —  Index to set
mixed   $value   —  Value for field

[ Top ]

size   [line 136]

int size( )

Get the number of fields for this segment, not including the name
  • Return: number of fields
  • Access: public

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:32:35 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.