original_string: public function add_resource(cc_i_resource $res, $identifier = null, $type = 'webcontent') {
  
          if (!$this->ccobj->valid($type)) {
              throw new Exception("Type invalid...");
          }
  
          if ($res == null) {
              throw new Exception('Invalid Resource or dont give it');
          }
          $rst = $res;
  
          // TODO: This has to be reviewed since it does not handle multiple files properly.
          // Dependencies.
          if (is_object($identifier)) {
              $this->activemanifest->create_resource_node($rst, $this->doc, $identifier);
          } else {
              $nresnode   = null;
  
              $rst->type = $type;
              if (!cc_helpers::is_html($rst->filename)) {
                  $rst->href = null;
              }
  
              $this->activemanifest->create_resource_node($rst, $this->doc, $nresnode);
              foreach ($rst->files as $file) {
                  $ident = $this->get_identifier_by_filename($file);
                  if ($ident == null) {
                      $newres = new cc_resource($rst->manifestroot, $file);
                      if (!cc_helpers::is_html($file)) {
                           $newres->href = null;
                      }
                      $newres->type = 'webcontent';
                      $this->activemanifest->create_resource_node($newres, $this->doc, $nresnode);
                  }
              }
          }
  
          $tmparray = array($rst->identifier, $rst->files[0]);
          return $tmparray;
      }
code: public function add_resource(cc_i_resource $res, $identifier = null, $type = 'webcontent') {
  
          if (!$this->ccobj->valid($type)) {
              throw new Exception("Type invalid...");
          }
  
          if ($res == null) {
              throw new Exception('Invalid Resource or dont give it');
          }
          $rst = $res;
  
          // TODO: This has to be reviewed since it does not handle multiple files properly.
          // Dependencies.
          if (is_object($identifier)) {
              $this->activemanifest->create_resource_node($rst, $this->doc, $identifier);
          } else {
              $nresnode   = null;
  
              $rst->type = $type;
              if (!cc_helpers::is_html($rst->filename)) {
                  $rst->href = null;
              }
  
              $this->activemanifest->create_resource_node($rst, $this->doc, $nresnode);
              foreach ($rst->files as $file) {
                  $ident = $this->get_identifier_by_filename($file);
                  if ($ident == null) {
                      $newres = new cc_resource($rst->manifestroot, $file);
                      if (!cc_helpers::is_html($file)) {
                           $newres->href = null;
                      }
                      $newres->type = 'webcontent';
                      $this->activemanifest->create_resource_node($newres, $this->doc, $nresnode);
                  }
              }
          }
  
          $tmparray = array($rst->identifier, $rst->files[0]);
          return $tmparray;
      }
code_tokens: public function add_resource ( cc_i_resource $ res , $ identifier = null , $ type = 'webcontent' ) { if ( ! $ this -> ccobj -> valid ( $ type ) ) { throw new Exception ( "Type invalid..." ) ; } if ( $ res == null ) { throw new Exception ( 'Invalid Resource or dont give it' ) ; } $ rst = $ res ; // TODO: This has to be reviewed since it does not handle multiple files properly. // Dependencies. if ( is_object ( $ identifier ) ) { $ this -> activemanifest -> create_resource_node ( $ rst , $ this -> doc , $ identifier ) ; } else { $ nresnode = null ; $ rst -> type = $ type ; if ( ! cc_helpers :: is_html ( $ rst -> filename ) ) { $ rst -> href = null ; } $ this -> activemanifest -> create_resource_node ( $ rst , $ this -> doc , $ nresnode ) ; foreach ( $ rst -> files as $ file ) { $ ident = $ this -> get_identifier_by_filename ( $ file ) ; if ( $ ident == null ) { $ newres = new cc_resource ( $ rst -> manifestroot , $ file ) ; if ( ! cc_helpers :: is_html ( $ file ) ) { $ newres -> href = null ; } $ newres -> type = 'webcontent' ; $ this -> activemanifest -> create_resource_node ( $ newres , $ this -> doc , $ nresnode ) ; } } } $ tmparray = array ( $ rst -> identifier , $ rst -> files [ 0 ] ) ; return $ tmparray ; }
docstring: Add a resource to the manifest
  
  @param cc_i_resource $res
  @param string $identifier
  @param string $type
  @return array
docstring_tokens: Add a resource to the manifest