XMLProjectParser.php
function parse(\SimpleXMLElement $data)
  {
      $project = new DrupalProject();
      $project->setApiVersion((string) $data->api_version);
      $project->setTitle((string) $data->title);
      $project->setShortName((string) $data->short_name);
      $project->setRecommendedMajor((int) $data->recommended_major);
      $project->setProjectStatus((string) $data->project_status);
      $project->setLink((string) $data->link);
      $terms = array();
      foreach ($data->terms[0]->term as $term) {
          $terms[(string) $term->name] = (string) $term->value;
      }
      $project->setTerms($terms);

      $releases = array();
      $currentRelease = FALSE;
      foreach ($data->releases->release as $release) {
          $releaseArr = array(
              'version' => (string) $release->version,
              'major' => (string) $release->version_major,
              'patch' => (string) $release->version_patch,
              'extra' => (string) $release->version_extra,
              'status' => (string) $release->status,
          );
          $currentRelease = $this->compareRelease($releaseArr, $currentRelease);
          $releases[$releaseArr['version']] = $releaseArr;
      }
      $project->setReleases($releases);
      if ($currentRelease) {
        $project->setCurrentRelease($currentRelease);
      }
      return $project;
  }
function parse(\SimpleXMLElement $data)
  {
      $project = new DrupalProject();
      $project->setApiVersion((string) $data->api_version);
      $project->setTitle((string) $data->title);
      $project->setShortName((string) $data->short_name);
      $project->setRecommendedMajor((int) $data->recommended_major);
      $project->setProjectStatus((string) $data->project_status);
      $project->setLink((string) $data->link);
      $terms = array();
      foreach ($data->terms[0]->term as $term) {
          $terms[(string) $term->name] = (string) $term->value;
      }
      $project->setTerms($terms);

      $releases = array();
      $currentRelease = FALSE;
      foreach ($data->releases->release as $release) {
          $releaseArr = array(
              'version' => (string) $release->version,
              'major' => (string) $release->version_major,
              'patch' => (string) $release->version_patch,
              'extra' => (string) $release->version_extra,
              'status' => (string) $release->status,
          );
          $currentRelease = $this->compareRelease($releaseArr, $currentRelease);
          $releases[$releaseArr['version']] = $releaseArr;
      }
      $project->setReleases($releases);
      if ($currentRelease) {
        $project->setCurrentRelease($currentRelease);
      }
      return $project;
  }
function parse ( \ SimpleXMLElement $ data ) { $ project = new DrupalProject ( ) ; $ project -> setApiVersion ( ( string ) $ data -> api_version ) ; $ project -> setTitle ( ( string ) $ data -> title ) ; $ project -> setShortName ( ( string ) $ data -> short_name ) ; $ project -> setRecommendedMajor ( ( int ) $ data -> recommended_major ) ; $ project -> setProjectStatus ( ( string ) $ data -> project_status ) ; $ project -> setLink ( ( string ) $ data -> link ) ; $ terms = array ( ) ; foreach ( $ data -> terms [ 0 ] -> term as $ term ) { $ terms [ ( string ) $ term -> name ] = ( string ) $ term -> value ; } $ project -> setTerms ( $ terms ) ; $ releases = array ( ) ; $ currentRelease = FALSE ; foreach ( $ data -> releases -> release as $ release ) { $ releaseArr = array ( 'version' => ( string ) $ release -> version , 'major' => ( string ) $ release -> version_major , 'patch' => ( string ) $ release -> version_patch , 'extra' => ( string ) $ release -> version_extra , 'status' => ( string ) $ release -> status , ) ; $ currentRelease = $ this -> compareRelease ( $ releaseArr , $ currentRelease ) ; $ releases [ $ releaseArr [ 'version' ] ] = $ releaseArr ; } $ project -> setReleases ( $ releases ) ; if ( $ currentRelease ) { $ project -> setCurrentRelease ( $ currentRelease ) ; } return $ project ; }
Parse Drupal project ReleaseXML data
and return a DrupalProject object.
@return DrupalProject a fully populated DrupalProject object.
Parse Drupal project ReleaseXML data and return a DrupalProject object .