\PhpZip\Model\Extra\FieldsAsiExtraField

ASi Unix Extra Field: ====================.

The following is the layout of the ASi extra block for Unix. The local-header and central-header versions are identical. (Last Revision 19960916)

Value Size Description


(Unix3) 0x756e Short tag for this extra block type ("nu") TSize Short total data size for this block CRC Long CRC-32 of the remaining data Mode Short file permissions SizDev Long symlink'd size OR major/minor dev num UID Short user ID GID Short group ID (var.) variable symbolic link filename

Mode is the standard Unix st_mode field from struct stat, containing user/group/other permissions, setuid/setgid and symlink info, etc.

If Mode indicates that this file is a symbolic link, SizDev is the size of the file to which the link points. Otherwise, if the file is a device, SizDev contains the standard Unix st_rdev field from struct stat (includes the major and minor numbers of the device). SizDev is undefined in other cases.

If Mode indicates that the file is a symbolic link, the final field will be the name of the file to which the link points. The file- name length can be inferred from TSize.

[Note that TSize may incorrectly refer to the data size not counting the CRC; i.e., it may be four bytes too small.]

Summary

Methods
Properties
Constants
__construct()
getHeaderId()
unpackLocalFileData()
unpackCentralDirData()
packLocalFileData()
packCentralDirData()
getLink()
setLink()
isLink()
isDirectory()
getMode()
setMode()
getUserId()
setUserId()
getGroupId()
setGroupId()
__toString()
No public properties found
HEADER_ID
USER_GID_PID
PERM_MASK
getPermissionsMode()
No protected properties found
N/A
No private methods found
$mode
$uid
$gid
$link
N/A

Constants

HEADER_ID

HEADER_ID = 0x756e : int

USER_GID_PID

USER_GID_PID = 1000

PERM_MASK

PERM_MASK = 07777

Bits used for permissions (and sticky bit).

Properties

$mode

$mode : int

Type

int — Standard Unix stat(2) file mode.

$uid

$uid : int

Type

int — User ID.

$gid

$gid : int

Type

int — Group ID.

$link

$link : string

Type

string — File this entry points to, if it is a symbolic link. Empty string - if entry is not a symbolic link.

Methods

__construct()

__construct(int  $mode, int  $uid = self::USER_GID_PID, int  $gid = self::USER_GID_PID, string  $link = '') : mixed

AsiExtraField constructor.

Parameters

int $mode
int $uid
int $gid
string $link

Returns

mixed —

getHeaderId()

getHeaderId() : int

Returns the Header ID (type) of this Extra Field.

The Header ID is an unsigned short integer (two bytes) which must be constant during the life cycle of this object.

Returns

int —

unpackLocalFileData()

unpackLocalFileData(string  $buffer, \PhpZip\Model\ZipEntry|null  $entry = null) : static

Populate data from this array as if it was in local file data.

Parameters

string $buffer

the buffer to read data from

\PhpZip\Model\ZipEntry|null $entry

Throws

\PhpZip\Exception\Crc32Exception

Returns

static —

unpackCentralDirData()

unpackCentralDirData(string  $buffer, \PhpZip\Model\ZipEntry|null  $entry = null) : \PhpZip\Model\Extra\Fields\AsiExtraField

Populate data from this array as if it was in central directory data.

Parameters

string $buffer

the buffer to read data from

\PhpZip\Model\ZipEntry|null $entry

Throws

\PhpZip\Exception\Crc32Exception

Returns

\PhpZip\Model\Extra\Fields\AsiExtraField —

packLocalFileData()

packLocalFileData() : string

The actual data to put into local file data - without Header-ID or length specifier.

Returns

string —

the data

packCentralDirData()

packCentralDirData() : string

The actual data to put into central directory - without Header-ID or length specifier.

Returns

string —

the data

getLink()

getLink() : string

Name of linked file.

Returns

string —

name of the file this entry links to if it is a symbolic link, the empty string otherwise

setLink()

setLink(string  $link) : mixed

Indicate that this entry is a symbolic link to the given filename.

Parameters

string $link

name of the file this entry links to, empty string if it is not a symbolic link

Returns

mixed —

isLink()

isLink() : bool

Is this entry a symbolic link?

Returns

bool —

true if this is a symbolic link

isDirectory()

isDirectory() : bool

Is this entry a directory?

Returns

bool —

true if this entry is a directory

getMode()

getMode() : int

Returns

int —

setMode()

setMode(int  $mode) : mixed

Parameters

int $mode

Returns

mixed —

getUserId()

getUserId() : int

Returns

int —

setUserId()

setUserId(int  $uid) : mixed

Parameters

int $uid

Returns

mixed —

getGroupId()

getGroupId() : int

Returns

int —

setGroupId()

setGroupId(int  $gid) : mixed

Parameters

int $gid

Returns

mixed —

__toString()

__toString() : string

Returns

string —

getPermissionsMode()

getPermissionsMode(int  $mode) : int

Get the file mode for given permissions with the correct file type.

Parameters

int $mode

the mode

Returns

int —

the type with the mode