Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/updraftp.../vendor/symfony/event-di...
File: GenericEvent.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/*
[2] Fix | Delete
* This file is part of the Symfony package.
[3] Fix | Delete
*
[4] Fix | Delete
* (c) Fabien Potencier <fabien@symfony.com>
[5] Fix | Delete
*
[6] Fix | Delete
* For the full copyright and license information, please view the LICENSE
[7] Fix | Delete
* file that was distributed with this source code.
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
namespace Symfony\Component\EventDispatcher;
[11] Fix | Delete
[12] Fix | Delete
/**
[13] Fix | Delete
* Event encapsulation class.
[14] Fix | Delete
*
[15] Fix | Delete
* Encapsulates events thus decoupling the observer from the subject they encapsulate.
[16] Fix | Delete
*
[17] Fix | Delete
* @author Drak <drak@zikula.org>
[18] Fix | Delete
*/
[19] Fix | Delete
class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
[20] Fix | Delete
{
[21] Fix | Delete
protected $subject;
[22] Fix | Delete
protected $arguments;
[23] Fix | Delete
[24] Fix | Delete
/**
[25] Fix | Delete
* Encapsulate an event with $subject and $args.
[26] Fix | Delete
*
[27] Fix | Delete
* @param mixed $subject The subject of the event, usually an object or a callable
[28] Fix | Delete
* @param array $arguments Arguments to store in the event
[29] Fix | Delete
*/
[30] Fix | Delete
public function __construct($subject = null, array $arguments = array())
[31] Fix | Delete
{
[32] Fix | Delete
$this->subject = $subject;
[33] Fix | Delete
$this->arguments = $arguments;
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
/**
[37] Fix | Delete
* Getter for subject property.
[38] Fix | Delete
*
[39] Fix | Delete
* @return mixed The observer subject
[40] Fix | Delete
*/
[41] Fix | Delete
public function getSubject()
[42] Fix | Delete
{
[43] Fix | Delete
return $this->subject;
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
/**
[47] Fix | Delete
* Get argument by key.
[48] Fix | Delete
*
[49] Fix | Delete
* @param string $key Key
[50] Fix | Delete
*
[51] Fix | Delete
* @return mixed Contents of array key
[52] Fix | Delete
*
[53] Fix | Delete
* @throws \InvalidArgumentException if key is not found
[54] Fix | Delete
*/
[55] Fix | Delete
public function getArgument($key)
[56] Fix | Delete
{
[57] Fix | Delete
if ($this->hasArgument($key)) {
[58] Fix | Delete
return $this->arguments[$key];
[59] Fix | Delete
}
[60] Fix | Delete
[61] Fix | Delete
throw new \InvalidArgumentException(sprintf('Argument "%s" not found.', $key));
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
/**
[65] Fix | Delete
* Add argument to event.
[66] Fix | Delete
*
[67] Fix | Delete
* @param string $key Argument name
[68] Fix | Delete
* @param mixed $value Value
[69] Fix | Delete
*
[70] Fix | Delete
* @return $this
[71] Fix | Delete
*/
[72] Fix | Delete
public function setArgument($key, $value)
[73] Fix | Delete
{
[74] Fix | Delete
$this->arguments[$key] = $value;
[75] Fix | Delete
[76] Fix | Delete
return $this;
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
/**
[80] Fix | Delete
* Getter for all arguments.
[81] Fix | Delete
*
[82] Fix | Delete
* @return array
[83] Fix | Delete
*/
[84] Fix | Delete
public function getArguments()
[85] Fix | Delete
{
[86] Fix | Delete
return $this->arguments;
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
/**
[90] Fix | Delete
* Set args property.
[91] Fix | Delete
*
[92] Fix | Delete
* @param array $args Arguments
[93] Fix | Delete
*
[94] Fix | Delete
* @return $this
[95] Fix | Delete
*/
[96] Fix | Delete
public function setArguments(array $args = array())
[97] Fix | Delete
{
[98] Fix | Delete
$this->arguments = $args;
[99] Fix | Delete
[100] Fix | Delete
return $this;
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
/**
[104] Fix | Delete
* Has argument.
[105] Fix | Delete
*
[106] Fix | Delete
* @param string $key Key of arguments array
[107] Fix | Delete
*
[108] Fix | Delete
* @return bool
[109] Fix | Delete
*/
[110] Fix | Delete
public function hasArgument($key)
[111] Fix | Delete
{
[112] Fix | Delete
return array_key_exists($key, $this->arguments);
[113] Fix | Delete
}
[114] Fix | Delete
[115] Fix | Delete
/**
[116] Fix | Delete
* ArrayAccess for argument getter.
[117] Fix | Delete
*
[118] Fix | Delete
* @param string $key Array key
[119] Fix | Delete
*
[120] Fix | Delete
* @return mixed
[121] Fix | Delete
*
[122] Fix | Delete
* @throws \InvalidArgumentException if key does not exist in $this->args
[123] Fix | Delete
*/
[124] Fix | Delete
public function offsetGet($key)
[125] Fix | Delete
{
[126] Fix | Delete
return $this->getArgument($key);
[127] Fix | Delete
}
[128] Fix | Delete
[129] Fix | Delete
/**
[130] Fix | Delete
* ArrayAccess for argument setter.
[131] Fix | Delete
*
[132] Fix | Delete
* @param string $key Array key to set
[133] Fix | Delete
* @param mixed $value Value
[134] Fix | Delete
*/
[135] Fix | Delete
public function offsetSet($key, $value)
[136] Fix | Delete
{
[137] Fix | Delete
$this->setArgument($key, $value);
[138] Fix | Delete
}
[139] Fix | Delete
[140] Fix | Delete
/**
[141] Fix | Delete
* ArrayAccess for unset argument.
[142] Fix | Delete
*
[143] Fix | Delete
* @param string $key Array key
[144] Fix | Delete
*/
[145] Fix | Delete
public function offsetUnset($key)
[146] Fix | Delete
{
[147] Fix | Delete
if ($this->hasArgument($key)) {
[148] Fix | Delete
unset($this->arguments[$key]);
[149] Fix | Delete
}
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
/**
[153] Fix | Delete
* ArrayAccess has argument.
[154] Fix | Delete
*
[155] Fix | Delete
* @param string $key Array key
[156] Fix | Delete
*
[157] Fix | Delete
* @return bool
[158] Fix | Delete
*/
[159] Fix | Delete
public function offsetExists($key)
[160] Fix | Delete
{
[161] Fix | Delete
return $this->hasArgument($key);
[162] Fix | Delete
}
[163] Fix | Delete
[164] Fix | Delete
/**
[165] Fix | Delete
* IteratorAggregate for iterating over the object like an array.
[166] Fix | Delete
*
[167] Fix | Delete
* @return \ArrayIterator
[168] Fix | Delete
*/
[169] Fix | Delete
public function getIterator()
[170] Fix | Delete
{
[171] Fix | Delete
return new \ArrayIterator($this->arguments);
[172] Fix | Delete
}
[173] Fix | Delete
}
[174] Fix | Delete
[175] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function