当前位置: 首页>>代码示例>>PHP>>正文


PHP Set::remove方法代码示例

本文整理汇总了PHP中Set::remove方法的典型用法代码示例。如果您正苦于以下问题:PHP Set::remove方法的具体用法?PHP Set::remove怎么用?PHP Set::remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Set的用法示例。


在下文中一共展示了Set::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testRemove

 public function testRemove()
 {
     $this->items['alpha'] = new MockComparableItem('alpha');
     $this->items['bravo'] = new MockComparableItem('bravo');
     $this->items['charlie'] = new MockComparableItem('charlie');
     $this->items['delta'] = new MockComparableItem('delta');
     $this->object->add($this->items['delta']);
     $this->object->add($this->items['alpha']);
     $this->object->add($this->items['bravo']);
     $this->object->add($this->items['charlie']);
     $this->object->remove($this->items['bravo']);
     $expected = array($this->items['alpha'], $this->items['charlie'], $this->items['delta']);
     $this->assertEquals($expected, $this->readAttribute($this->object, 'elements'));
 }
开发者ID:versionable,项目名称:common,代码行数:14,代码来源:TreeSetTest.php

示例2: __removeIgnored

 /**
  * Removes any ignored associations, as defined in the model settings, from
  * the $this->contain array.
  *
  * @access public
  *
  * @param object $Model Model object
  *
  * @return boolean
  */
 private function __removeIgnored($Model)
 {
     if (!$this->settings[$Model->alias]['ignore']) {
         return true;
     }
     $ignore = array_unique($this->settings[$Model->alias]['ignore']);
     foreach ($ignore as $path) {
         if (Set::check($this->contain, $path)) {
             $this->contain = Set::remove($this->contain, $path);
         }
     }
     return true;
 }
开发者ID:nani8124,项目名称:infinitas,代码行数:23,代码来源:CopyableBehavior.php

示例3: delete

 /**
  * Used to delete a variable from Configure.
  *
  * Usage:
  * {{{
  * Configure::delete('Name'); will delete the entire Configure::Name
  * Configure::delete('Name.key'); will delete only the Configure::Name[key]
  * }}}
  *
  * @link http://book.cakephp.org/view/928/delete
  * @param string $var the var to be deleted
  * @return void
  */
 public static function delete($var = null)
 {
     if (strpos($var, '.') === false) {
         unset(self::$_values[$var]);
         return;
     }
     $names = explode('.', $var, 2);
     self::$_values[$names[0]] = Set::remove(self::$_values[$names[0]], $names[1]);
 }
开发者ID:no2key,项目名称:Web-Framework-Benchmark,代码行数:22,代码来源:configure.php

示例4: catch

} catch (Exception $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n\n";
}
// readonly collection
echo "Construct as readonly\n";
$set2 = new Set($arr);
$set2->freeze();
Debug::dump($set2->isFrozen());
try {
    echo "Adding Jack\n";
    Debug::dump($set2->append($jack));
} catch (Exception $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n\n";
}
try {
    echo "Removing Jack\n";
    $set2->remove($jack);
} catch (Exception $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n\n";
}
try {
    echo "Clearing\n";
    $set2->clear();
} catch (Exception $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n\n";
}
foreach ($set2 as $key => &$val) {
    $val = FALSE;
}
echo "Contains Jack?\n";
Debug::dump($set2->contains($jack));
开发者ID:vrana,项目名称:nette,代码行数:31,代码来源:test.Set.php

示例5: delete

 /**
  * Removes a variable from session.
  *
  * @param string $name Session variable to remove
  * @return boolean Success
  * @access public
  */
 public function delete($name)
 {
     if ($this->check($name)) {
         if (in_array($name, $this->watchKeys)) {
             trigger_error(sprintf(__('Deleting session key {%s}', true), $name), E_USER_NOTICE);
         }
         $this->__overwrite($_SESSION, Set::remove($_SESSION, $name));
         return $this->check($name) == false;
     }
     $this->__setError(2, sprintf(__("%s doesn't exist", true), $name));
     return false;
 }
开发者ID:radig,项目名称:CakeMongoSession,代码行数:19,代码来源:cake_mongo_session.php

