本文整理汇总了PHP中self::set方法的典型用法代码示例。如果您正苦于以下问题:PHP self::set方法的具体用法?PHP self::set怎么用?PHP self::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fromLocaleString
public static function fromLocaleString($localeString)
{
$locale = new self();
preg_match('/([a-z]{2})(-([a-zA-Z]{2}))*/i', $localeString, $matches);
if (array_key_exists(1, $matches)) {
$locale->set('language', strtolower($matches[1]));
}
if (array_key_exists(3, $matches)) {
$locale->set('country', strtolower($matches[3]));
}
return $locale;
}
示例2: loadTemplate
public function loadTemplate($templateName, $vars = array())
{
$class = new self();
$class->viewname = $this->viewname;
$class->set($vars);
return $class->output($templateName);
}
示例3: render
/**
* (non-PHPdoc)
* @see Simplify_ViewInterface::render()
*/
public function render(\Simplify\RenderableInterface $object = null)
{
if (empty($object)) {
$object = $this->object;
}
$template = $object->getTemplate();
if ($template === false) {
return '';
}
\Simplify::response()->header('Content-Type: text/html; charset=UTF-8');
$output = $this->internalRender($object, $template);
$layout = $object->getLayout();
if ($layout !== false) {
if (empty($layout)) {
$layout = $this->getLayout();
}
$view = new self();
$view->copyAll($object);
$view->copyAll($this);
$view->set('layout_content', $output);
$view->setTemplate($layout);
$view->setTemplatesPath($object->getLayoutsPath());
$view->setLayout(false);
$output = $view->render();
}
return $output;
}
示例4: newFromReport
static function newFromReport($oReport, $iGroupId = 0)
{
$obj = new self();
$obj->set($oReport);
$obj->groupId = (int) $iGroupId;
return $obj;
}
示例5: getInstanceByRow
/**
* Function to get instance of this model
* @param <Array> $rowData
* @return <Settings_SysVars_Field_Model> field model
*/
public static function getInstanceByRow($rowData) {
$fieldModel = new self();
foreach ($rowData as $key => $value) {
$fieldModel->set($key, $value);
}
return $fieldModel;
}
示例6: quick
/**
* Render content quickly
*
* @param string $root
* @param string $template
* @param array $env
* @return string
*/
public static function quick($root, $template, array $env = array())
{
$T = new self($root);
$T->set($env);
ob_start();
$T->display($template);
return ob_get_clean();
}
示例7: create
/**
* Ajoute un champ dans la configuration du formulaire
*
* @param string $varName Nom du champs à ajouter
*
* @return self
*/
public function create($varName)
{
$elmt = new self();
$elmt->set('', 'test')->set(false, 'obligatoire');
$this->set($elmt, $varName);
$this->varName = $varName;
return $this;
}
示例8: fromArray
/**
* Function to get Field instance from array
* @return <Settings_MappedFields_Field_Model>
*/
public static function fromArray($row = [])
{
$instance = new self();
foreach ($row as $name => $value) {
$instance->set($name, $value);
}
return $instance;
}
示例9: generate
/**
* Generate a view and return it
*
* @param string $view
* @param array $config
* @param array $data
*
* @return \self
*/
public static function generate($view = null, $config = null, $data = array())
{
$v = new self($view, $config);
if (!empty($data)) {
$v->set($data);
}
return $v;
}
示例10: fromObject
/**
* @param object $projection
*
* @return \Cubiche\Core\Projection\DefaultProjectionBuilder
*/
public static function fromObject($projection)
{
$builder = new self();
foreach (self::projectionProperties($projection) as $property => $value) {
$builder->set($property, $value);
}
return $builder;
}
示例11: create_from_array
public static function create_from_array($menu_items)
{
$items_comp = new self();
foreach ($menu_items as $slug => $menu_item) {
$menu_item['slug'] = $slug;
$items_comp->set($slug, self::create_menu_item($menu_item));
}
return $items_comp;
}
示例12: create
public static function create($data)
{
$manager = new self();
$manager->setDefaultDirectories(new Directories('default', $data['directories'], $manager));
foreach ($data['servers'] as $name => $server) {
$manager->set(new Server($name, $server, $manager));
}
foreach ($data['sources'] as $name => $source) {
$manager->set(Source::make($name, $source, $manager));
}
foreach ($data['environments'] as $name => $environment) {
$manager->set(new Environment($name, $environment, $manager));
}
foreach ($data['tasks'] as $name => $tasks) {
$manager->set(new Tasks($name, $tasks, $manager));
}
return $manager;
}
示例13: register
public static function register($username, $name, $email, $admin, $password)
{
$id = DataFacade::register($username, $name, $email, $admin, $password);
if ($id) {
$u = new self();
return $u->set('id', $id)->select();
}
return null;
}
示例14: add
public function add($link, $text, $name = null)
{
$nav = new self();
$nav->set($link, $text);
$this->_subnavigation[$name] = $nav;
// Set member var
if ($name) {
$this->{$name} = $this->_subnavigation[$name];
}
}
示例15: fromTokenData
public static function fromTokenData(array $data) : self
{
$instance = new self();
$instance->data = [];
foreach ($data as $key => $value) {
$instance->set((string) $key, $value);
}
$instance->originalData = $instance->data;
return $instance;
}