本文整理汇总了PHP中Transform::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Transform::with方法的具体用法?PHP Transform::with怎么用?PHP Transform::with使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform::with方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Class constructor
*
* @param Transform $transform Transform interface or DSN string
* @param int $opt Output handler options
*/
public function __construct($transform, $opt = 0)
{
if (!$transform instanceof Transform) {
$transform = Transform::with($this->transform);
}
$this->transform = $transform;
$this->opt = $opt;
ob_start(array($this, 'callback'));
}
示例2: loadFile
/**
* Load a config file or dir (no caching)
*
* @param Fs_Item $file_object
* @param string $group
* @return array
*/
protected function loadFile($file_object, $group = null)
{
if ($file_object instanceof Fs_File) {
return Transform::with('unserialize-yaml')->process($file_object->path());
} elseif ($file_object instanceof Fs_Dir) {
return $this->loadDir($file_object);
}
return array();
}
示例3: loadFile
/**
* Load a config file or dir
*
* @param Fs_Item $file_object
* @param string $group
* @return array
*/
protected function loadFile($file_object, $group = null)
{
if ($file_object instanceof Fs_File) {
return Transform::with('unserialize-ini')->process($file_object->path());
} elseif (!empty($this->_options['recursive']) && $file_object instanceof Fs_Dir) {
return $this->loadDir($file_object);
}
return array();
}
示例4: loadFile
/**
* Load a config file or dir (no caching)
*
* @param Fs_Item $file_object
* @param string $group
* @return array
*/
protected function loadFile($file_object, $group = null)
{
$settings = array();
if ($file_object instanceof Fs_File) {
$settings = Transform::with('unserialize-json')->process($file_object->path());
if (!isset($settings)) {
trigger_error("Failed to parse json file '{$file}'.", E_USER_WARNING);
}
} elseif (!empty($this->_options['recursive']) && $file_object instanceof Fs_Dir) {
$settings = $this->loadDir($file_object);
}
return $settings;
}
示例5: __construct
/**
* Class constructor
*
* @param array $options
*/
public function __construct($path, $options = array())
{
if (is_array($path)) {
$options = $path + $options;
$path = null;
if (isset($options['driver'])) {
if (isset($options[0])) {
if (!isset($options['path'])) {
$options['path'] = $options[0];
}
if (!isset($options['ext'])) {
$options['ext'] = $options['driver'];
}
unset($options[0]);
} else {
$options[0] = $options['driver'];
}
}
}
if (isset($options[0])) {
if (strpos($options[0], ':') !== false) {
list($options['ext'], $options['path']) = explode(':', $options[0], 2);
} else {
$key = !isset($options['ext']) && strpos($options[0], '.') === false && strpos($options[0], '/') === false ? 'ext' : 'path';
if (!isset($options[$key])) {
$options[$key] = $options[0];
}
}
}
$this->_path = isset($path) ? Fs::dir($path) : (isset($options['path']) ? Fs::dir($options['path']) : null);
if (isset($options['transformer'])) {
$this->_transformer = $options['transformer'] instanceof Transformer ? $options['transformer'] : Transform::with($options['transformer']);
}
$this->_ext = isset($options['ext']) ? $options['ext'] : (isset($this->_transformer) ? $this->_transformer->ext : null);
if (!isset($this->_transformer) && !empty($this->_ext)) {
$this->_transformer = Transform::from($this->_ext);
}
\ArrayObject::__construct(array(), \ArrayObject::ARRAY_AS_PROPS);
if (!empty($options['loadall'])) {
$this->loadAll();
}
}
示例6: testDriverMaxlength
/**
* Test driver maxlength
*/
public function testDriverMaxlength()
{
$transform = Transform::with('maxlength');
$this->assertType('Q\\Validator_Maxlength', $transform);
}