当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractHandler::startElement方法代码示例

本文整理汇总了PHP中AbstractHandler::startElement方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractHandler::startElement方法的具体用法?PHP AbstractHandler::startElement怎么用?PHP AbstractHandler::startElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AbstractHandler的用法示例。


在下文中一共展示了AbstractHandler::startElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: startElement

 /** Start element */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     if ($name == 'SITE') {
         $this->Site->Name = $attributes['NAME'];
         if (empty($this->Site->Name)) {
             $this->Site->Name = '(empty)';
         }
         $this->Site->Insert();
         $this->Build->SiteId = $this->Site->Id;
         $this->Build->Name = $attributes['BUILDNAME'];
         if (empty($this->Build->Name)) {
             $this->Build->Name = '(empty)';
         }
         $this->Build->SetStamp($attributes['BUILDSTAMP']);
         $this->Build->Generator = $attributes['GENERATOR'];
     } elseif ($name == 'FILE') {
         $this->CurrentCoverageFile = new CoverageFile();
         $this->CurrentCoverageFileLog = new CoverageFileLog();
         $this->CurrentCoverageFile->FullPath = trim($attributes['FULLPATH']);
     } elseif ($name == 'LINE') {
         if ($attributes['COUNT'] >= 0) {
             $this->CurrentCoverageFileLog->AddLine($attributes['NUMBER'], $attributes['COUNT']);
         }
         $this->CurrentLine = "";
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:28,代码来源:coverage_log_handler.php

示例2: startElement

 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     if ($name == 'SITE') {
         $this->Site->Name = $attributes['NAME'];
         if (empty($this->Site->Name)) {
             $this->Site->Name = "(empty)";
         }
         $this->Site->Insert();
         $siteInformation = new SiteInformation();
         $buildInformation = new BuildInformation();
         // Fill in the attribute
         foreach ($attributes as $key => $value) {
             $siteInformation->SetValue($key, $value);
             $buildInformation->SetValue($key, $value);
         }
         $this->Site->SetInformation($siteInformation);
         $this->Build->SiteId = $this->Site->Id;
         $this->Build->Name = $attributes['BUILDNAME'];
         if (empty($this->Build->Name)) {
             $this->Build->Name = "(empty)";
         }
         $this->Build->SetStamp($attributes['BUILDSTAMP']);
         $this->Build->Generator = $attributes['GENERATOR'];
         $this->Build->Information = $buildInformation;
         if (array_key_exists('APPEND', $attributes)) {
             if (strtolower($attributes['APPEND']) == "true") {
                 $this->Append = true;
             }
         } else {
             $this->Append = false;
         }
     } else {
         if ($name == 'WARNING') {
             $this->Error = new BuildError();
             $this->Error->Type = 1;
         } else {
             if ($name == 'ERROR') {
                 $this->Error = new BuildError();
                 $this->Error->Type = 0;
             } else {
                 if ($name == 'FAILURE') {
                     $this->Error = new BuildFailure();
                     $this->Error->Type = 0;
                     if ($attributes['TYPE'] == "Error") {
                         $this->Error->Type = 0;
                     } else {
                         if ($attributes['TYPE'] == "Warning") {
                             $this->Error->Type = 1;
                         }
                     }
                 } else {
                     if ($name == 'LABEL') {
                         $this->Label = new Label();
                     }
                 }
             }
         }
     }
 }
开发者ID:josephsnyder,项目名称:CDash,代码行数:60,代码来源:build_handler.php

