本文整理汇总了PHP中self::add方法的典型用法代码示例。如果您正苦于以下问题:PHP self::add方法的具体用法?PHP self::add怎么用?PHP self::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: suite
public static function suite()
{
$bus = new Sabel_Bus();
Sabel::fileUsing(dirname(__FILE__) . DS . "paginators" . DS . "Base.php", true);
$suite = new self();
$suite->add("Paginators_Status");
$suite->add("Paginators_Follower");
return $suite;
}
示例2: suite
public static function suite()
{
Sabel::fileUsing(dirname(__FILE__) . DS . "logics" . DS . "Base.php", true);
$suite = new self();
$suite->add("Logics_Register");
$suite->add("Logics_Status");
$suite->add("Logics_Follow");
$suite->add("Logics_User");
return $suite;
}
示例3: getDefaultChain
/**
* Get the default chain to use with clients
*
* @return CompositeFactory
*/
public static function getDefaultChain(ClientInterface $client)
{
$chain = new self();
$description = $client->getDescription();
if ($description instanceof ServiceDescription) {
$chain->add(new ServiceDescriptionFactory($description));
}
$chain->add(new ConcreteClassFactory($client));
return $chain;
}
示例4: install
public static function install(Migration $migration)
{
global $DB;
$table = getTableForItemType(__CLASS__);
if (!TableExists($table) && !TableExists("glpi_dropdown_plugin_order_taxes")) {
$migration->displayMessage("Installing {$table}");
//Install
$query = "CREATE TABLE `glpi_plugin_order_ordertaxes` (\n `id` int(11) NOT NULL auto_increment,\n `name` varchar(255) collate utf8_unicode_ci default NULL,\n `comment` text collate utf8_unicode_ci,\n PRIMARY KEY (`id`),\n KEY `name` (`name`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
$DB->query($query) or die($DB->error());
$taxes = new self();
foreach (array('20', '5.5', '19.6') as $tax) {
$taxes->add(array('name' => $tax));
}
} else {
//Update
$migration->displayMessage("Migrating {$table}");
//1.2.0
$migration->renameTable("glpi_dropdown_plugin_order_taxes", $table);
$migration->changeField($table, "ID", "id", "int(11) NOT NULL auto_increment");
$migration->changeField($table, "name", "name", "varchar(255) collate utf8_unicode_ci default NULL");
$migration->changeField($table, "comments", "comment", "text collate utf8_unicode_ci");
$migration->migrationOneTable($table);
//Remplace , by . in taxes
foreach ($DB->request("SELECT `name` FROM `{$table}`") as $data) {
if (strpos($data["name"], ',')) {
$name = str_replace(',', '.', $data["name"]);
$query = "UPDATE `{$table}`\n SET `name` = '" . $name . "'\n WHERE `name`= '" . $data["name"] . "'";
$DB->query($query) or die($DB->error());
}
}
}
}
示例5: createFirstAccess
static function createFirstAccess($ID)
{
$myProf = new self();
if (!$myProf->getFromDBByProfile($ID)) {
$myProf->add(array('profiles_id' => $ID, 'order' => 'w', 'reference' => 'w', 'validation' => 'w', 'cancel' => 'w', 'undo_validation' => 'w', 'bill' => 'w', 'delivery' => 'w', 'generate_order_odt' => 'w'));
}
}
示例6: log
/**
* Log an event.
*
* Log the event $event on the glpi_event table with all the others args, if
* $level is above or equal to setting from configuration.
*
* @param $items_id
* @param $type
* @param $level
* @param $service
* @param $event
**/
static function log($items_id, $type, $level, $service, $event)
{
global $DB;
$input = array('items_id' => intval($items_id), 'type' => $DB->escape($type), 'date' => $_SESSION["glpi_currenttime"], 'service' => $DB->escape($service), 'level' => intval($level), 'message' => $DB->escape($event));
$tmp = new self();
return $tmp->add($input);
}
示例7: sortByDependencies
/**
* @return MoodlePluginCollection
*/
public function sortByDependencies()
{
$elements = [];
foreach ($this->items as $item) {
$elements[$item->getComponent()] = [];
}
// Loop through a second time, only adding dependencies that exist in our list.
foreach ($this->items as $item) {
$dependencies = $item->getDependencies();
foreach ($dependencies as $dependency) {
if (array_key_exists($dependency, $elements)) {
$elements[$item->getComponent()][] = $dependency;
}
}
}
$sorter = new StringSort($elements);
$results = $sorter->sort();
$sorted = new self();
foreach ($results as $result) {
foreach ($this->items as $item) {
if ($result === $item->getComponent()) {
$sorted->add($item);
break;
}
}
}
if ($this->count() !== $sorted->count()) {
throw new \LogicException('The sorted list of plugins does not match the size of original list');
}
return $sorted;
}
示例8: createAdminAccess
static function createAdminAccess($ID)
{
$myProf = new self();
if (!$myProf->getFromDB($ID)) {
$myProf->add(array('id' => $ID, 'show_vip_tab' => '1'));
}
}
示例9: createFirstAccess
static function createFirstAccess($ID)
{
$myProf = new self();
if (!$myProf->getFromDBByProfile($ID)) {
$myProf->add(array('profiles_id' => $ID, 'addressing' => 'w', 'use_ping_in_equipment' => 1));
}
}
示例10: createAdminAccess
static function createAdminAccess($ID)
{
$myProfil = new self();
if (!$myProfil->getFromDB($ID)) {
$myProfil->add(array('id' => $ID, 'show_ticketmail_onglet' => '1'));
}
}
示例11: createFirstConfig
static function createFirstConfig()
{
$conf = new self();
if (!$conf->getFromDB(1)) {
$conf->add(array('id' => 1, 'add_waiting' => 1));
}
}
示例12: init
public static function init($run = true)
{
static $console;
if (!$console) {
// 实例化console
$console = new self('Think Console', '0.1');
// 读取指令集
if (is_file(CONF_PATH . 'command' . EXT)) {
$commands = (include CONF_PATH . 'command' . EXT);
if (is_array($commands)) {
foreach ($commands as $command) {
if (class_exists($command) && is_subclass_of($command, "\\think\\console\\command\\Command")) {
// 注册指令
$console->add(new $command());
}
}
}
}
}
if ($run) {
// 运行
$console->run();
} else {
return $console;
}
}
示例13: createFirstAccess
static function createFirstAccess($ID)
{
$myProf = new self();
if (!$myProf->getFromDBByProfile($ID)) {
$myProf->add(array('profiles_id' => $ID, 'mobile_user' => 'w'));
}
}
示例14: toMapped
/**
* @return OrderChain
**/
public function toMapped(ProtoDAO $dao, JoinCapableQuery $query)
{
$chain = new self();
foreach ($this->chain as $order) {
$chain->add($order->toMapped($dao, $query));
}
return $chain;
}
示例15: fromArray
public static function fromArray($type, array $array)
{
$list = new self($type);
foreach ($array as $element) {
$list->add($element);
}
return $list;
}