本文整理汇总了PHP中arr::defaults方法的典型用法代码示例。如果您正苦于以下问题:PHP arr::defaults方法的具体用法?PHP arr::defaults怎么用?PHP arr::defaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arr
的用法示例。
在下文中一共展示了arr::defaults方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($filename, array $options = null, array $headermap = null)
{
$this->options = arr::defaults((array) $options, array('delimiter' => ',', 'enclosure' => '"', 'escape' => "\\", 'length' => 2048, 'null' => '*NULL*'));
$this->headermap = $headermap;
$this->fh = fopen($filename, 'r');
$this->filesize = filesize($filename);
$this->timer = new Timer(false);
}
示例2: __construct
public function __construct($label, $key, Array $items = null, Array $options = null) {
$this->label = $label;
$this->setKey($key);
// Here we will do a little check to see if the array we are passed is
// indexed with a key ( $k => $v ), or if it's simply an array of arrays
// i.e. a recordset from a database query. If this is the case, we will
// go over the list and massage it to be indexed with a key.
if (count($items)>0) {
if (typeOf($items[0]) == 'array') {
$newarr = array();
// Repopulate the list with keys properly assigned
foreach($items as $item) {
$newarr[$item[0]] = $item[1];
}
// And update the item list with our newly populated one
$items = $newarr;
}
// Now we update the main list
$this->items = $items;
}
$this->options = arr::defaults($options, array(
'class' => 'wf-row'
));
}
示例3: addStep
/**
* @brief Add a step to the wizard.
*
* @param IWizardStep $step The step as a IWizardStep instance
* @param string $key The key of the step (f.ex. 'basic')
* @param string $name The name of the step (f.ex. 'Basic Information')
* @param array $options Options for the step
*/
public function addStep(IWizardStep $step, $key, $name, array $options = null)
{
// These are the defaults we will use
$defaults = array('title' => $name, 'novalidate' => false);
// Apply the defaults to the options
$options = arr::defaults($options, $defaults);
// And add the step with the new options attached
$this->steps[] = array('step' => $step, 'key' => $key, 'name' => $name, 'options' => $options);
// Now go over the data for the step to see if it has already been
// validated and saved. We do this with the initialize method.
$step->setForm($this);
$step->initialize($this->getFormToken());
}