original_string: public static function convertToMaestranoObject($resp, $preset)
    {
      $types = array(
        'account_bill' => 'Maestrano_Account_Bill',
        'account_recurring_bill' => 'Maestrano_Account_RecurringBill',
        'account_group' => 'Maestrano_Account_Group',
        'account_user' => 'Maestrano_Account_User',
        'account_reseller' => 'Maestrano_Account_Reseller',
      );
  
      if (self::isList($resp)) {
        $mapped = array();
        foreach ($resp as $i)
          array_push($mapped, self::convertToMaestranoObject($i, $preset));
        return $mapped;
  
      } else if (is_array($resp)) {
        if (isset($resp['object'])
            && is_string($resp['object'])
            && isset($types[$resp['object']])) {
  
          $class = $types[$resp['object']];
        } else {
          $class = 'Maestrano_Api_Object';
        }
        return Maestrano_Api_Object::scopedConstructFrom($class, $resp, $preset);
      } else {
        // Automatically convert dates
        if (preg_match('/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/', $resp)) {
          return new DateTime($resp);
        } else {
          return $resp;
        }
      }
    }
code: public static function convertToMaestranoObject($resp, $preset)
    {
      $types = array(
        'account_bill' => 'Maestrano_Account_Bill',
        'account_recurring_bill' => 'Maestrano_Account_RecurringBill',
        'account_group' => 'Maestrano_Account_Group',
        'account_user' => 'Maestrano_Account_User',
        'account_reseller' => 'Maestrano_Account_Reseller',
      );
  
      if (self::isList($resp)) {
        $mapped = array();
        foreach ($resp as $i)
          array_push($mapped, self::convertToMaestranoObject($i, $preset));
        return $mapped;
  
      } else if (is_array($resp)) {
        if (isset($resp['object'])
            && is_string($resp['object'])
            && isset($types[$resp['object']])) {
  
          $class = $types[$resp['object']];
        } else {
          $class = 'Maestrano_Api_Object';
        }
        return Maestrano_Api_Object::scopedConstructFrom($class, $resp, $preset);
      } else {
        // Automatically convert dates
        if (preg_match('/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/', $resp)) {
          return new DateTime($resp);
        } else {
          return $resp;
        }
      }
    }
code_tokens: public static function convertToMaestranoObject ( $ resp , $ preset ) { $ types = array ( 'account_bill' => 'Maestrano_Account_Bill' , 'account_recurring_bill' => 'Maestrano_Account_RecurringBill' , 'account_group' => 'Maestrano_Account_Group' , 'account_user' => 'Maestrano_Account_User' , 'account_reseller' => 'Maestrano_Account_Reseller' , ) ; if ( self :: isList ( $ resp ) ) { $ mapped = array ( ) ; foreach ( $ resp as $ i ) array_push ( $ mapped , self :: convertToMaestranoObject ( $ i , $ preset ) ) ; return $ mapped ; } else if ( is_array ( $ resp ) ) { if ( isset ( $ resp [ 'object' ] ) && is_string ( $ resp [ 'object' ] ) && isset ( $ types [ $ resp [ 'object' ] ] ) ) { $ class = $ types [ $ resp [ 'object' ] ] ; } else { $ class = 'Maestrano_Api_Object' ; } return Maestrano_Api_Object :: scopedConstructFrom ( $ class , $ resp , $ preset ) ; } else { // Automatically convert dates if ( preg_match ( '/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/' , $ resp ) ) { return new DateTime ( $ resp ) ; } else { return $ resp ; } } }
docstring: Converts a response from the Maestrano API to the corresponding PHP object.
  
  @param array $resp The response from the Maestrano API.
  @param string $apiToken
  @return Maestrano_Api_Object|array
docstring_tokens: Converts a response from the Maestrano API to the corresponding PHP object .