':param localtmpdir: Local temporary directory where to save
the remote code.'

def api_read(self, localtmpdir=None):

    def write_vuln_to_kb(vulnty, url, funcs):
        vulndata = php_sca.KB_DATA[vulnty]
        for f in funcs:
            vuln_sev = vulndata['severity']
            desc = name = vulndata['name']
            v = Vuln(name, desc, vuln_sev, 1, 'PHP    Static    Code    Analyzer')
            v.set_uri(url)
            v.set_token((f.vulnsources[0], 0))
            args = (list(vulndata['kb_key']) + [v])
            v.set_method('GET')
            v.set_dc(DataContainer())
            v['os'] = 'unix'
            v['separator'] = ''
            kb.kb.append(*args)
    if (not localtmpdir):
        localtmpdir = tempfile.mkdtemp()
    res = {}
    files = self.exec_payload('get_source_code', args=(localtmpdir,))
    if isinstance(files, basestring):
        om.out.console(files)
        return {}
    for (url, file) in files.iteritems():
        try:
            sca = PhpSCA(file=file[1])
            vulns = sca.get_vulns()
        except Exception as e:
            msg = 'The    PHP    SCA    failed    with    an    unhandled    exception:    "%s".'
            om.out.console((msg % e))
            return {}
        for (vulnty, funcs) in vulns.iteritems():
            write_vuln_to_kb(vulnty, url, funcs)
            res.setdefault(vulnty, []).extend([{'loc': url, 'lineno': fc.lineno, 'funcname': fc.name, 'vulnsrc': str(fc.vulnsources[0])} for fc in funcs])
    return res
