Documentation

vfsStreamFile extends vfsStreamAbstractContent
in package

File container.

Table of Contents

$exclusiveLock  : mixed
Resource id which exclusively locked this file
$group  : mixed
owner group of the file
$lastAccessed  : mixed
timestamp of last access
$lastAttributeModified  : mixed
timestamp of last attribute modification
$lastModified  : mixed
timestamp of last modification
$name  : mixed
name of the container
$permissions  : mixed
permissions for content
$sharedLock  : mixed
Resources ids which currently holds shared lock to this file
$type  : mixed
type of the container
$user  : mixed
owner of the file
$content  : mixed
content of the file
$parentPath  : mixed
path to to this content
__construct()  : mixed
constructor
appliesTo()  : bool
checks whether the container can be applied to given name
at()  : $this
adds content to given container
chgrp()  : $this
change owner group of file to given group
chmod()  : $this
change file mode to given permissions
chown()  : $this
change owner of file to given user
eof()  : bool
checks whether pointer is at end of file
fileatime()  : int
returns the last access time of the stream content
filectime()  : int
returns the last attribute modification time of the stream content
filemtime()  : int
returns the last modification time of the stream content
getBytesRead()  : int
returns the current position within the file
getContent()  : string
returns the contents of the file
getGroup()  : int
returns owner group of file
getName()  : string
returns the file name of the content
getPermissions()  : int
returns permissions
getResourceId()  : string
Returns unique resource id
getType()  : int
returns the type of the container
getUser()  : int
returns owner of file
hasExclusiveLock()  : bool
checks whether file is locked in exclusive mode
hasSharedLock()  : bool
checks whether file is locked in shared mode
isExecutable()  : bool
checks whether content is executable
isLocked()  : bool
checks whether file is locked
isOwnedByGroup()  : bool
checks whether file is owned by group
isOwnedByUser()  : bool
checks whether file is owned by given user
isReadable()  : bool
checks whether content is readable
isWritable()  : bool
checks whether content is writable
lastAccessed()  : $this
sets last access time of the stream content
lastAttributeModified()  : $this
sets the last attribute modification time of the stream content
lastModified()  : $this
sets the last modification time of the stream content
lock()  : bool
locks file for
open()  : mixed
simply open the file
openForAppend()  : mixed
open file and set pointer to end of file
openWithTruncate()  : mixed
open file and truncate content
path()  : string
returns path to this content
read()  : string
reads the given amount of bytes from content
readUntilEnd()  : string
returns the content until its end from current offset
rename()  : mixed
renames the content
seek()  : bool
seeks to the given offset
setContent()  : vfsStreamFile
alias for withContent()
size()  : int
returns size of content
truncate()  : bool
Truncates a file to a given length
unlock()  : mixed
Removes lock from file acquired by given resource
url()  : string
returns complete vfsStream url for this content
withContent()  : vfsStreamFile
sets the contents of the file
write()  : int
writes an amount of data
addSharedLock()  : mixed
Add shared lock on file by given resource
getDefaultPermissions()  : int
returns default permissions for concrete implementation
setExclusiveLock()  : mixed
Set exlusive lock on file by given resource

Properties

$exclusiveLock

Resource id which exclusively locked this file

protected mixed $exclusiveLock
Tags
type

string

$lastAttributeModified

timestamp of last attribute modification

protected mixed $lastAttributeModified
Tags
type

int

$sharedLock

Resources ids which currently holds shared lock to this file

protected mixed $sharedLock = array()
Tags
type

bool[string]

$content

content of the file

private mixed $content
Tags
type

FileContent

Methods

__construct()

constructor

public __construct(string $name[, int $permissions = null ]) : mixed
Parameters
$name : string
$permissions : int = null

optional

Return values
mixed

appliesTo()

checks whether the container can be applied to given name

public appliesTo(string $name) : bool
Parameters
$name : string
Return values
bool

chgrp()

change owner group of file to given group

public chgrp(int $group) : $this
Parameters
$group : int
Return values
$this

