Back to Stream class

Method deleteContextEntry

public void
deleteContextEntry
(mixed $wrapper, mixed $name)
Deletes a particular setting from a context
Parameters
  • string $wrapper The wrapper to use
  • string $name The option to unset
Returns
  • void
Since
  • 1.7.0
-
  • https://www.php.net/stream_context_create
Class: Stream
Project: Joomla

Method deleteContextEntry - Source code

/**
 * Deletes a particular setting from a context
 *
 * @param   string  $wrapper  The wrapper to use
 * @param   string  $name     The option to unset
 *
 * @return  void
 *
 * @link    https://www.php.net/stream_context_create
 * @since   1.7.0
 */
public function deleteContextEntry($wrapper, $name)
{
    // Check whether the wrapper is set
    if (isset($this->contextOptions[$wrapper])) {
        // Check that entry is set for that wrapper
        if (isset($this->contextOptions[$wrapper][$name])) {
            // Unset the item
            unset($this->contextOptions[$wrapper][$name]);
            // Check that there are still items there
            if (!\count($this->contextOptions[$wrapper])) {
                // Clean up an empty wrapper context option
                unset($this->contextOptions[$wrapper]);
            }
        }
    }
    // Rebuild the context and apply it to the stream
    $this->_buildContext();
}