當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。