Creates a new source file from the specified JSON map.
@param object $map A JSON map representing a source file.
@return static The instance corresponding to the specified JSON map.
347073
static function fromJson(object $map): self {
    return new static(
      isset($map->name) && is_string($map->name) ? $map->name : '',
      isset($map->source_digest) && is_string($map->source_digest) ? $map->source_digest : '',
      isset($map->source) && is_string($map->source) ? $map->source : '',
      isset($map->coverage) && is_array($map->coverage) ? $map->coverage : []
    );
  }
368545
public static function fromJson($json)
    {
        $object = json_decode($json);

        $recurrentPayment = new RecurrentPayment();

        if (isset($object->RecurrentPayment)) {
            $recurrentPayment->populate($object->RecurrentPayment);
        }

        return $recurrentPayment;
    }
291302
public static function typeMap(array $map = null, $merge = true)
    {
        if (is_array($map)) {
            static::$typeMap = $merge && static::$typeMap
                ? $map + static::$typeMap : $map;
        }

        return static::$typeMap;
    }
373200
public function transform($map)
    {
        if (is_callable($map)) {
            return $map($this);
        }

        $data = [];
        foreach ($map as $key) {
            $data[$key] = $this->{$key};
        }

        return $data;
    }
522570
public static JSONObject mapToJsonObject(Map<String, Object> map)
    {
        JSONObject jsonObj = new JSONObject();
        
        try {
            for (String key : map.keySet())
            {
                Object value = map.get(key);
                if (value instanceof Map)
                    jsonObj.put(key, AjaxProxyTask.mapToJsonObject((Map)value));
                else
                    jsonObj.put(key, value);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        
        return jsonObj;
    }
777164
public static function mapKey($origin, $map = [])
    {
        $result = is_array($origin) ? [] : new \stdClass();

        foreach ((array) $origin as $key => $val) {
            $newKey = self::getValue($map, $key);

            if ($newKey) {
                self::setValue($result, $newKey, $val);
            } else {
                self::setValue($result, $key, $val);
            }
        }

        return $result;
    }
187059
public static function create($key)
    {
        // Ignore arrays and objects
        if (is_object($key) or is_array($key)) {
            $key = '';
        }

        $key_string = strval($key);

        $key = new self;
        $key->raw = $key_string;

        $keys = explode('.', $key_string);

        foreach ($keys as $value) {
            $key->push($value);
        }

        $key->rewind();

        return $key;
    }
528665
public static String mapAsJson(Map<String, String> map) {

        JSONObject obj = new JSONObject();
        for (Map.Entry<String, String> entry : map.entrySet()) {
            try {
                obj.put(entry.getKey(), entry.getValue());
            } catch (JSONException e) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
        return obj.toString();
    }
1218178
function ( map, files ) {
            var arr = [];

            files.forEach( function ( file ) {
              arr.push( '\'' + file + '\'=>\'' + map[ file ] + '\'' );
            });

            var out = '<?php\n\n$files = [\n\t' + arr.join( ',\n\t' ) + '\n];\n';

            grunt.file.write( 'tmp/map.php', out );
            grunt.file.write( 'tmp/map.json', JSON.stringify( map ) );
          }
1004565
static function fromJson(object $map): self {
    return new static(
      isset($map->name) && is_string($map->name) ? $map->name : '',
      isset($map->url) && is_string($map->url) ? $map->url : null
    );
  }
113061
function downloadMap(map) {
    let data = map.exportAsJSON(),
        json = JSON.stringify(data),
        blob = new Blob([json], {type: "application/json"}),
        a = document.createElement("a");

    a.download = "example.json";
    a.href = URL.createObjectURL(blob);
    a.click();
}
863330
public static function fromJson($json)
    {
        $responseData = json_decode($json, true);

        if ( ! $responseData)
            return new static(false, [ResponseV3::E_INVALID_JSON]);

        return static::fromArray($responseData);
    }
330769
public static function map(array $object, array $map)
    {
        $result = [];

        foreach ($map as $from => $to) {
            if ( ! isset($object[$from])) {
                continue;
            }

            $result[$to] = $object[$from];
        }

        return $result;
    }
388261
public function prune($map = null)
    {
        if ($map) {
            $this->addUsingAlias(MapTableMap::COL_ID, $map->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }
161439
protected function define(MapperDefinition $map)
    {
        $map->type(ObjectMetadataKeyValuePair::class);

        $map->property(ObjectMetadataKeyValuePair::KEY)->to('key')->unique()->asVarchar(500);

        $map->property(ObjectMetadataKeyValuePair::VALUE)
            ->mappedVia(function ($value) {
                return json_encode($value);
            }, function (string $json) {
                return @json_decode($json, true);
            })
            ->to('value')
            ->asMediumText();
    }
1208396
public static <K, V> Xmap<K, V> create(Map<K, V> map) {
        Xmap<K, V> xmap = new Xmap<>();
        xmap.putAll(map);
        return xmap;
    }
649441
static function fromJson(object $map): self {
    return new static(
      isset($map->testName) && is_string($map->testName) ? $map->testName : '',
      isset($map->records) && is_array($map->records) ? array_map([Record::class, 'fromJson'], $map->records) : []
    );
  }