Hoa central
Static Public Member Functions | List of all members
Hoa\Stream\Wrapper\Wrapper Class Reference

Static Public Member Functions

static register ($protocol, $classname, $flags=0)
 
static unregister ($protocol)
 
static restore ($protocol)
 
static isRegistered ($protocol)
 
static getRegistered ()
 

Detailed Description

Class .

Manipulate wrappers.

Definition at line 49 of file Wrapper.php.

Member Function Documentation

static Hoa\Stream\Wrapper\Wrapper::getRegistered ( )
static

Get all registered wrapper.

Returns
array

Definition at line 120 of file Wrapper.php.

121  {
122  return stream_get_wrappers();
123  }
static Hoa\Stream\Wrapper\Wrapper::isRegistered (   $protocol)
static

Check if a protocol is registered or not.

Parameters
string$protocolProtocol name.

Definition at line 110 of file Wrapper.php.

111  {
112  return in_array($protocol, self::getRegistered());
113  }
static Hoa\Stream\Wrapper\Wrapper::register (   $protocol,
  $classname,
  $flags = 0 
)
static

Register a wrapper.

Parameters
string$protocolThe wrapper name to be registered.
string$classnameClassname which implements the $protocol.
int$flagsShould be set to STREAM_IS_URL if $protocol is a URL protocol. Default is 0, local stream.
Returns
bool
Exceptions

Definition at line 62 of file Wrapper.php.

63  {
64  if (true === self::isRegistered($protocol)) {
65  throw new Exception(
66  'The protocol %s is already registered.',
67  0,
68  $protocol
69  );
70  }
71 
72  if (false === class_exists($classname)) {
73  throw new Exception(
74  'Cannot register the %s class because it is not found.',
75  1,
76  $classname
77  );
78  }
79 
80  return stream_wrapper_register($protocol, $classname, $flags);
81  }
static Hoa\Stream\Wrapper\Wrapper::restore (   $protocol)
static

Restore a previously unregistered build-in wrapper.

Parameters
string$protocolThe wrapper name to be restored.
Returns
bool

Definition at line 100 of file Wrapper.php.

101  {
102  return stream_wrapper_restore($protocol);
103  }
static Hoa\Stream\Wrapper\Wrapper::unregister (   $protocol)
static

Unregister a wrapper.

Parameters
string$protocolThe wrapper name to be unregistered.
Returns
bool

Definition at line 89 of file Wrapper.php.

90  {
91  return stream_wrapper_unregister($protocol);
92  }

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