示例3: startElement

 /** startElement function */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     if ($name == 'SITE') {
         $this->Site->Name = $attributes['NAME'];
         if (empty($this->Site->Name)) {
             $this->Site->Name = '(empty)';
         }
         $this->Site->Insert();
         $siteInformation = new SiteInformation();
         $buildInformation = new BuildInformation();
         // Fill in the attribute
         foreach ($attributes as $key => $value) {
             $siteInformation->SetValue($key, $value);
             $buildInformation->SetValue($key, $value);
         }
         $this->Site->SetInformation($siteInformation);
         $this->Build->SiteId = $this->Site->Id;
         $this->Build->Name = $attributes['BUILDNAME'];
         if (empty($this->Build->Name)) {
             $this->Build->Name = '(empty)';
         }
         $this->Build->SetStamp($attributes['BUILDSTAMP']);
         $this->Build->Generator = $attributes['GENERATOR'];
         $this->Build->Information = $buildInformation;
     } elseif ($name == 'NOTE') {
         $this->Note = new BuildNote();
         $this->Note->Name = isset($attributes['NAME']) ? $attributes['NAME'] : '';
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:31,代码来源:note_handler.php

示例4: startElement

 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     if ($name == 'SITE') {
         $this->Site->Name = $attributes['NAME'];
         if (empty($this->Site->Name)) {
             $this->Site->Name = '(empty)';
         }
         $this->Site->Insert();
         $siteInformation = new SiteInformation();
         $buildInformation = new BuildInformation();
         // Fill in the attribute
         foreach ($attributes as $key => $value) {
             if ($key === 'CHANGEID') {
                 $this->Build->SetPullRequest($value);
                 continue;
             }
             $siteInformation->SetValue($key, $value);
             $buildInformation->SetValue($key, $value);
         }
         $this->Site->SetInformation($siteInformation);
         $this->Build->SiteId = $this->Site->Id;
         $this->Build->Name = $attributes['BUILDNAME'];
         if (empty($this->Build->Name)) {
             $this->Build->Name = '(empty)';
         }
         $this->Build->SetStamp($attributes['BUILDSTAMP']);
         $this->Build->Generator = $attributes['GENERATOR'];
         $this->Build->Information = $buildInformation;
     } elseif ($name == 'LABEL') {
         $this->Label = new Label();
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:33,代码来源:configure_handler.php

示例5: startElement

 /** Start element */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     if ($name == 'SITE') {
         $this->Site->Name = $attributes['NAME'];
         if (empty($this->Site->Name)) {
             $this->Site->Name = "(empty)";
         }
         $this->Site->Insert();
         $siteInformation = new SiteInformation();
         $buildInformation = new BuildInformation();
         // Fill in the attribute
         foreach ($attributes as $key => $value) {
             $siteInformation->SetValue($key, $value);
             $buildInformation->SetValue($key, $value);
         }
         $this->Site->SetInformation($siteInformation);
         $this->Build->SiteId = $this->Site->Id;
         $this->Build->Name = $attributes['BUILDNAME'];
         if (empty($this->Build->Name)) {
             $this->Build->Name = "(empty)";
         }
         $this->Build->SetStamp($attributes['BUILDSTAMP']);
         $this->Build->Generator = $attributes['GENERATOR'];
         $this->Build->Information = $buildInformation;
     } else {
         if ($name == 'DYNAMICANALYSIS') {
             $this->Checker = $attributes['CHECKER'];
         } else {
             if ($name == 'TEST' && isset($attributes['STATUS'])) {
                 $this->DynamicAnalysis = new DynamicAnalysis();
                 $this->DynamicAnalysis->Checker = $this->Checker;
                 $this->DynamicAnalysis->Status = $attributes['STATUS'];
             } else {
                 if ($name == 'DEFECT') {
                     $this->DynamicAnalysisDefect = new DynamicAnalysisDefect();
                     $this->DynamicAnalysisDefect->Type = $attributes['TYPE'];
                 } else {
                     if ($name == 'LABEL') {
                         $this->Label = new Label();
                     } else {
                         if ($name == 'LOG') {
                             $this->DynamicAnalysis->LogCompression = isset($attributes['COMPRESSION']) ? $attributes['COMPRESSION'] : '';
                             $this->DynamicAnalysis->LogEncoding = isset($attributes['ENCODING']) ? $attributes['ENCODING'] : '';
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:52,代码来源:dynamic_analysis_handler.php

示例6: startElement

 /** startElement */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     if ($name == 'SITE') {
         $this->Site->Name = $attributes['NAME'];
         if (empty($this->Site->Name)) {
             $this->Site->Name = "(empty)";
         }
         $this->Site->Insert();
         $siteInformation = new SiteInformation();
         $buildInformation = new BuildInformation();
         // Fill in the attribute
         foreach ($attributes as $key => $value) {
             $siteInformation->SetValue($key, $value);
             $buildInformation->SetValue($key, $value);
         }
         $this->Site->SetInformation($siteInformation);
         $this->Build->SiteId = $this->Site->Id;
         $this->Build->Name = $attributes['BUILDNAME'];
         if (empty($this->Build->Name)) {
             $this->Build->Name = "(empty)";
         }
         $this->Build->SetStamp($attributes['BUILDSTAMP']);
         $this->Build->Generator = $attributes['GENERATOR'];
         $this->Build->Information = $buildInformation;
     } else {
         if ($name == 'FILE') {
             $this->CoverageFile = new CoverageFile();
             $this->Coverage = new Coverage();
             $this->CoverageFile->FullPath = $attributes['FULLPATH'];
             if ($attributes['COVERED'] == 1 || $attributes['COVERED'] == "true") {
                 $this->Coverage->Covered = 1;
             } else {
                 $this->Coverage->Covered = 0;
             }
             $this->Coverage->CoverageFile = $this->CoverageFile;
         } else {
             if ($name == 'LABEL') {
                 $this->Label = new Label();
             }
         }
     }
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:44,代码来源:coverage_handler.php

示例7: startElement

 /** Start element */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     if ($name == 'UPDATE') {
         if (isset($attributes['GENERATOR'])) {
             $this->Build->Generator = $attributes['GENERATOR'];
         }
         $this->Update = new BuildUpdate();
     } else {
         if ($name == 'UPDATED' || $name == 'CONFLICTING' || $name == 'MODIFIED') {
             $this->UpdateFile = new BuildUpdateFile();
             $this->UpdateFile->Status = $name;
         } else {
             if ($name == 'UPDATERETURNSTATUS') {
                 $this->Update->Status = '';
             }
         }
     }
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:20,代码来源:update_handler.php

示例8: startElement

 /** startElement function */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     // Check that the project name matches
     if ($name == 'PROJECT') {
         if (get_project_id($attributes['NAME']) != $this->projectid) {
             add_log('Wrong project name: ' . $attributes['NAME'], 'ProjectHandler::startElement', LOG_ERR, $this->projectid);
             $this->ProjectNameMatches = false;
         }
     }
     if (!$this->ProjectNameMatches) {
         return;
     }
     if ($name == 'PROJECT') {
         $this->SubProjects = array();
         $this->Dependencies = array();
     } elseif ($name == 'SUBPROJECT') {
         $this->CurrentDependencies = array();
         $this->SubProject = new SubProject();
         $this->SubProject->SetProjectId($this->projectid);
         $this->SubProject->SetName($attributes['NAME']);
         if (array_key_exists('GROUP', $attributes)) {
             $this->SubProject->SetGroup($attributes['GROUP']);
         }
     } elseif ($name == 'DEPENDENCY') {
         // A DEPENDENCY is expected to be:
         //
         //  - another subproject that already exists
         //    (from a previous element in this submission)
         //
         $dependentProject = new SubProject();
         $dependentProject->SetName($attributes['NAME']);
         $dependentProject->SetProjectId($this->projectid);
         // The subproject's Id is automatically loaded once its name & projectid
         // are set.
         $this->CurrentDependencies[] = $dependentProject->GetId();
     } elseif ($name == 'EMAIL') {
         $this->Email = $attributes['ADDRESS'];
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:41,代码来源:project_handler.php

示例9: startElement

 /** startElement function */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     if ($name == 'SITE') {
         $this->Site->Name = $attributes['NAME'];
         if (empty($this->Site->Name)) {
             $this->Site->Name = "(empty)";
         }
         $this->Site->Insert();
         $siteInformation = new SiteInformation();
         $buildInformation = new BuildInformation();
         // Fill in the attribute
         foreach ($attributes as $key => $value) {
             $siteInformation->SetValue($key, $value);
             $buildInformation->SetValue($key, $value);
         }
         $this->Site->SetInformation($siteInformation);
         $this->Build->SiteId = $this->Site->Id;
         $this->Build->Name = $attributes['BUILDNAME'];
         if (empty($this->Build->Name)) {
             $this->Build->Name = "(empty)";
         }
         $this->Build->SetStamp($attributes['BUILDSTAMP']);
         $this->Build->Generator = $attributes['GENERATOR'];
         $this->Build->Information = $buildInformation;
     } else {
         if ($name == 'NOTE') {
             $this->Note = new BuildNote();
             $this->Note->Name = isset($attributes['NAME']) ? $attributes['NAME'] : '';
         } else {
             if ($name == 'NOTES') {
                 // We need a build to add notes (and cannot create one from the information)
                 $this->Build->ProjectId = $this->projectid;
                 $buildid = $this->Build->GetIdFromName($this->SubProjectName);
                 $this->BuildId = $buildid;
             }
         }
     }
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:40,代码来源:note_handler.php

示例10: startElement

 /** Start element */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     if ($name == 'UPDATE') {
         if (isset($attributes['GENERATOR'])) {
             $this->Build->Generator = $attributes['GENERATOR'];
         }
         if (array_key_exists('APPEND', $attributes)) {
             if (strtolower($attributes['APPEND']) == 'true') {
                 $this->Append = true;
             }
         } else {
             $this->Append = false;
         }
         $this->Update = new BuildUpdate();
         $this->Update->Append = $this->Append;
     } elseif ($name == 'UPDATED' || $name == 'CONFLICTING' || $name == 'MODIFIED') {
         $this->UpdateFile = new BuildUpdateFile();
         $this->UpdateFile->Status = $name;
     } elseif ($name == 'UPDATERETURNSTATUS') {
         $this->Update->Status = '';
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:24,代码来源:update_handler.php

示例11: startElement

 /** Start Element */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     $parent = $this->getParent();
     // should be before endElement
     if ($name == 'SITE') {
         $this->Site->Name = $attributes['NAME'];
         if (empty($this->Site->Name)) {
             $this->Site->Name = '(empty)';
         }
         $this->Site->Insert();
         $siteInformation = new SiteInformation();
         $buildInformation = new BuildInformation();
         // Fill in the attribute
         foreach ($attributes as $key => $value) {
             if ($key === 'CHANGEID') {
                 $this->Build->SetPullRequest($value);
                 continue;
             }
             $siteInformation->SetValue($key, $value);
             $buildInformation->SetValue($key, $value);
         }
         $this->Site->SetInformation($siteInformation);
         $this->Build->SiteId = $this->Site->Id;
         $this->Build->Name = $attributes['BUILDNAME'];
         if (empty($this->Build->Name)) {
             $this->Build->Name = '(empty)';
         }
         $this->Build->SetStamp($attributes['BUILDSTAMP']);
         $this->Build->Generator = $attributes['GENERATOR'];
         $this->Build->Information = $buildInformation;
         if (array_key_exists('APPEND', $attributes)) {
             $this->Append = $attributes['APPEND'];
         } else {
             $this->Append = false;
         }
     } elseif ($name == 'TEST' && count($attributes) > 0) {
         $this->Test = new Test();
         $this->Test->ProjectId = $this->projectid;
         $this->BuildTest = new BuildTest();
         $this->BuildTest->Status = $attributes['STATUS'];
         if ($attributes['STATUS'] == 'passed') {
             $this->NumberTestsPassed++;
         } elseif ($attributes['STATUS'] == 'failed') {
             $this->NumberTestsFailed++;
         } elseif ($attributes['STATUS'] == 'notrun') {
             $this->NumberTestsNotRun++;
         }
     } elseif ($name == 'NAMEDMEASUREMENT') {
         $this->TestMeasurement = new TestMeasurement();
         if ($attributes['TYPE'] == 'file') {
             $this->TestMeasurement->Name = $attributes['FILENAME'];
         } else {
             $this->TestMeasurement->Name = $attributes['NAME'];
         }
         $this->TestMeasurement->Type = $attributes['TYPE'];
     } elseif ($name == 'VALUE' && $parent == 'MEASUREMENT') {
         if (isset($attributes['COMPRESSION']) && $attributes['COMPRESSION'] == 'gzip') {
             $this->Test->CompressedOutput = true;
         }
     } elseif ($name == 'LABEL' && $parent == 'LABELS') {
         $this->Label = new Label();
     } elseif ($name == 'TESTLIST' && $parent == 'TESTING') {
         $start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
         $this->Build->ProjectId = $this->projectid;
         $this->Build->StartTime = $start_time;
         // EndTimeStamp hasn't been parsed yet.
         $this->Build->EndTime = $start_time;
         $this->Build->SubmitTime = gmdate(FMT_DATETIME);
         $this->Build->SetSubProject($this->SubProjectName);
         $this->Build->GetIdFromName($this->SubProjectName);
         $this->Build->RemoveIfDone();
         // If the build doesn't exist we add it
         if ($this->Build->Id == 0) {
             $this->Build->Append = $this->Append;
             $this->Build->InsertErrors = false;
             add_build($this->Build, $this->scheduleid);
         } else {
             // Otherwise make sure that the build is up-to-date.
             $this->Build->UpdateBuild($this->Build->Id, -1, -1);
             // If the build already exists factor the number of tests
             // that have already been run into our running total.
             $this->NumberTestsFailed += $this->Build->GetNumberOfFailedTests();
             $this->NumberTestsNotRun += $this->Build->GetNumberOfNotRunTests();
             $this->NumberTestsPassed += $this->Build->GetNumberOfPassedTests();
         }
         $GLOBALS['PHP_ERROR_BUILD_ID'] = $this->Build->Id;
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:90,代码来源:testing_handler.php

示例12: startElement

 /** Start Element */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     $parent = $this->getParent();
     // should be before endElement
     if ($name == 'SITE') {
         $this->HasSiteTag = true;
         $this->Site->Name = $attributes['NAME'];
         if (empty($this->Site->Name)) {
             $this->Site->Name = "(empty)";
         }
         $this->Site->Insert();
         $siteInformation = new SiteInformation();
         $buildInformation = new BuildInformation();
         // Fill in the attribute
         foreach ($attributes as $key => $value) {
             $siteInformation->SetValue($key, $value);
             $buildInformation->SetValue($key, $value);
         }
         $this->Site->SetInformation($siteInformation);
         $this->Build->SiteId = $this->Site->Id;
         $this->Build->Name = $attributes['BUILDNAME'];
         if (empty($this->Build->Name)) {
             $this->Build->Name = "(empty)";
         }
         $this->Build->SetStamp($attributes['BUILDSTAMP']);
         $this->Build->Generator = $attributes['GENERATOR'];
         $this->Build->Information = $buildInformation;
         if (array_key_exists('APPEND', $attributes)) {
             $this->Append = $attributes['APPEND'];
         } else {
             $this->Append = false;
         }
     } else {
         if ($name == "TEST-CASE" && count($attributes) > 0) {
             $this->Test = new Test();
             $this->Test->ProjectId = $this->projectid;
             $this->BuildTest = new BuildTest();
             $teststatus = "notrun";
             if ($attributes['RESULT'] == "Success") {
                 $teststatus = "passed";
             } else {
                 if ($attributes['RESULT'] == "Failure") {
                     $teststatus = "failed";
                 }
             }
             $this->BuildTest->Status = $teststatus;
             if ($teststatus == "passed") {
                 $this->NumberTestsPassed++;
             } else {
                 if ($teststatus == "failed") {
                     $this->NumberTestsFailed++;
                 } else {
                     if ($teststatus == "notrun") {
                         $this->NumberTestsNotRun++;
                     }
                 }
             }
             if (isset($attributes['TIME'])) {
                 $this->BuildTest->Time = $attributes['TIME'];
             }
             if (isset($attributes['ASSERTS'])) {
                 $this->Test->Details = $attributes['ASSERTS'];
             }
             $this->Test->Name = $attributes['NAME'];
             $this->Test->Path = $attributes['NAME'];
             $this->Test->Command = $attributes['NAME'];
         } else {
             if ($name == "TEST-RESULTS") {
                 $this->StartTimeStamp = strtotime($attributes['DATE'] . ' ' . $attributes['TIME']);
                 $this->EndTimeStamp = $this->StartTimeStamp;
             } else {
                 if ($this->HasSiteTag == false && $name == "ENVIRONMENT") {
                     // If the XML file doesn't have a <Site> tag then we use the information
                     // provided by the testsuite.
                     // buildname is 'name'
                     // sitename is 'hostname'
                     // timestamp is 'timestamp'
                     $this->Site->Name = $attributes['MACHINE-NAME'];
                     $this->Site->Insert();
                     $buildInformation = new BuildInformation();
                     $buildInformation->OSName = $attributes['PLATFORM'];
                     $buildInformation->OSVersion = $attributes['OS-VERSION'];
                     $buildInformation->CompilerName = 'CLR';
                     $buildInformation->CompilerVersion = $attributes['CLR-VERSION'];
                     $this->Build->SiteId = $this->Site->Id;
                     $this->Build->Name = $attributes['PLATFORM'];
                     // Construct a CMake-Like build stamp
                     // We assume Nightly
                     $stamp = date("Ymd-Hi", $this->StartTimeStamp) . '-Nightly';
                     $this->Build->SetStamp($stamp);
                     $this->Build->Information = $buildInformation;
                     $this->Append = false;
                 } else {
                     if ($this->BuildAdded == false && $name == "TEST-SUITE") {
                         $this->Build->SaveTotalTestsTime(0);
                         $start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
                         $this->Build->ProjectId = $this->projectid;
                         $buildid = $this->Build->GetIdFromName($this->SubProjectName);
//.........这里部分代码省略.........
开发者ID:rpshaw,项目名称:CDash,代码行数:101,代码来源:testing_nunit_handler.php

示例13: startElement

 /** startElement */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     $parent = $this->getParent();
     if ($name == 'SITE') {
         $this->Site->Name = $attributes['NAME'];
         if (empty($this->Site->Name)) {
             $this->Site->Name = "(empty)";
         }
         $this->Site->Insert();
         $siteInformation = new SiteInformation();
         $buildInformation = new BuildInformation();
         // Fill in the attribute
         foreach ($attributes as $key => $value) {
             $siteInformation->SetValue($key, $value);
             $buildInformation->SetValue($key, $value);
         }
         $this->Site->SetInformation($siteInformation);
         $this->Build->SiteId = $this->Site->Id;
         $this->Build->Name = $attributes['BUILDNAME'];
         if (empty($this->Build->Name)) {
             $this->Build->Name = "(empty)";
         }
         $this->Build->SetStamp($attributes['BUILDSTAMP']);
         $this->Build->Generator = $attributes['GENERATOR'];
         $this->Build->Information = $buildInformation;
     } else {
         if ($name == 'SOURCEFILE') {
             $this->CoverageFile = new CoverageFile();
             $this->Coverage = new Coverage();
             $this->CoverageFile->FullPath = $attributes['NAME'];
             $this->Coverage->Covered = 1;
             $this->Coverage->CoverageFile = $this->CoverageFile;
         } else {
             if ($name == 'LABEL') {
                 $this->Label = new Label();
             } else {
                 if ($parent == 'REPORT' && $name == 'SESSIONINFO') {
                     // timestamp are in miliseconds
                     $this->StartTimeStamp = substr($attributes['START'], 0, -3);
                     $this->EndTimeStamp = substr($attributes['DUMP'], 0, -3);
                 } else {
                     if ($parent == 'REPORT' && $name == 'COUNTER') {
                         switch ($attributes['TYPE']) {
                             case 'LINE':
                                 $this->CoverageSummary->LocTested = intval($attributes['COVERED']);
                                 $this->CoverageSummary->LocUntested = intval($attributes['MISSED']);
                                 break;
                             case 'COMPLEXITY':
                                 $this->CoverageSummary->BranchesTested = intval($attributes['COVERED']);
                                 $this->CoverageSummary->BranchesUntested = intval($attributes['MISSED']);
                                 break;
                             case 'METHOD':
                                 $this->CoverageSummary->FunctionsTested = intval($attributes['COVERED']);
                                 $this->CoverageSummary->FunctionsUntested = intval($attributes['MISSED']);
                                 break;
                         }
                     } else {
                         if ($parent == 'SOURCEFILE' && $name == 'COUNTER') {
                             switch ($attributes['TYPE']) {
                                 case 'LINE':
                                     $this->Coverage->LocTested = intval($attributes['COVERED']);
                                     $this->Coverage->LocUntested = intval($attributes['MISSED']);
                                     break;
                                 case 'COMPLEXITY':
                                     $this->Coverage->BranchesTested = intval($attributes['COVERED']);
                                     $this->Coverage->BranchesUntested = intval($attributes['MISSED']);
                                     break;
                                 case 'METHOD':
                                     $this->Coverage->FunctionsTested = intval($attributes['COVERED']);
                                     $this->Coverage->FunctionsUntested = intval($attributes['MISSED']);
                                     break;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:rpshaw,项目名称:CDash,代码行数:81,代码来源:coverage_junit_handler.php

示例14: startElement

 /** Start Element */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     $parent = $this->getParent();
     // should be before endElement
     if ($name == 'SITE') {
         $this->HasSiteTag = true;
         $this->Site->Name = $attributes['NAME'];
         if (empty($this->Site->Name)) {
             $this->Site->Name = "(empty)";
         }
         $this->Site->Insert();
         $siteInformation = new SiteInformation();
         $buildInformation = new BuildInformation();
         // Fill in the attribute
         foreach ($attributes as $key => $value) {
             $siteInformation->SetValue($key, $value);
             $buildInformation->SetValue($key, $value);
         }
         $this->Site->SetInformation($siteInformation);
         $this->Build->SiteId = $this->Site->Id;
         $this->Build->Name = $attributes['BUILDNAME'];
         if (empty($this->Build->Name)) {
             $this->Build->Name = "(empty)";
         }
         $this->Build->SetStamp($attributes['BUILDSTAMP']);
         $this->Build->Generator = $attributes['GENERATOR'];
         $this->Build->Information = $buildInformation;
         if (array_key_exists('APPEND', $attributes)) {
             $this->Append = $attributes['APPEND'];
         } else {
             $this->Append = false;
         }
     } else {
         if ($name == "FAILURE") {
             $this->Test->Details = $attributes['TYPE'];
         } else {
             if ($name == "PROPERTY" && $parent == "PROPERTIES") {
                 $this->TestProperties .= $attributes['NAME'] . '=' . $attributes['VALUE'] . "\n";
                 if ($this->HasSiteTag == false) {
                     switch ($attributes['NAME']) {
                         case 'os.name':
                             $this->Build->Information->OSName = $attributes['VALUE'];
                             break;
                         case 'os.version':
                             $this->Build->Information->OSVersion = $attributes['VALUE'];
                             break;
                         case 'java.vm.name':
                             $this->Build->Information->CompilerName = $attributes['VALUE'];
                             break;
                         case 'java.vm.version':
                             $this->Build->Information->CompilerVersion = $attributes['VALUE'];
                             break;
                         case 'hostname':
                             if (empty($this->Site->Name)) {
                                 $this->Site->Name = $attributes['VALUE'];
                                 $this->Site->Insert();
                                 $this->Build->SiteId = $this->Site->Id;
                             }
                             break;
                     }
                 }
             } else {
                 if ($name == "TESTCASE" && count($attributes) > 0) {
                     if ($this->BuildAdded == false) {
                         $this->Build->SaveTotalTestsTime(0);
                         $start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
                         $this->Build->ProjectId = $this->projectid;
                         $buildid = $this->Build->GetIdFromName($this->SubProjectName);
                         // If the build doesn't exist we add it
                         if ($buildid == 0) {
                             $this->Build->ProjectId = $this->projectid;
                             $this->Build->StartTime = $start_time;
                             $this->Build->EndTime = $start_time;
                             $this->Build->SubmitTime = gmdate(FMT_DATETIME);
                             $this->Build->SetSubProject($this->SubProjectName);
                             $this->Build->Append = $this->Append;
                             $this->Build->InsertErrors = false;
                             add_build($this->Build, $this->scheduleid);
                             $this->UpdateEndTime = true;
                             $buildid = $this->Build->Id;
                         } else {
                             $this->Build->Id = $buildid;
                             //if the build already exists factor the number of tests that have
                             //already been run into our running total
                             $this->NumberTestsFailed += $this->Build->GetNumberOfFailedTests();
                             $this->NumberTestsNotRun += $this->Build->GetNumberOfNotRunTests();
                             $this->NumberTestsPassed += $this->Build->GetNumberOfPassedTests();
                         }
                         $GLOBALS['PHP_ERROR_BUILD_ID'] = $buildid;
                         $this->BuildId = $buildid;
                         $this->BuildAdded = true;
                     }
                     $this->Test = new Test();
                     $this->Test->Command = $this->TestProperties;
                     $this->Test->ProjectId = $this->projectid;
                     $this->BuildTest = new BuildTest();
                     if (isset($attributes['TIME'])) {
                         $this->BuildTest->Time = $attributes['TIME'];
//.........这里部分代码省略.........
开发者ID:rpshaw,项目名称:CDash,代码行数:101,代码来源:testing_junit_handler.php

示例15: startElement

 /** startElement function */
 public function startElement($parser, $name, $attributes)
 {
     parent::startElement($parser, $name, $attributes);
     // Check that the project name matches
     if ($name == 'PROJECT') {
         if (get_project_id($attributes['NAME']) != $this->projectid) {
             add_log("Wrong project name: " . $attributes['NAME'], "ProjectHandler::startElement", LOG_ERR, $this->projectid);
             $this->ProjectNameMatches = false;
         }
     }
     if (!$this->ProjectNameMatches) {
         return;
     }
     if ($name == 'PROJECT') {
         $this->SubProjects = array();
         $this->Dependencies = array();
     } else {
         if ($name == 'SUBPROJECT') {
             $this->SubProject = new SubProject();
             $this->SubProject->SetProjectId($this->projectid);
             $this->SubProject->SetName($attributes['NAME']);
             if (array_key_exists("GROUP", $attributes)) {
                 $this->SubProject->SetGroup($attributes['GROUP']);
             }
             $this->SubProject->Save();
             // Insert the label
             $Label = new Label();
             $Label->Text = $this->SubProject->GetName();
             $Label->Insert();
             $this->SubProjects[$this->SubProject->GetId()] = $this->SubProject;
             $this->Dependencies[$this->SubProject->GetId()] = array();
         } else {
             if ($name == 'DEPENDENCY') {
                 // A DEPENDENCY is expected to be:
                 //
                 //  - another subproject that already exists (from a previous element in
                 //      this submission)
                 //
                 $dependentProject = new SubProject();
                 $dependentProject->SetName($attributes['NAME']);
                 $dependentProject->SetProjectId($this->projectid);
                 // The subproject's Id is automatically loaded once its name & projectid
                 // are set.
                 $dependencyid = $dependentProject->GetId();
                 $added = false;
                 if ($dependencyid !== false && is_numeric($dependencyid)) {
                     if (array_key_exists($dependencyid, $this->SubProjects)) {
                         $this->Dependencies[$this->SubProject->GetId()][] = $dependencyid;
                         $added = true;
                     }
                 }
                 if (!$added) {
                     add_log("Project.xml DEPENDENCY of " . $this->SubProject->GetName() . " not mentioned earlier in file: " . $attributes['NAME'], "ProjectHandler:startElement", LOG_WARNING, $this->projectid);
                 }
             } else {
                 if ($name == 'EMAIL') {
                     $email = $attributes['ADDRESS'];
                     // Check if the user is in the database
                     $User = new User();
                     $posat = strpos($email, '@');
                     if ($posat !== false) {
                         $User->FirstName = substr($email, 0, $posat);
                         $User->LastName = substr($email, $posat + 1);
                     } else {
                         $User->FirstName = $email;
                         $User->LastName = $email;
                     }
                     $User->Email = $email;
                     $User->Password = md5($email);
                     $User->Admin = 0;
                     $userid = $User->GetIdFromEmail($email);
                     if (!$userid) {
                         $User->Save();
                         $userid = $User->Id;
                     }
                     // Insert into the UserProject
                     $UserProject = new UserProject();
                     $UserProject->EmailType = 3;
                     // any build
                     $UserProject->EmailCategory = 54;
                     // everything except warnings
                     $UserProject->UserId = $userid;
                     $UserProject->ProjectId = $this->projectid;
                     $UserProject->Save();
                     // Insert the labels for this user
                     $LabelEmail = new LabelEmail();
                     $LabelEmail->UserId = $userid;
                     $LabelEmail->ProjectId = $this->projectid;
                     $Label = new Label();
                     $Label->SetText($this->SubProject->GetName());
                     $labelid = $Label->GetIdFromText();
                     if (!empty($labelid)) {
                         $LabelEmail->LabelId = $labelid;
                         $LabelEmail->Insert();
                     }
                 }
             }
         }
     }
//.........这里部分代码省略.........
开发者ID:rpshaw,项目名称:CDash,代码行数:101,代码来源:project_handler.php


注:本文中的AbstractHandler::startElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。