/usr/share/php/Composer/DependencyResolver/RuleWatchChain.php is in composer 1.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\DependencyResolver;
/**
* An extension of SplDoublyLinkedList with seek and removal of current element
*
* SplDoublyLinkedList only allows deleting a particular offset and has no
* method to set the internal iterator to a particular offset.
*
* @author Nils Adermann <naderman@naderman.de>
*/
class RuleWatchChain extends \SplDoublyLinkedList
{
protected $offset = 0;
/**
* Moves the internal iterator to the specified offset
*
* @param int $offset The offset to seek to.
*/
public function seek($offset)
{
$this->rewind();
for ($i = 0; $i < $offset; $i++, $this->next());
}
/**
* Removes the current element from the list
*
* As SplDoublyLinkedList only allows deleting a particular offset and
* incorrectly sets the internal iterator if you delete the current value
* this method sets the internal iterator back to the following element
* using the seek method.
*/
public function remove()
{
$offset = $this->key();
$this->offsetUnset($offset);
$this->seek($offset);
}
}
|