本文整理汇总了PHP中Illuminate\Support\Arr::forget方法的典型用法代码示例。如果您正苦于以下问题:PHP Arr::forget方法的具体用法?PHP Arr::forget怎么用?PHP Arr::forget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Arr
的用法示例。
在下文中一共展示了Arr::forget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Create a new Redis connection instance.
*
* @param array $servers
* @return void
*/
public function __construct(array $servers = [])
{
Arr::forget($servers, 'cluster');
Arr::forget($servers, 'options');
$this->clients = $this->createClient($servers);
$this->database = $this->saveDatabase($servers);
}
示例2: except
/**
* Get all of the input except for a specified array of items.
*
* @param array $keys
* @return array
*/
public function except($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
$results = self::all();
Arr::forget($results, $keys);
return $results;
}
示例3: onDeletedResource
public static final function onDeletedResource($response)
{
$data = (array) json_decode($response->getBody(), true);
Arr::forget($data, ['code', 'message']);
$data = json_encode($data);
return $response->withBody(Psr7\stream_for($data));
}
示例4: remove
/**
* Remove index
*
* @param $index
* @return $this
*/
public function remove($index)
{
if ($this->has($index)) {
Arr::forget($this->data, $index);
Arr::forget($this->metas, $this->firstIndex($index));
}
return $this;
}
示例5: forget
/**
* Remove an item from the configuration
*
* @param string $key
* @return boolean
*/
public function forget($key)
{
if ($this->has($key)) {
$this->arrHelper->forget($this->data, $key);
return true;
}
return false;
}
示例6: start
/**
* Starts the bot.
*
* @return void
*/
public function start()
{
set_error_handler(function ($errno, $errstr) {
if (!(error_reporting() & $errno)) {
return;
}
echo "[Error] {$errno} {$errstr}\r\n";
throw new \Exception($errstr, $errno);
}, E_ALL);
foreach ($this->commands as $command => $data) {
$this->websocket->on(Event::MESSAGE_CREATE, function ($message, $discord, $new) use($command, $data) {
$content = explode(' ', $message->content);
$config = Config::getConfig($this->configfile);
if ($content[0] == $config['prefix'] . $command) {
Arr::forget($content, 0);
$user_perms = @$config['perms']['perms'][$message->author->id];
if (empty($user_perms)) {
$user_perms = $config['perms']['default'];
}
if ($user_perms >= $data['perms']) {
try {
$data['class']::handleMessage($message, $content, $discord, $config, $this);
} catch (\Exception $e) {
$message->reply("There was an error running the command. `{$e->getMessage()}`");
}
} else {
$message->reply('You do not have permission to do this!');
echo "[Auth] User {$message->author->username} blocked from running {$config['prefix']}{$command}, <@{$message->author->id}>\r\n";
}
}
});
}
$this->websocket->on('ready', function ($discord) {
$discord->updatePresence($this->websocket, 'DiscordPHP ' . Discord::VERSION, false);
});
$this->websocket->on('error', function ($error, $ws) {
echo "[Error] {$error}\r\n";
});
$this->websocket->on('close', function () {
echo "[Close] WebSocket was closed.\r\n";
die;
});
$this->websocket->run();
}
示例7: unsetRequestInput
/**
* Unset a single item in a given Request’s input using dot-notation
* @param Request $request to modify
* @param string $key in dot-notation
*/
protected function unsetRequestInput(Request $request, $key)
{
if (strpos($key, '.')) {
// The data to unset is deeper than 1 level down
// meaning the final value of the input's first level key is expected to be an array
list($first_level_key, $key_rest) = explode('.', $key, 2);
// Pull out the input's existing first level value to modify it as an array
$first_level_value = $request->input($first_level_key);
//Request::input() pulls from all input data using dot-notation (ArrayAccess on Request would also pull out files which is undesirable here).
if (!is_array($first_level_value)) {
$first_level_value = [];
}
Arr::forget($first_level_value, $key_rest);
$request->merge([$first_level_key => $first_level_value]);
// The only current alternatives for modifying Request input data are merge() and replace(), the latter replacing the whole input data.
} else {
// The data to unset is in the first level
unset($request[$key]);
}
}
示例8: remove
/**
* {@inheritdoc}
*/
public function remove($key)
{
A::forget($this->expressions, $key);
$this->reload();
return $this;
}
示例9: originExcept
/**
* Get all of the origin input except for a specified array of items.
*
* @param array|mixed $keys item keys
* @return array
*/
public function originExcept($keys)
{
$keys = is_array($keys) ? $keys : func_get_args();
$results = $this->originAll();
Arr::forget($results, $keys);
return $results;
}
示例10: forget
/**
* Remove an item from the session.
*
* @param string $key
*
* @return void
*/
public static function forget($key)
{
Arr::forget($_SESSION, $key);
}
示例11: forget
/**
* Remove an item from the session.
*
* @param string $key
* @return void
*/
public function forget($key)
{
Arr::forget($this->attributes, $key);
}
示例12: removeValidationOption
/**
* Remove validation option.
*
* @param string $type
* @param string $key
*
* @throws ValidateException
*
* @return array
*/
protected function removeValidationOption($type, $key)
{
$this->checkValidationTypes($type);
Arr::forget($this->validationOptions, "{$type}.{$key}");
return $this->validationOptions;
}
示例13: forget
/**
* Forget meta value.
*
* @param string $key
*
* @return void
*/
public function forget($key)
{
Arr::forget($this->meta, $key);
}
示例14: offsetUnset
/**
* Unset the item at a given offset.
*
* @param string $key
* @return void
*/
public function offsetUnset($key)
{
$result = $this->convert();
Arr::forget($result, $key);
$this->items = Arr::dot($result);
}
示例15: forget
/**
* Forget a value from the repository file.
*
* @param string $key
*/
public function forget($key)
{
$contents = $this->getContents();
Arr::forget($contents, $key);
$this->saveContents($contents);
}