Lines Matching refs:source

833      * @param Element|string|array $source
838 public static function encodeDER($source, $mapping, $special = [])
841 return self::encode_der($source, $mapping, null, $special);
847 * @param Element|string|array|null $source
853 private static function encode_der($source, array $mapping, $idx = null, array $special = [])
855 if ($source instanceof Element) {
856 return $source->element;
860 if (isset($mapping['default']) && $source === $mapping['default']) {
866 $source = $special[$idx]($source);
883 foreach ($source as $content) {
904 if (!array_key_exists($key, $source)) {
911 $temp = self::encode_der($source[$key], $child, $key, $special);
948 if (!isset($source[$key])) {
952 $temp = self::encode_der($source[$key], $child, $key, $special);
989 if (is_numeric($source)) {
990 $source = new BigInteger($source);
992 $value = $source->toBytes(true);
994 $value = array_search($source, $mapping['mapping']);
1009 // if $source does _not_ include timezone information within it then assume that the timezone is GMT
1010 $date = new \DateTime($source, new \DateTimeZone('GMT'));
1011 // if $source _does_ include timezone information within it then convert the time to GMT
1020 if (in_array($mapping['mapping'][$i], $source)) {
1053 $value = $source;
1056 $value = self::encodeOID($source);
1065 case !isset($source):
1067 case is_int($source):
1068 case $source instanceof BigInteger:
1069 return self::encode_der($source, ['type' => self::TYPE_INTEGER] + $mapping, null, $special);
1070 case is_float($source):
1071 return self::encode_der($source, ['type' => self::TYPE_REAL] + $mapping, null, $special);
1072 case is_bool($source):
1073 return self::encode_der($source, ['type' => self::TYPE_BOOLEAN] + $mapping, null, $special);
1074 case is_array($source) && count($source) == 1:
1075 $typename = implode('', array_keys($source));
1078 return self::encode_der($source[$typename], ['type' => $outtype] + $mapping, null, $special);
1093 return self::encode_der($source, $filters + $mapping, null, $special);
1108 $value = $source;
1111 $value = $source ? "\xFF" : "\x00";
1195 * @param string $source
1198 public static function encodeOID($source)
1207 if (!preg_match('#(?:\d+\.)+#', $source)) {
1208 $oid = isset(self::$reverseOIDs[$source]) ? self::$reverseOIDs[$source] : false;
1210 $oid = $source;