示例6: delete

 /**
  * Delete a cookie value
  *
  * Optional [Name.], required key
  * $this->Cookie->read('Name.key);
  *
  * You must use this method before any output is sent to the browser.
  * Failure to do so will result in header already sent errors.
  *
  * @param string $key
  *        	Key of the value to be deleted
  * @return void
  * @access public
  */
 function delete($key)
 {
     if (empty($this->__values)) {
         $this->read();
     }
     if (strpos($key, '.') === false) {
         if (isset($this->__values[$key]) && is_array($this->__values[$key])) {
             foreach ($this->__values[$key] as $idx => $val) {
                 $this->__delete("[{$key}][{$idx}]");
             }
         }
         $this->__delete("[{$key}]");
         unset($this->__values[$key]);
         return;
     }
     $names = explode('.', $key, 2);
     if (isset($this->__values[$names[0]])) {
         $this->__values[$names[0]] = Set::remove($this->__values[$names[0]], $names[1]);
     }
     $this->__delete('[' . implode('][', $names) . ']');
 }
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:35,代码来源:cookie.php

示例7: delete

 /**
  * Delete a cookie value
  *
  * Optional [Name.], reguired key
  * $this->Cookie->read('Name.key);
  *
  * You must use this method before any output is sent to the browser.
  * Failure to do so will result in header already sent errors.
  *
  * @param string $key Key of the value to be deleted
  * @return void
  * @access public
  */
 public function delete($key)
 {
     if (empty($this->__values)) {
         $this->read();
     }
     if (strpos($key, '.') === false) {
         unset($this->__values[$key]);
         $this->__delete("[{$key}]");
         return;
     }
     $names = explode('.', $key, 2);
     $this->__values[$names[0]] = Set::remove($this->__values[$names[0]], $names[1]);
     $this->__delete('[' . implode('][', $names) . ']');
 }
开发者ID:evrard,项目名称:cakephp2x,代码行数:27,代码来源:cookie.php

示例8: del

 /**
  * Removes a variable from session.
  *
  * @param string $name Session variable to remove
  * @return boolean Success
  * @access public
  */
 function del($name)
 {
     if ($this->check($name)) {
         if ($var = $this->__validateKeys($name)) {
             if (in_array($var, $this->watchKeys)) {
                 trigger_error('Deleting session key {' . $var . '}', E_USER_NOTICE);
             }
             $this->__overwrite($_SESSION, Set::remove($_SESSION, $var));
             return $this->check($var) == false;
         }
     }
     $this->__setError(2, "{$name} doesn't exist");
     return false;
 }
开发者ID:laiello,项目名称:myopensources,代码行数:21,代码来源:session.php

示例9: prepDataForMigration

 function prepDataForMigration($exclude = array())
 {
     // $this->LocalModel, $this->entry, $this->targetInstance
     // $Model, $entry, $targetInstance,
     $settings = $this->LocalModel->migrationSettings();
     $exclude = array_merge($exclude, array($this->LocalModel->primaryKey), $settings['excludeFields']);
     $fullName = $this->LocalModel->getFullName();
     $alias = $this->LocalModel->alias;
     $entry = $this->entry;
     $assoc = $this->LocalModel->getMigratedAssociations();
     if (!empty($assoc)) {
         foreach ($assoc as $name => $opt) {
             $paths = array();
             if (!empty($opt['path'])) {
                 $paths = Migration::extractPath($entry[$alias], $opt['path']);
             } elseif (!empty($opt['foreignKey']) && array_key_exists($opt['foreignKey'], $entry[$alias])) {
                 $paths = array($opt['foreignKey'] => $entry[$alias][$opt['foreignKey']]);
             }
             //debug($paths);
             if (!empty($paths)) {
                 $AssocModel = Migration::getLocalModel($opt['className']);
                 foreach ($paths as $path => $local_id) {
                     $removed = false;
                     $remote_id = $AssocModel->getRemoteId($local_id, $this->targetInstance);
                     if (is_null($remote_id)) {
                         if (isset($opt['unsetLevel'])) {
                             $entry[$alias] = Set::remove($entry[$alias], implode('.', array_slice(explode('.', $path), 0, $opt['unsetLevel'])));
                             $removed = true;
                         }
                         if (!empty($opt['autoTrack'])) {
                             $entry['MigrationTracking'][$opt['className']][$local_id] = 1;
                         }
                         if (!empty($opt['autoSelect'])) {
                             $this->Batch->Process->autoSelect[] = array('model' => $opt['className'], 'local_id' => $local_id);
                         }
                         $entry['MigrationMissing'][] = array('model' => $opt['className'], 'local_id' => $local_id);
                     }
                     if (!$removed) {
                         $entry[$alias] = Set::insert($entry[$alias], $path, $remote_id);
                     }
                 }
             }
         }
         //debug($assoc);
     }
     //debug($entry[$alias]);
     $raw = $this->LocalModel->getRawEntry($entry);
     $data = $raw[$alias];
     $data = array_diff_key($data, array_flip($exclude));
     $entry['MigrationData'] = $data;
     return $entry;
 }
