本文整理匯總了PHP中Illuminate\Support\Facades\Facade::__callStatic方法的典型用法代碼示例。如果您正苦於以下問題:PHP Facade::__callStatic方法的具體用法?PHP Facade::__callStatic怎麽用?PHP Facade::__callStatic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Support\Facades\Facade
的用法示例。
在下文中一共展示了Facade::__callStatic方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: magic_input
/**
* Checks call to see if we can create an input from a magic call (for you wizards).
* large_text, xlarge_textarea, small_number, etc...
*
* @param string $method Name of missing method
* @param array $parameters array of parameters passed to missing method
*
* @return mixed
*/
protected static function magic_input($method, $parameters)
{
//$sizes = array('mini' , 'small', 'medium', 'large', 'xlarge', 'xxlarge', 'span1', 'span2', 'span3', 'span4', 'span5', 'span6', 'span7', 'span8', 'span9', 'span10', 'span11', 'span12');
$types = array(
'input',
'text',
'password',
'uneditable',
'select',
'multiselect',
'file',
'textarea',
'date',
'number',
'url',
'tel',
'email',
'search'
);
$method_array = explode('_', strtolower($method));
$type_found = array_intersect($method_array, $types);
if (count($type_found) > 0) {
$function = $type_found[key($type_found)];
$attr_index = 0;
switch ($function) {
case 'password':
case 'file':
case 'uneditable':
// password($name, $attributes = array())
// Set attributes array and call function
$attr_index = 1;
break;
case 'input':
// input($type, $name, $value = null, $attributes = array())
// Set defaults and attributes array and call function
if (!isset($parameters[2])) {
$parameters[2] = null;
}
$attr_index = 3;
break;
case 'select':
case 'multiselect':
// select($name, $options = array(), $selected = null, $attributes = array())
// Set defaults and attributes array and call functions
if (!isset($parameters[1])) $parameters[1] = array();
if (!isset($parameters[2])) $parameters[2] = null;
$attr_index = 3;
break;
default:
// text($name, $value = null, $attributes = array())
// textarea($name, $value = null, $attributes = array())
// Covers all the other methods
if (!isset($parameters[1])) $parameters[1] = null;
$attr_index = 2;
break;
}
if (in_array($function, $types)) {
$attributes = isset($parameters[$attr_index]) ? $parameters[$attr_index] : array('class' => '');
$attributes['class'] = isset($attributes['class']) ? $attributes['class'] . ' form-control' : 'form-control';
$parameters[$attr_index] = $attributes;
}
$parameters = Helpers::set_multi_class_attributes(
$function,
$method_array,
$parameters,
$attr_index,
'input-',
'span'
);
$method = $function;
}
if (method_exists('Bootstrapper\Form', $method)) {
return call_user_func_array('static::' . $method, $parameters);
} elseif (method_exists(static::getFacadeAccessor(), $method)) {
return parent::__callStatic($method, $parameters);
} else {
try {
//Try solving a macro
return parent::__callStatic($method, $parameters);
} catch (\BadMethodCallException $e) {
//Silences in case there is no macro and continues execution
}
}
//.........這裏部分代碼省略.........