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


PHP Label::SetText方法代码示例

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


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

示例1: AddMeasurement

 public function AddMeasurement($measurement)
 {
     $measurement->TestId = $this->Id;
     $this->Measurements[] = $measurement;
     if ($measurement->Name == 'Label') {
         $label = new Label();
         $label->SetText($measurement->Value);
         $this->AddLabel($label);
     }
 }
开发者ID:kitware,项目名称:cdash,代码行数:10,代码来源:test.php

示例2: ParseUncoveredSourceFile

 /**
  * Parse an individual uncovered source file.
  **/
 public function ParseUncoveredSourceFile($fileinfo, $path)
 {
     $coverageFileLog = new CoverageFileLog();
     $coverageFileLog->AggregateBuildId = $this->AggregateBuildId;
     $coverageFileLog->PreviousAggregateParentId = $this->PreviousAggregateParentId;
     $coverageFile = new CoverageFile();
     $coverageFile->FullPath = trim($path);
     $coverage = new Coverage();
     $coverage->CoverageFile = $coverageFile;
     // SplFileObject was giving me an erroneous extra line at the
     // end of the file, so instead we use good old file().
     $lines = file($fileinfo);
     $lineNumber = 0;
     foreach ($lines as $line) {
         $sourceLine = rtrim($line);
         $coverageFile->File .= $sourceLine;
         $coverageFile->File .= '<br>';
         $coverageFileLog->AddLine($lineNumber, 0);
         $lineNumber++;
     }
     // Save this source file to the database.
     $coverageFile->TrimLastNewline();
     $coverageFile->Update($this->Build->Id);
     // Check if this build already has coverage for this file.
     // If so, return early so we don't overwrite it with a blank entry.
     $coverage->BuildId = $this->Build->Id;
     if ($coverage->Exists()) {
         return false;
     }
     // Otherwise save the line-by-line coverage to the database.
     $coverageFileLog->BuildId = $this->Build->Id;
     $coverageFileLog->FileId = $coverageFile->Id;
     $coverageFileLog->Insert(true);
     $coverage->LocUntested = $lineNumber;
     $coverage->LocTested = 0;
     $coverage->Covered = 1;
     // Add any labels.
     if (array_key_exists($path, $this->Labels)) {
         foreach ($this->Labels[$path] as $labelText) {
             $label = new Label();
             $label->SetText($labelText);
             $coverage->AddLabel($label);
         }
     }
     // Add this Coverage to our summary.
     $this->CoverageSummary->AddCoverage($coverage);
 }
开发者ID:kitware,项目名称:cdash,代码行数:50,代码来源:GcovTar_handler.php