开发者ID:kevthunder,项目名称:cake-migration,代码行数:52,代码来源:entry_sync.php

示例10: flash

 /**
  * Output the flash message into the view. Uses the flash.tpl element.
  *
  * @access public
  * @param array $params
  * @return string|null
  */
 public function flash(array $params = array())
 {
     if ($this->View->hasObject('Session')) {
         $message = $this->View->Session->get('App.flash');
         $this->View->Session->set('App.flash', '');
     } else {
         $message = Set::extract($_SESSION, 'App.flash');
         $_SESSION = Set::remove($_SESSION, 'App.flash');
     }
     if (!empty($message)) {
         $params = array('message' => $message) + $params;
         return $this->open('flash', $params);
     }
 }
开发者ID:hjr3,项目名称:titon,代码行数:21,代码来源:EngineAbstract.php

示例11: remove

 /**
  * Removes the given element from the collection if it is found.
  * 
  * @param mixed $value
  * @param bool $strict Use a strict comparison (===) if TRUE
  */
 public function remove($value, $strict = false)
 {
     if ($this->guard !== null) {
         $this->guard->checkMemberGuard(new GuardPermission(__FUNCTION__, 'call'));
     }
     $this->set->remove($value, $strict);
 }
开发者ID:bahrmichael,项目名称:eyeos,代码行数:13,代码来源:collection.php

示例12: remove

 /**
  * Remove a menu item
  *
  * @param string $path dot separated path in the array.
  * @return void
  */
 public static function remove($path)
 {
     self::$_items = Set::remove(self::$_items, $path);
 }
开发者ID:romaing,项目名称:croogo-rg,代码行数:10,代码来源:CroogoNav.php

示例13: testFunkyKeyRemoval

 /**
  * testFunkyKeyRemoval method
  *
  * @access public
  * @return void
  */
 function testFunkyKeyRemoval()
 {
     $set = Set::remove(array('Session Test' => 'test'), 'Session Test');
     $this->assertFalse(Set::check($set, 'Session Test'));
 }
开发者ID:evrard,项目名称:cakephp2x,代码行数:11,代码来源:set.test.php

示例14: __filterMigrationTable

 function __filterMigrationTable($myTables)
 {
     $mySchemaInfoKey = array_search($this->_migrationTable, $myTables);
     $filteredArray = Set::remove($myTables, $mySchemaInfoKey);
     sort($filteredArray);
     return $filteredArray;
 }
开发者ID:rogerwu99,项目名称:GF,代码行数:7,代码来源:yammy.php

示例15: delete

 /**
  * Used to delete a variable from the Configure instance.
  *
  * Usage:
  * {{{
  * Configure::delete('Name'); will delete the entire Configure::Name
  * Configure::delete('Name.key'); will delete only the Configure::Name[key]
  * }}}
  *
  * @link http://book.cakephp.org/view/928/delete
  * @param string $var the var to be deleted
  * @return void
  * @access public
  */
 function delete($var = null)
 {
     $_this =& Configure::getInstance();
     if (strpos($var, '.') === false) {
         unset($_this->{$var});
         return;
     }
     $names = explode('.', $var, 2);
     $_this->{$names[0]} = Set::remove($_this->{$names[0]}, $names[1]);
 }
开发者ID:vovchik09,项目名称:proximus-admin,代码行数:24,代码来源:configure.php


注:本文中的Set::remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。