/**
 		Removes from the dictionary entries specified by elements in a given array.
 		\param $anArray
 */
 public function removeObjectsForKeys($anArray)
 {
     if (is_array($anArray)) {
         $anArray = RTArray::arrayWithArray($anArray);
     }
     for ($i = 0; $i < $anArray->count(); $i++) {
         $this->removeObjectForKey($anArray->objectAtIndex($i));
     }
 }
Example #2
0
 /**
 		Returns a new array containing the receiving array's elements that fall
 		within the limits specified by a given range.
 		\param $aRange
 		\returns RTArray
 */
 public function subarrayWithRange(RTRange $aRange)
 {
     $array = array();
     for ($i = $aRange->location; $i <= $aRange->location + $aRange->length; $i++) {
         $array[] = $this->objectAtIndex($i);
     }
     return RTArray::arrayWithArray($array);
 }
Example #3
0
 /**
 		Basically this is PHP's explode() function.
 		\returns RTArray
 */
 public function componentsSeparatedByString($aString)
 {
     return RTArray::arrayWithArray(explode($aString, $this->_string));
 }
Example #4
0
 /**
 		Removes from the receiving array the objects in another given array.
 		\param $anArray
 */
 public function removeObjectsInArray($anArray)
 {
     if (is_array($anArray) == YES) {
         $anArray = RTArray::arrayWithArray($anArray);
     }
     if (is_a($anArray, "RTArray") == YES) {
         for ($i = 0; $i < $anArray->count(); $i++) {
             $this->removeObject($anArray->objectAtIndex($i));
         }
     } else {
         throw new InvalidArgumentException("RTMutableArray::removeObjectsInArray expects an array");
     }
 }
Example #5
0
 /**
 		Returns a new array containing the dictionary's values.
 		\returns RTArray
 */
 public function allValues()
 {
     return RTArray::arrayWithArray(array_values($this->_data));
 }
Example #6
0
 public function testIteratorImplementation()
 {
     $array = RTArray::arrayWithArray(array("test", "one", "two", "three", "mic check"));
     foreach ($array as $key => $val) {
         $this->assertEquals($val, $array->objectAtIndex($key));
     }
 }
Example #7
0
 /**
 		Returns the components of the URLs path as an array.
 		\returns RTArray
 */
 public function pathComponents()
 {
     $path = RTString::stringWithString($this->path());
     $components = RTMutableArray::arrayWithArray($path->componentsSeparatedByString("/"));
     if ($components->count() > 0) {
         $components->removeObjectAtIndex(0);
     }
     return RTArray::arrayWithArray($components);
 }