chmod()

change file mode to given permissions

public chmod(int $permissions) : $this
Parameters
$permissions : int
Return values
$this

chown()

change owner of file to given user

public chown(int $user) : $this
Parameters
$user : int
Return values
$this

eof()

checks whether pointer is at end of file

public eof() : bool
Return values
bool

fileatime()

returns the last access time of the stream content

public fileatime() : int
Tags
since
0.9
Return values
int

filectime()

returns the last attribute modification time of the stream content

public filectime() : int
Tags
since
0.9
Return values
int

filemtime()

returns the last modification time of the stream content

public filemtime() : int
Return values
int

getBytesRead()

returns the current position within the file

public getBytesRead() : int
Tags
deprecated

since 1.3.0

Return values
int

getContent()

returns the contents of the file

public getContent() : string

Getting content does not change the time when the file was last accessed.

Return values
string

isExecutable()

checks whether content is executable

public isExecutable(int $user, int $group) : bool
Parameters
$user : int

id of user to check for

$group : int

id of group to check for

Return values
bool

isOwnedByGroup()

checks whether file is owned by group

public isOwnedByGroup(int $group) : bool
Parameters
$group : int
Return values
bool

isOwnedByUser()

checks whether file is owned by given user

public isOwnedByUser(int $user) : bool
Parameters
$user : int
Return values
bool

isReadable()

checks whether content is readable

public isReadable(int $user, int $group) : bool
Parameters
$user : int

id of user to check for

$group : int

id of group to check for

Return values
bool

isWritable()

checks whether content is writable

public isWritable(int $user, int $group) : bool
Parameters
$user : int

id of user to check for

$group : int

id of group to check for

Return values
bool

lastAccessed()

sets last access time of the stream content

public lastAccessed(int $fileatime) : $this
Parameters
$fileatime : int
Tags
since
0.9
Return values
$this

lastAttributeModified()

sets the last attribute modification time of the stream content

public lastAttributeModified(int $filectime) : $this
Parameters
$filectime : int
Tags
since
0.9
Return values
$this

lastModified()

sets the last modification time of the stream content

public lastModified(int $filemtime) : $this
Parameters
$filemtime : int
Return values
$this

open()

simply open the file

public open() : mixed
Tags
since
0.9
Return values
mixed

openForAppend()

open file and set pointer to end of file

public openForAppend() : mixed
Tags
since
0.9
Return values
mixed

openWithTruncate()

open file and truncate content

public openWithTruncate() : mixed
Tags
since
0.9
Return values
mixed

read()

reads the given amount of bytes from content

public read(int $count) : string

Using this method changes the time when the file was last accessed.

Parameters
$count : int
Return values
string

readUntilEnd()

returns the content until its end from current offset

public readUntilEnd() : string

Using this method changes the time when the file was last accessed.

Tags
deprecated

since 1.3.0

Return values
string

rename()

renames the content

public rename(string $newName) : mixed
Parameters
$newName : string
Return values
mixed

seek()

seeks to the given offset

public seek(int $offset, int $whence) : bool
Parameters
$offset : int
$whence : int
Return values
bool

size()

returns size of content

public size() : int
Return values
int

truncate()

Truncates a file to a given length

public truncate(int $size) : bool
Parameters
$size : int

length to truncate file to

Tags
since
1.1.0
Return values
bool

url()

returns complete vfsStream url for this content

public url() : string
Tags
since
1.2.0
Return values
string

withContent()

sets the contents of the file

public withContent(mixed $content) : vfsStreamFile

Setting content with this method does not change the time when the file was last modified.

Parameters
$content : mixed
Tags
throws
InvalidArgumentException
Return values
vfsStreamFile

write()

writes an amount of data

public write(string $data) : int

Using this method changes the time when the file was last modified.

Parameters
$data : string
Return values
int

amount of written bytes

getDefaultPermissions()

returns default permissions for concrete implementation

protected getDefaultPermissions() : int
Tags
since
0.8.0
Return values
int

Search results