Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Zend_File_Transfer Class Reference

Public Member Functions

 __construct ($adapter='Http', $direction=false, $options=array())
 
 setAdapter ($adapter, $direction=false, $options=array())
 
 getAdapter ($direction=null)
 
 __call ($method, array $options)
 

Protected Attributes

 $_adapter = array()
 

Detailed Description

Definition at line 35 of file Transfer.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $adapter = 'Http',
  $direction = false,
  $options = array() 
)

Creates a file processing handler

Parameters
string$adapterAdapter to use
boolean$directionOPTIONAL False means Download, true means upload
array$optionsOPTIONAL Options to set for this adapter
Exceptions
Zend_File_Transfer_Exception

Definition at line 52 of file Transfer.php.

53  {
54  $this->setAdapter($adapter, $direction, $options);
55  }
setAdapter($adapter, $direction=false, $options=array())
Definition: Transfer.php:65
$adapter
Definition: webapi_user.php:16

Member Function Documentation

◆ __call()

__call (   $method,
array  $options 
)

Calls all methods from the adapter

Parameters
string$methodMethod to call
array$optionsOptions for this method
Returns
mixed

Definition at line 110 of file Transfer.php.

111  {
112  if (array_key_exists('direction', $options)) {
113  $direction = (integer) $options['direction'];
114  } else {
115  $direction = 0;
116  }
117 
118  if (method_exists($this->_adapter[$direction], $method)) {
119  return call_user_func_array(array($this->_adapter[$direction], $method), $options);
120  }
121 
122  #require_once 'Zend/File/Transfer/Exception.php';
123  throw new Zend_File_Transfer_Exception("Unknown method '" . $method . "' called!");
124  }
$method
Definition: info.phtml:13

◆ getAdapter()

getAdapter (   $direction = null)

Returns all set adapters

Parameters
boolean$directionOn null, all directions are returned On false, download direction is returned On true, upload direction is returned
Returns
array|Zend_File_Transfer_Adapter

Definition at line 93 of file Transfer.php.

94  {
95  if ($direction === null) {
96  return $this->_adapter;
97  }
98 
99  $direction = (integer) $direction;
100  return $this->_adapter[$direction];
101  }

◆ setAdapter()

setAdapter (   $adapter,
  $direction = false,
  $options = array() 
)

Sets a new adapter

Parameters
string$adapterAdapter to use
boolean$directionOPTIONAL False means Download, true means upload
array$optionsOPTIONAL Options to set for this adapter
Exceptions
Zend_File_Transfer_Exception

Definition at line 65 of file Transfer.php.

66  {
67  if (Zend_Loader::isReadable('Zend/File/Transfer/Adapter/' . ucfirst($adapter). '.php')) {
68  $adapter = 'Zend_File_Transfer_Adapter_' . ucfirst($adapter);
69  }
70 
71  if (!class_exists($adapter)) {
73  }
74 
75  $direction = (integer) $direction;
76  $this->_adapter[$direction] = new $adapter($options);
77  if (!$this->_adapter[$direction] instanceof Zend_File_Transfer_Adapter_Abstract) {
78  #require_once 'Zend/File/Transfer/Exception.php';
79  throw new Zend_File_Transfer_Exception("Adapter " . $adapter . " does not extend Zend_File_Transfer_Adapter_Abstract");
80  }
81 
82  return $this;
83  }
static loadClass($class, $dirs=null)
Definition: Loader.php:52
$adapter
Definition: webapi_user.php:16
static isReadable($filename)
Definition: Loader.php:162

Field Documentation

◆ $_adapter

$_adapter = array()
protected

Definition at line 42 of file Transfer.php.


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