Hoa central
Public Member Functions | Static Public Member Functions | List of all members
Hoa\File\Link\Link Class Reference
Inheritance diagram for Hoa\File\Link\Link:

Public Member Functions

 __construct ($streamName, $mode, $context=null, $wait=false)
 
 getStatistic ()
 
 changeGroup ($group)
 
 changeOwner ($user)
 
 getPermissions ()
 
 getTarget ()
 
 getTargetName ()
 
- Public Member Functions inherited from Hoa\File\File
 __construct ($streamName, $mode, $context=null, $wait=false)
 
 newBuffer ($callable=null, $size=null)
 
 flush ()
 
 deleteBuffer ()
 
 getBufferLevel ()
 
 getBufferSize ()
 
 lock ($operation)
 
 rewind ()
 
 seek ($offset, $whence=Stream\IStream\Pointable::SEEK_SET)
 
 tell ()
 
- Public Member Functions inherited from Hoa\File\Generic
 getBasename ()
 
 getDirname ()
 
 getSize ()
 
 getStatistic ()
 
 getATime ()
 
 getCTime ()
 
 getMTime ()
 
 getGroup ()
 
 getOwner ()
 
 getPermissions ()
 
 getReadablePermissions ()
 
 isReadable ()
 
 isWritable ()
 
 isExecutable ()
 
 clearStatisticCache ()
 
 touch ($time=-1, $atime=-1)
 
 copy ($to, $force=Stream\IStream\Touchable::DO_NOT_OVERWRITE)
 
 move ($name, $force=Stream\IStream\Touchable::DO_NOT_OVERWRITE, $mkdir=Stream\IStream\Touchable::DO_NOT_MAKE_DIRECTORY)
 
 delete ()
 
 changeGroup ($group)
 
 changeMode ($mode)
 
 changeOwner ($user)
 
 isFile ()
 
 isLink ()
 
 isDirectory ()
 
 isSocket ()
 
 isFIFOPipe ()
 
 isCharacterSpecial ()
 
 isBlockSpecial ()
 
 isUnknown ()
 
 getMode ()
 
 getINode ()
 
 getRealPath ()
 
 getExtension ()
 
 getFilename ()
 
- Public Member Functions inherited from Hoa\Stream\Stream
 __construct ($streamName, $context=null, $wait=false)
 
 open ()
 
 close ()
 
 getStreamName ()
 
 getStreamContext ()
 
 _setStream ($stream)
 
 isOpened ()
 
 setStreamTimeout ($seconds, $microseconds=0)
 
 setStreamBlocking ($mode)
 
 setStreamBuffer ($buffer)
 
 disableStreamBuffer ()
 
 getStreamBufferSize ()
 
 getStreamWrapperName ()
 
 getStreamMetaData ()
 
 isBorrowing ()
 
 on ($listenerId, $callable)
 
 _notify ($ncode, $severity, $message, $code, $transferred, $max)
 
 __toString ()
 
 __destruct ()
 

Static Public Member Functions

static create ($name, $target)
 
- Static Public Member Functions inherited from Hoa\File\File
static create ($name, $dummy)
 
- Static Public Member Functions inherited from Hoa\File\Generic
static clearAllStatisticCaches ()
 
static umask ($umask=null)
 
static isCaseSensitive ()
 
- Static Public Member Functions inherited from Hoa\Stream\Stream
static getStreamHandler ($streamName)
 
static _Hoa_Stream ()
 

Additional Inherited Members

- Public Attributes inherited from Hoa\File\File
const MODE_READ = 'rb'
 
const MODE_READ_WRITE = 'r+b'
 
const MODE_TRUNCATE_WRITE = 'wb'
 
const MODE_TRUNCATE_READ_WRITE = 'w+b'
 
const MODE_APPEND_WRITE = 'ab'
 
const MODE_APPEND_READ_WRITE = 'a+b'
 
const MODE_CREATE_WRITE = 'xb'
 
const MODE_CREATE_READ_WRITE = 'x+b'
 
- Public Attributes inherited from Hoa\Stream\Stream
const NAME = 0
 
const HANDLER = 1
 
const RESOURCE = 2
 
const CONTEXT = 3
 
- Public Attributes inherited from Hoa\Stream\IStream\Statable
const SIZE_UNDEFINED = -1
 
- Public Attributes inherited from Hoa\Stream\IStream\Touchable
const OVERWRITE = true
 
const DO_NOT_OVERWRITE = false
 
const MAKE_DIRECTORY = true
 
const DO_NOT_MAKE_DIRECTORY = false
 
- Public Attributes inherited from Hoa\Stream\IStream\Lockable
const LOCK_SHARED = LOCK_SH
 
