function it_should_remove_a_specific_TSProperty() { $tsProp = new TSProperty(); $tsProp->setName('foo'); $tsProp->setValue('bar'); $this->add($tsProp); $this->has('foo')->shouldEqual(true); $this->remove('foo'); $this->has('foo')->shouldEqual(false); }
/** * Given the start of TSPropertyArray hex data, and the count for the number of TSProperty structures in contains, * parse and split out the individual TSProperty structures. Return the full length of the TSPropertyArray data. * * @param string $tsPropertyArray * @param int $tsPropCount * @return int The length of the data in the TSPropertyArray */ protected function addTSPropData($tsPropertyArray, $tsPropCount) { $length = 0; for ($i = 0; $i < $tsPropCount; $i++) { // Prop length = name length + value length + type length + the space for the length data. $propLength = hexdec(substr($tsPropertyArray, $length, 2)) + hexdec(substr($tsPropertyArray, $length + 2, 2)) * 3 + 6; $tsProperty = new TSProperty(hex2bin(substr($tsPropertyArray, $length, $propLength))); $this->tsProperty[$tsProperty->getName()] = $tsProperty; $length += $propLength; } return $length; }