code: protected function getValue($data, $key = false)
      {
          $returnValue = $data;
          if ($key && is_object($data)) {
              $returnValue = $data->$key;
          }
          else if ($key && is_array($data)) {
              $returnValue = $data[$key];
          }
          return $returnValue;
      }
docs: Returns the value when given a piece of data.
  If the data item is a primitive or if no key was given, then the item
  is simply returned. However, if the data item is an object or array
  and a key was given, then returns the offset given by the key as a value.
  
  @param $data Mixed
  @param $key Int | String
  @return mixed