示例3: testBuildRemovalWorksAsExpected

 public function testBuildRemovalWorksAsExpected()
 {
     require_once 'include/common.php';
     require_once 'include/pdo.php';
     require_once 'models/build.php';
     require_once 'models/buildconfigure.php';
     require_once 'models/builderror.php';
     require_once 'models/buildfailure.php';
     require_once 'models/buildgroup.php';
     require_once 'models/buildnote.php';
     require_once 'models/buildupdate.php';
     require_once 'models/coverage.php';
     require_once 'models/dynamicanalysis.php';
     require_once 'models/dynamicanalysissummary.php';
     require_once 'models/image.php';
     require_once 'models/label.php';
     require_once 'models/test.php';
     require_once 'models/uploadfile.php';
     $time = gmdate(FMT_DATETIME);
     // Find an existing site.
     $row = pdo_single_row_query('SELECT id FROM site LIMIT 1');
     $siteid = $row['id'];
     // Label
     $label = new Label();
     $label->SetText('remove me');
     // Build
     $build = new Build();
     $build->Name = 'RemovalWorksAsExpected';
     $build->SetStamp('20160822-1810-Experimental');
     $build->ProjectId = 1;
     $build->InsertErrors = true;
     $build->SiteId = $siteid;
     $build->StartTime = $time;
     $build->EndTime = $time;
     $build->SubmitTime = $time;
     $build->AddLabel($label);
     $buildgroup = new BuildGroup();
     $build->GroupId = $buildgroup->GetGroupIdFromRule($build);
     $info = new BuildInformation();
     $info->SetValue('OSNAME', 'Windows');
     $build->Information = $info;
     // BuildError
     $error = new BuildError();
     $error->Text = 'error: asdf';
     $build->AddError($error);
     // BuildFailure
     $failure = new BuildFailure();
     $failure->StdError = 'failure: asdf';
     $failure->AddArgument('arg1');
     $failure->AddLabel($label);
     $build->AddError($failure);
     $build->Save();
     // Create another build to test shared resources.
     $existing_build = new Build();
     $existing_build->Id = $build->Id;
     $existing_build->FillFromId($build->Id);
     $existing_build->SetStamp('20160822-1811-Experimental');
     $existing_build->SubmitTime = $time;
     $existing_build->InsertErrors = true;
     $existing_build->AddError($failure);
     $existing_build->Id = null;
     $existing_build->Save();
     // BuildConfigure
     $configure = new BuildConfigure();
     $configure->BuildId = $build->Id;
     $configure->StartTime = $time;
     $configure->EndTime = $time;
     $configure->Command = 'cmake';
     $configure->Log = "precontext\nWARNING: bar\npostcontext";
     $configure->Status = 5;
     $configure->AddLabel($label);
     $configure->Insert();
     $configure->ComputeWarnings();
     $configure->ComputeErrors();
     // BuildNote
     $note = new BuildNote();
     $note->Name = 'my note';
     $note->Text = 'note text';
     $note->Time = $time;
     $note->BuildId = $build->Id;
     $note->Insert();
     $shared_note = new BuildNote();
     $shared_note->Name = 'my shared note';
     $shared_note->Text = 'shared note text';
     $shared_note->Time = $time;
     $shared_note->BuildId = $build->Id;
     $shared_note->Insert();
     $shared_note->BuildId = $existing_build->Id;
     $shared_note->Insert();
     // buildtesttime
     $build->SaveTotalTestsTime(8);
     // BuildUpdate
     $updatefile = new BuildUpdateFile();
     $updatefile->Author = 'My Self';
     $updatefile->Committer = 'My Self';
     $updatefile->Email = 'my@self.com';
     $updatefile->CommitterEmail = 'my@self.com';
     $updatefile->Revision = 2;
     $updatefile->PriorRevision = 1;
     $updatefile->Filename = 'foo.cpp';
//.........这里部分代码省略.........
开发者ID:kitware,项目名称:cdash,代码行数:101,代码来源:test_removebuilds.php

示例4: endElement


//.........这里部分代码省略.........
                     if (array_key_exists($removeid, $this->SubProjects)) {
                         $subproject->RemoveDependency($removeid);
                     } else {
                         $dep = pdo_get_field_value("SELECT name FROM subproject WHERE id='{$removeid}'", 'name', "{$removeid}");
                         add_log("Not removing dependency {$dep}({$removeid}) from " . $subproject->GetName() . 'because it is not a SubProject element in this Project.xml file', 'ProjectHandler:endElement', LOG_WARNING, $this->projectid);
                     }
                 }
             }
             // Add dependencies that were queued up as we processed the DEPENDENCY
             // elements:
             //
             foreach ($this->Dependencies[$subproject->GetId()] as $addid) {
                 if (array_key_exists($addid, $this->SubProjects)) {
                     $subproject->AddDependency($addid);
                 } else {
                     add_log('impossible condition: should NEVER see this: unknown DEPENDENCY clause should prevent this case', 'ProjectHandler:endElement', LOG_WARNING, $this->projectid);
                 }
             }
         }
         if ($CDASH_DELETE_OLD_SUBPROJECTS) {
             // Delete old subprojects that weren't included in this file.
             $previousSubProjectIds = $this->Project->GetSubProjects();
             foreach ($previousSubProjectIds as $previousId) {
                 $found = false;
                 foreach ($this->SubProjects as $subproject) {
                     if ($subproject->GetId() == $previousId) {
                         $found = true;
                         break;
                     }
                 }
                 if (!$found) {
                     $subProjectToRemove = new SubProject();
                     $subProjectToRemove->SetId($previousId);
                     $subProjectToRemove->Delete();
                     add_log("Deleted " . $subProjectToRemove->GetName() . " because it was not mentioned in Project.xml", 'ProjectHandler:endElement', LOG_WARNING, $this->projectid);
                 }
             }
         }
     } elseif ($name == 'SUBPROJECT') {
         // Insert the SubProject.
         $this->SubProject->Save();
         // Insert the label.
         $Label = new Label();
         $Label->Text = $this->SubProject->GetName();
         $Label->Insert();
         $this->SubProjects[$this->SubProject->GetId()] = $this->SubProject;
         // Handle dependencies here too.
         $this->Dependencies[$this->SubProject->GetId()] = array();
         foreach ($this->CurrentDependencies as $dependencyid) {
             $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.', 'ProjectHandler:endElement', LOG_WARNING, $this->projectid);
             }
         }
         // Check if the user is in the database.
         $User = new User();
         $posat = strpos($this->Email, '@');
         if ($posat !== false) {
             $User->FirstName = substr($this->Email, 0, $posat);
             $User->LastName = substr($this->Email, $posat + 1);
         } else {
             $User->FirstName = $this->Email;
             $User->LastName = $this->Email;
         }
         $User->Email = $this->Email;
         $User->Password = md5($this->Email);
         $User->Admin = 0;
         $userid = $User->GetIdFromEmail($this->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:kitware,项目名称:cdash,代码行数:101,代码来源:project_handler.php

示例5: ParseGcovFile


//.........这里部分代码省略.........
     }
     $coverageFile->FullPath = $path;
     $lineNumber = 0;
     // The lack of rewind is intentional.
     while (!$file->eof()) {
         $gcovLine = $file->current();
         // "Ordinary" entries in a .gcov file take the following format:
         // <lineNumber>: <timesHit>: <source code at that line>
         // So we check if this line matches the format & parse the
         // data out of it if so.
         $fields = explode(":", $gcovLine, 3);
         if (count($fields) > 2) {
             // Separate out delimited values from this line.
             $timesHit = trim($fields[0]);
             $lineNumber = trim($fields[1]);
             $sourceLine = trim($fields[2]);
             if ($lineNumber > 0) {
                 $coverageFile->File .= $sourceLine;
                 // cannot be <br/> for backward compatibility.
                 $coverageFile->File .= '<br>';
             }
             // This is how gcov indicates a line of unexecutable code.
             if ($timesHit === '-') {
                 $file->next();
                 continue;
             }
             // This is how gcov indicates an uncovered line.
             if ($timesHit === '#####') {
                 $timesHit = 0;
                 $coverage->LocUntested += 1;
                 $this->CoverageSummary->LocUntested += 1;
             } else {
                 $coverage->Covered = 1;
                 $coverage->LocTested += 1;
                 $this->CoverageSummary->LocTested += 1;
             }
             $coverageFileLog->AddLine($lineNumber - 1, $timesHit);
             $file->next();
         } else {
             $coveredBranches = 0;
             $uncoveredBranches = 0;
             $throwBranches = 0;
             $fallthroughBranches = 0;
             while (count($fields) < 3 && !$file->eof()) {
                 // Parse branch coverage here.
                 if (substr($gcovLine, 0, 6) === "branch") {
                     // Figure out whether this branch was covered or not.
                     if (strpos($gcovLine, "taken 0%") !== false) {
                         $uncoveredBranches += 1;
                     } else {
                         $coveredBranches += 1;
                     }
                     // Also keep track of the different types of branches encountered.
                     if (strpos($gcovLine, "(throw)") !== false) {
                         $throwBranches += 1;
                     } else {
                         if (strpos($gcovLine, "(fallthrough)") !== false) {
                             $fallthroughBranches += 1;
                         }
                     }
                 }
                 $file->next();
                 $gcovLine = $file->current();
                 $fields = explode(":", $gcovLine);
             }
             // Don't report branch coverage for this line if we only
             // encountered (throw) and (fallthrough) branches here.
             $totalBranches = $coveredBranches + $uncoveredBranches;
             if ($totalBranches > 0 && $totalBranches > $throwBranches + $fallthroughBranches) {
                 $coverageFileLog->AddBranch($lineNumber - 1, $coveredBranches, $totalBranches);
             }
         }
     }
     // Get the ID for this coverage file, or create a new empty one
     //if it doesn't already exist.
     $sql = pdo_query("SELECT id FROM coveragefile WHERE fullpath='{$path}' AND file IS NULL");
     if (pdo_num_rows($sql) == 0) {
         pdo_query("INSERT INTO coveragefile (fullpath) VALUES ('{$path}')");
         $fileid = pdo_insert_id("coveragefile");
     } else {
         $coveragefile_array = pdo_fetch_array($sql);
         $fileid = $coveragefile_array["id"];
     }
     $coverageFile->Id = $fileid;
     // Save these models to the database.
     $coverageFile->Update($this->BuildId);
     $coverageFileLog->BuildId = $this->BuildId;
     $coverageFileLog->FileId = $coverageFile->Id;
     $coverageFileLog->Insert();
     // Add any labels.
     if (array_key_exists($path, $this->Labels)) {
         foreach ($this->Labels[$path] as $labelText) {
             $label = new Label();
             $label->SetText($labelText);
             $coverage->AddLabel($label);
         }
     }
     // Add this Coverage to our summary.
     $this->CoverageSummary->AddCoverage($coverage);
 }
开发者ID:josephsnyder,项目名称:CDash,代码行数:101,代码来源:GcovTar_handler.php

示例6: 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


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