Exemplo n.º 1
0
 /**
  * Parses a locale into components.
  *
  * @param  reference $language The two-letter language code of type `CUStringObject` (always lowercased).
  * @param  reference $region **OPTIONAL. OUTPUT.** The two-letter country/region code of type `CUStringObject`
  * (always uppercased).
  * @param  reference $script **OPTIONAL. OUTPUT.** The four-letter script code of type `CUStringObject` (always
  * titlecased).
  * @param  reference $variants **OPTIONAL. OUTPUT.** The variants of type `CArrayObject` with elements of type
  * `CUStringObject` (always uppercased).
  * @param  reference $keywords **OPTIONAL. OUTPUT.** The keyword-value pairs of type `CMapObject` with values of
  * type `CUStringObject`.
  *
  * @return void
  */
 public function components(&$language, &$region = null, &$script = null, &$variants = null, &$keywords = null)
 {
     $subtags = Locale::parseLocale($this->m_name);
     if (CMap::hasKey($subtags, Locale::LANG_TAG)) {
         $language = $subtags[Locale::LANG_TAG];
     }
     if (CMap::hasKey($subtags, Locale::REGION_TAG)) {
         $region = $subtags[Locale::REGION_TAG];
     }
     if (CMap::hasKey($subtags, Locale::SCRIPT_TAG)) {
         $script = $subtags[Locale::SCRIPT_TAG];
     }
     $variants = CArray::make();
     for ($i = 0; $i < 15; $i++) {
         $key = Locale::VARIANT_TAG . $i;
         if (CMap::hasKey($subtags, $key)) {
             CArray::push($variants, $subtags[$key]);
         }
     }
     $variants = oop_a($variants);
     $keywords = oop_m($this->keywords($this->m_name));
 }
Exemplo n.º 2
0
 /**
  * Returns the certificate information associated with the response.
  *
  * @return CMapObject The certificate information associated with the response.
  */
 public function responseCertificateInfo()
 {
     assert('$this->m_done && !$this->m_hasError', vs(isset($this), get_defined_vars()));
     $key = "certinfo";
     if (CMap::hasKey($this->m_requestSummary, $key)) {
         return oop_x($this->m_requestSummary[$key]);
     } else {
         return oop_m(CMap::make());
     }
 }
Exemplo n.º 3
0
 protected static function recurseQueryValueAfterParsing($value, $currDepth)
 {
     if ($currDepth == self::$ms_maxRecursionDepth) {
         return $value;
     }
     $currDepth++;
     if (!is_cmap($value)) {
         // Only interested in PHP's associative arrays.
         return $value;
     }
     if (CMap::areKeysSequential($value)) {
         $value = CArray::fromPArray($value);
         $len = CArray::length($value);
         for ($i = 0; $i < $len; $i++) {
             $value[$i] = self::recurseQueryValueAfterParsing($value[$i], $currDepth);
         }
         return oop_a($value);
     } else {
         foreach ($value as &$mapValue) {
             $mapValue = self::recurseQueryValueAfterParsing($mapValue, $currDepth);
         }
         unset($mapValue);
         return oop_m($value);
     }
 }
Exemplo n.º 4
0
/**
 * @ignore
 */
function _to_oop_tp($value)
{
    // Only used with OOP wrapping for third-party components.
    if (is_array($value)) {
        foreach ($value as &$mapValue) {
            $mapValue = _to_oop_tp($mapValue);
        }
        unset($mapValue);
        if (!CMap::areKeysSequential($value)) {
            $value = oop_m($value);
        } else {
            $value = oop_a(CArray::fromPArray($value));
        }
        return $value;
    }
    if ($value instanceof SplFixedArray) {
        $len = CArray::length($value);
        for ($i = 0; $i < $len; $i++) {
            $value[$i] = _to_oop_tp($value[$i]);
        }
        return oop_a($value);
    }
    return $value;
}
Exemplo n.º 5
0
 protected static function recurseValueAfterDecoding($value, $currDepth)
 {
     if ($currDepth == self::$ms_maxRecursionDepth) {
         return $value;
     }
     $currDepth++;
     if (is_string($value)) {
         return $value;
     }
     if (is_object($value)) {
         $value = (array) $value;
         foreach ($value as &$valueInMap) {
             $valueInMap = self::recurseValueAfterDecoding($valueInMap, $currDepth);
         }
         unset($valueInMap);
         $value = oop_m($value);
     } else {
         if (is_array($value)) {
             $value = CArray::fromPArray($value);
             $len = CArray::length($value);
             for ($i = 0; $i < $len; $i++) {
                 $value[$i] = self::recurseValueAfterDecoding($value[$i], $currDepth);
             }
             $value = oop_a($value);
         }
     }
     return $value;
 }