(self, the_api, resource)
Add the discovery dictionary as data to each resource.

    Override default implementation.

    Prepend the resource class name to each sub-resource since PHP doesn't
    support nested classes.

    Args:
      the_api: (Api) The API this Resource belongs to.
      resource: (Resource) The Resource to annotate.
Add the discovery dictionary as data to each resource.
Add the discovery dictionary as data to each resource .
def AnnotateResource(self, the_api, resource):
    """Add the discovery dictionary as data to each resource.

    Override default implementation.

    Prepend the resource class name to each sub-resource since PHP doesn't
    support nested classes.

    Args:
      the_api: (Api) The API this Resource belongs to.
      resource: (Resource) The Resource to annotate.
    """
    resource.json = json.dumps(_StripResource(resource.raw))
    # Escape stray quotes since it will be used in a PHP function call.
    resource.json = resource.json.replace('\'', '\\\'').replace('{}', '')
    for method in resource.values['methods']:
      self.AnnotateMethod(the_api, method, resource)

    if not resource.GetTemplateValue('phpPropName'):
      resource.SetTemplateValue('phpPropName', resource.values['wireName'])

    for r in resource.values['resources']:
      r.values['className'] = (resource.values['className'] +
                               r.values['className'])
      namespaced = '_'.join((resource.GetTemplateValue('phpPropName'),
                             r.values['wireName']))
      namespaced = '_'.join(
          (resource.GetTemplateValue('phpPropName'),
           self.language_model.ToMemberName(r.values['wireName'], None)))
      r.SetTemplateValue('phpPropName', namespaced)
      self.AnnotateResource(the_api, r)
def AnnotateResource ( self , the_api , resource ) : resource . json = json . dumps ( _StripResource ( resource . raw ) ) # Escape stray quotes since it will be used in a PHP function call. resource . json = resource . json . replace ( '\'' , '\\\'' ) . replace ( '{}' , '' ) for method in resource . values [ 'methods' ] : self . AnnotateMethod ( the_api , method , resource ) if not resource . GetTemplateValue ( 'phpPropName' ) : resource . SetTemplateValue ( 'phpPropName' , resource . values [ 'wireName' ] ) for r in resource . values [ 'resources' ] : r . values [ 'className' ] = ( resource . values [ 'className' ] + r . values [ 'className' ] ) namespaced = '_' . join ( ( resource . GetTemplateValue ( 'phpPropName' ) , r . values [ 'wireName' ] ) ) namespaced = '_' . join ( ( resource . GetTemplateValue ( 'phpPropName' ) , self . language_model . ToMemberName ( r . values [ 'wireName' ] , None ) ) ) r . SetTemplateValue ( 'phpPropName' , namespaced ) self . AnnotateResource ( the_api , r )