Beispiel #1
0
 /**
  * Change the case of all keys in current ArrayObject.
  *
  * @param string $case Case to which you want to covert array keys. Can be 'lower' or 'upper'.
  *
  * @return $this
  * @throws ArrayObjectException
  */
 public function changeKeyCase($case)
 {
     // validate case
     $case = new StringObject($case);
     $case->caseLower();
     $realCase = '';
     if ($case->equals('lower')) {
         $realCase = CASE_LOWER;
     } else {
         if ($case->equals('upper')) {
             $realCase = CASE_UPPER;
         } else {
             throw new ArrayObjectException(ArrayObjectException::MSG_PARAM_VALUE_OUT_OF_SCOPE, ['$case', '"lower" or "upper"']);
         }
     }
     $this->val(array_change_key_case($this->val(), $realCase));
     return $this;
 }
 public function testEquals()
 {
     $s = new StringObject('test string');
     $s2 = new StringObject('test string');
     $this->assertTrue($s->equals($s2));
 }