const LOCK_EXCLUSIVE = LOCK_EX
 
const LOCK_RELEASE = LOCK_UN
 
const LOCK_NO_BLOCK = LOCK_NB
 
- Public Attributes inherited from Hoa\Stream\IStream\Pointable
const SEEK_SET = SEEK_SET
 
const SEEK_CURRENT = SEEK_CUR
 
const SEEK_END = SEEK_END
 
- Protected Member Functions inherited from Hoa\File\File
_open ($streamName, Stream\Context $context=null)
 
 _close ()
 
- Protected Member Functions inherited from Hoa\File\Generic
 setMode ($mode)
 
- Protected Member Functions inherited from Hoa\Stream\Stream
_open ($streamName, Context $context=null)
 
 _close ()
 
 getStream ()
 
- Protected Attributes inherited from Hoa\File\Generic
 $_mode = null
 
- Protected Attributes inherited from Hoa\Stream\Stream
 $_bucket = []
 
 $_bufferSize = 8192
 
 $_streamName = null
 
 $_context = null
 
 $_hasBeenDiffered = false
 
 $_on = null
 
 $_borrowed = false
 

Detailed Description

Class .

Link handler.

Definition at line 50 of file Link.php.

Constructor & Destructor Documentation

Hoa\File\Link\Link::__construct (   $streamName,
  $mode,
  $context = null,
  $wait = false 
)

Open a link.

Parameters
string$streamNameStream name.
string$modeOpen mode, see the parent::MODE_* constants.
string$contextContext ID (please, see the class).
bool$waitDiffer opening or not.
Returns
void
Exceptions

Definition at line 64 of file Link.php.

69  {
70  if (!is_link($streamName)) {
71  throw new File\Exception(
72  'File %s is not a link.',
73  0,
74  $streamName
75  );
76  }
77 
78  parent::__construct($streamName, $mode, $context, $wait);
79 
80  return;
81  }

Member Function Documentation

Hoa\File\Link\Link::changeGroup (   $group)

Change file group.

Parameters
mixed$groupGroup name or number.
Returns
bool

Implements Hoa\Stream\IStream\Touchable.

Definition at line 99 of file Link.php.

100  {
101  return lchgrp($this->getStreamName(), $group);
102  }

Here is the call graph for this function:

Hoa\File\Link\Link::changeOwner (   $user)

Change file owner.

Parameters
mixed$userUser.
Returns
bool

Implements Hoa\Stream\IStream\Touchable.

Definition at line 110 of file Link.php.

111  {
112  return lchown($this->getStreamName(), $user);
113  }

Here is the call graph for this function:

static Hoa\File\Link\Link::create (   $name,
  $target 
)
static

Create a link.

Parameters
string$nameLink name.
string$targetTarget name.
Returns
bool

Definition at line 184 of file Link.php.

185  {
186  if (false != linkinfo($name)) {
187  return true;
188  }
189 
190  return symlink($target, $name);
191  }
Hoa\File\Link\Link::getPermissions ( )

Get file permissions.

Returns
int

Implements Hoa\Stream\IStream\Statable.

Definition at line 120 of file Link.php.

121  {
122  return 41453; // i.e. lrwxr-xr-x
123  }
Hoa\File\Link\Link::getStatistic ( )

Get informations about a link.

Returns
array

Implements Hoa\Stream\IStream\Statable.

Definition at line 88 of file Link.php.

89  {
90  return lstat($this->getStreamName());
91  }

Here is the call graph for this function:

Hoa\File\Link\Link::getTarget ( )

Get the target of a symbolic link.

Returns
Exceptions

Definition at line 131 of file Link.php.

132  {
133  $target = dirname($this->getStreamName()) . DS .
134  $this->getTargetName();
135  $context = null !== $this->getStreamContext()
136  ? $this->getStreamContext()->getCurrentId()
137  : null;
138 
139  if (true === is_link($target)) {
140  return new ReadWrite(
141  $target,
143  $context
144  );
145  } elseif (true === is_file($target)) {
146  return new File\ReadWrite(
147  $target,
149  $context
150  );
151  } elseif (true === is_dir($target)) {
152  return new File\Directory(
153  $target,
155  $context
156  );
157  }
158 
159  throw new File\Exception(
160  'Cannot find an appropriated object that matches with ' .
161  'path %s when defining it.',
162  1,
163  $target
164  );
165  }
const MODE_READ
Definition: File.php:62
const MODE_APPEND_READ_WRITE
Definition: File.php:104

Here is the call graph for this function:

Hoa\File\Link\Link::getTargetName ( )

Get the target name of a symbolic link.

Returns
string

Definition at line 172 of file Link.php.

173  {
174  return readlink($this->getStreamName());
175  }

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: