Utils

package

Default

Methods

bytesToInt

bytesToInt(array $bytes,boolean $unsigned = true): integer
static

Arguments

$bytes

array

$unsigned

boolean

Response

integer

Convert bytes to string.

bytesToString(array $bytes): string
static

Arguments

$bytes

array

Response

string

Convert double to string.

doubleToString(float $num): string
static

Arguments

$num

float

Response

string

SPSS represents a date as the number of seconds since the epoch, midnight, Oct. 14, 1582.

formatDate( $timestamp,string $format = 'Y M d'): false|string
static

Arguments

$timestamp

$format

string

Response

false|string

getSegments

getSegments( $width): \Generator
static

Arguments

$width

Response

\Generator

intToBytes

intToBytes(integer $int,integer $size = 32): array
static

Arguments

$int

integer

$size

integer

Response

array

is_countable

is_countable(mixed $values)
static

Arguments

$values

mixed

Rounds X down to the prev multiple of Y.

roundDown(integer $x,integer $y): integer
static

Arguments

$x

integer

$y

integer

Response

integer

Rounds X up to the next multiple of Y.

roundUp(integer $x,integer $y): integer
static

Arguments

$x

integer

$y

integer

Response

integer

Returns the number of bytes to allocate to the given SEGMENT within a variable of the given width.

segmentAllocBytes(mixed $width,integer $segment): integer
static

This is the same as.

see \SPSS\segmentAllocWidth,

except that a numeric value takes up 8 bytes despite having a width of 0.

Arguments

$width

mixed

$segment

integer

Response

integer

Returns the width to allocate to the given SEGMENT within a variable of the given WIDTH.

segmentAllocWidth(integer $width,integer $segment): integer
static

A segment is a physical variable in the system file that represents some piece of a logical variable.

Arguments

$width

integer

$segment

integer

Response

integer

signedToUnsigned

signedToUnsigned(integer $value,integer $size = 32): string
static

Arguments

$value

integer

$size

integer

Response

string

stringToDouble

stringToDouble(string $str): float
static

Arguments

$str

string

Response

float

unsignedToSigned

unsignedToSigned(integer $value,integer $size = 32): string
static

Arguments

$value

integer

$size

integer

Response

string

Returns the number of bytes of uncompressed case data used for writing a variable of the given WIDTH to a system file.

widthToBytes(integer $width): integer
static

All required space is included, including trailing padding and internal padding.

Arguments

$width

integer

Response

integer

Returns the number of 8-byte units (octs) used to write data for a variable of the given WIDTH.

widthToOcts(integer $width): integer
static

Arguments

$width

integer

Response

integer

Returns the number of "segments" used for writing case data for a variable of the given WIDTH.

widthToSegments(integer $width): integer
static

A segment is a physical variable in the system file that represents some piece of a logical variable. Only very long string variables have more than one segment.

Arguments

$width

integer

Response

integer