本文整理汇总了PHP中AbstractHandler类的典型用法代码示例。如果您正苦于以下问题:PHP AbstractHandler类的具体用法?PHP AbstractHandler怎么用?PHP AbstractHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AbstractHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructs a new TargetHandler
*
* @param object the ExpatParser object
* @param object the parent handler that invoked this handler
* @param object the ProjectConfigurator object
*/
function __construct(AbstractSAXParser $parser, AbstractHandler $parentHandler, ProjectConfigurator $configurator)
{
parent::__construct($parser, $parentHandler);
$this->configurator = $configurator;
}
示例2: endElement
/** End element */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'SITE') {
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
$this->Build->ProjectId = $this->projectid;
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $end_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->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
} else {
// Otherwise make sure that it's up-to-date.
$this->Build->UpdateBuild($this->Build->Id, -1, -1);
}
$GLOBALS['PHP_ERROR_BUILD_ID'] = $this->Build->Id;
$this->CoverageSummary->BuildId = $this->Build->Id;
// Insert coverage summary
$this->CoverageSummary->Insert(true);
$this->CoverageSummary->ComputeDifference();
} elseif ($name == 'FILE') {
$this->CoverageSummary->AddCoverage($this->Coverage);
} elseif ($name == 'LABEL') {
if (isset($this->Coverage)) {
$this->Coverage->AddLabel($this->Label);
}
}
}
示例3: __construct
/**
* Constructor
*
* @throws \RuntimeException
* @internal param array $options Optional parameters
*
* @since 2.0
*/
public function __construct($options)
{
if (!static::isSupported()) {
throw new \RuntimeException('APC Extension is not available', 500);
}
parent::__construct($options);
}
示例4: endElement
/** endElement function */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'NOTE') {
$this->Build->ProjectId = $this->projectid;
$this->Build->GetIdFromName($this->SubProjectName);
$this->Build->RemoveIfDone();
// If the build doesn't exist we add it.
if ($this->Build->Id == 0) {
$this->Build->SetSubProject($this->SubProjectName);
// Since we only have precision in minutes (not seconds) here,
// set the start time at the end of the minute so it can be overridden
// by any more precise XML file received later.
$start_time = gmdate(FMT_DATETIME, strtotime($this->Note->Time) + 59);
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $this->Note->Time;
$this->Build->SubmitTime = gmdate(FMT_DATETIME);
$this->Build->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
}
if ($this->Build->Id > 0) {
// Insert the note
$this->Note->BuildId = $this->Build->Id;
$this->Note->Insert();
} else {
add_log('Trying to add a note to a nonexistent build', 'note_handler.php', LOG_ERR);
}
}
}
示例5: endElement
/** End Element */
public function endElement($parser, $name)
{
$parent = $this->getParent();
// should be before endElement
parent::endElement($parser, $name);
if ($name == "STARTDATETIME" && $parent == 'COVERAGELOG') {
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$this->Build->ProjectId = $this->projectid;
$this->BuildId = $this->Build->GetIdFromName($this->SubProjectName);
if ($this->BuildId == 0) {
$t = 'Cannot add a coverage log to a build that does not exist';
$f = 'CoverageLogHandler::endElement';
add_log($t, $f, LOG_ERR, $this->projectid);
}
} else {
if ($name == 'LINE') {
$this->CoverageFile->File .= '<br>';
// cannot be <br/> for backward compatibility
} else {
if ($name == 'FILE') {
if ($this->BuildId != 0) {
$this->CoverageFile->Update($this->BuildId);
$this->CoverageFileLog->BuildId = $this->BuildId;
$this->CoverageFileLog->FileId = $this->CoverageFile->Id;
$this->CoverageFileLog->Insert();
}
unset($this->CoverageFile);
unset($this->CoverageFileLog);
}
}
}
}
示例6: endElement
/** End element */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'SITE') {
$this->Site->Insert();
} elseif ($name == 'UPDATE') {
$this->Build->SiteId = $this->Site->Id;
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
$submit_time = gmdate(FMT_DATETIME);
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $end_time;
$this->Build->SubmitTime = $submit_time;
$this->Build->ProjectId = $this->projectid;
$this->Build->GetIdFromName($this->SubProjectName);
// Update.xml doesn't include SubProject information.
// Check if GetIdFromName returned a child build, and
// if so, change our buildid to point at the parent instead.
$parentid = $this->Build->LookupParentBuildId();
if ($parentid > 0) {
$this->Build->Id = $parentid;
}
$this->Build->RemoveIfDone();
// If the build doesn't exist we add it
if ($this->Build->Id == 0) {
$this->Build->SetSubProject($this->SubProjectName);
$this->Build->Append = $this->Append;
$this->Build->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
} else {
// Otherwise make sure that it's up-to-date.
$this->Build->UpdateBuild($this->Build->Id, -1, -1);
}
$GLOBALS['PHP_ERROR_BUILD_ID'] = $this->Build->Id;
$this->Update->BuildId = $this->Build->Id;
$this->Update->StartTime = $start_time;
$this->Update->EndTime = $end_time;
// Insert the update
$this->Update->Insert();
global $CDASH_ENABLE_FEED;
if ($CDASH_ENABLE_FEED) {
// We need to work the magic here to have a good description
$this->Feed->InsertUpdate($this->projectid, $this->Build->Id);
}
if ($this->Update->Command === '') {
// If the UpdateCommand was not set, then this was a
// "version only" update. This means that CTest only told us
// what version of the code is being built, not what changed
// since last time. In this case we need to query the remote
// repository to figure out what changed.
perform_version_only_diff($this->Update, $this->projectid);
}
// Compute the update statistics
$this->Build->ComputeUpdateStatistics();
} elseif ($name == 'UPDATED' || $name == 'CONFLICTING' || $name == 'MODIFIED') {
$this->Update->AddFile($this->UpdateFile);
unset($this->UpdateFile);
}
}
示例7: __construct
/**
* Constructor
*
* @param \Memcache $memcache A Memcache instance
* @param array $options Optional parameters.
*
* @throws \RuntimeException
* @since 2.0
*/
public function __construct(\Memcache $memcache = null, $options = array())
{
if (!self::isSupported()) {
throw new \RuntimeException('Memcache Extension is not available', 500);
}
$this->memcache = $memcache ?: new \Memcache();
$this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400;
parent::__construct($options);
}
示例8: __construct
/**
*
* @param callable|HandlerInterface $handler
* Handler or factory callable($record, $fingersCrossedHandler).
* @param int $factor
* Sample factor
*/
public function __construct($handler, $factor)
{
parent::__construct();
$this->handler = $handler;
$this->factor = $factor;
if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) {
throw new \RuntimeException("The given handler (" . json_encode($this->handler) . ") is not a callable nor a Monolog\\Handler\\HandlerInterface object");
}
}
示例9:
/**
* Constructs a new NestedElement handler and sets up everything.
*
* @param object the ExpatParser object
* @param object the parent handler that invoked this handler
* @param object the ProjectConfigurator object
* @param object the parent object this element is contained in
* @param object the parent wrapper object
* @param object the target object this task is contained in
* @access public
*/
function __construct($parser, $parentHandler, $configurator, $parent, $parentWrapper, $target) {
parent::__construct($parser, $parentHandler);
$this->configurator = $configurator;
if ($parent instanceof TaskAdapter) {
$this->parent = $parent->getProxy();
} else {
$this->parent = $parent;
}
$this->parentWrapper = $parentWrapper;
$this->target = $target;
}
示例10: __construct
/**
* Constructs a new NestedElement handler and sets up everything.
*
* @param object the ExpatParser object
* @param object the parent handler that invoked this handler
* @param object the ProjectConfigurator object
* @param object the parent object this element is contained in
* @param object the parent wrapper object
* @param object the target object this task is contained in
*/
public function __construct($parser, $parentHandler, $configurator, $parent = null, $parentWrapper = null, $target = null)
{
parent::__construct($parser, $parentHandler);
$this->configurator = $configurator;
if ($parentWrapper != null) {
$this->parent = $parentWrapper->getProxy();
} else {
$this->parent = $parent;
}
$this->parentWrapper = $parentWrapper;
$this->target = $target;
}
示例11: endElement
/** endElement function */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'NOTE') {
if ($this->BuildId > 0) {
// Insert the note
$this->Note->BuildId = $this->BuildId;
$this->Note->Insert();
} else {
add_log("note_handler.php", "Trying to add a note to an unexisting build");
}
}
}
示例12: endElement
/** End element */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'SITE') {
$this->Site->Insert();
} else {
if ($name == 'UPDATE') {
$this->Build->SiteId = $this->Site->Id;
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
$submit_time = gmdate(FMT_DATETIME);
$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 = $end_time;
$this->Build->SubmitTime = $submit_time;
$this->Build->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
$buildid = $this->Build->Id;
} else {
$this->Build->Id = $buildid;
$this->Build->ProjectId = $this->projectid;
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $end_time;
$this->Build->SubmitTime = $submit_time;
}
$GLOBALS['PHP_ERROR_BUILD_ID'] = $buildid;
$this->Update->BuildId = $buildid;
$this->Update->StartTime = $start_time;
$this->Update->EndTime = $end_time;
// Insert the update
$this->Update->Insert();
global $CDASH_ENABLE_FEED;
if ($CDASH_ENABLE_FEED) {
// We need to work the magic here to have a good description
$this->Feed->InsertUpdate($this->projectid, $buildid);
}
// Compute the update statistics
$this->Build->ComputeUpdateStatistics();
} else {
if ($name == 'UPDATED' || $name == 'CONFLICTING' || $name == 'MODIFIED') {
$this->Update->AddFile($this->UpdateFile);
unset($this->UpdateFile);
}
}
}
}
示例13: permissions
/**
* {@inheritdoc}
*/
public function permissions($object, $context)
{
$permissions = parent::permissions($object, $context);
/** Initialize permissions */
$permissions['deals']['view'] = false;
$permissions['payments']['view'] = false;
$permissions['activities']['view'] = false;
$permissions['phones']['view'] = false;
/** Deal permissions */
if ($this->securityContext->isGranted('ROLE_DEAL_VIEW_ALL')) {
$permissions['deals']['view'] = true;
}
if ($this->securityContext->isGranted('ROLE_DEAL_VIEW_OWN') && $object->getUser() == $this->user) {
$permissions['deals']['view'] = true;
}
$permissions['deals']['edit'] = $this->securityContext->isGranted('ROLE_DEAL_EDIT');
$permissions['deals']['remove'] = $this->securityContext->isGranted('ROLE_DEAL_REMOVE');
$permissions['deals']['add'] = $this->securityContext->isGranted('ROLE_DEAL_ADD');
/** Payment permissions */
if ($this->securityContext->isGranted('ROLE_PAYMENT_VIEW_ALL')) {
$permissions['payments']['view'] = true;
}
if ($this->securityContext->isGranted('ROLE_PAYMENT_VIEW_OWN') && $object->getUser() == $this->user) {
$permissions['payments']['view'] = true;
}
$permissions['payments']['edit'] = $this->securityContext->isGranted('ROLE_PAYMENT_EDIT');
$permissions['payments']['remove'] = $this->securityContext->isGranted('ROLE_PAYMENT_REMOVE');
$permissions['payments']['add'] = $this->securityContext->isGranted('ROLE_PAYMENT_ADD');
/** Activity permissions */
if ($this->securityContext->isGranted('ROLE_ACTIVITY_VIEW_ALL')) {
$permissions['activities']['view'] = true;
}
if ($this->securityContext->isGranted('ROLE_ACTIVITY_VIEW_OWN') && $object->getUser() == $this->user) {
$permissions['activities']['view'] = true;
}
$permissions['activities']['add'] = $this->securityContext->isGranted('ROLE_ACTIVITY_ADD');
$permissions['activities']['edit'] = $this->securityContext->isGranted('ROLE_ACTIVITY_EDIT');
$permissions['activities']['remove'] = $this->securityContext->isGranted('ROLE_ACTIVITY_REMOVE');
/** Phone permissions */
if ($this->securityContext->isGranted('ROLE_PHONE_VIEW_ALL')) {
$permissions['phones']['view'] = true;
}
if ($this->securityContext->isGranted('ROLE_PHONE_VIEW_OWN') && $object->getUser() == $this->user) {
$permissions['phones']['view'] = true;
}
$permissions['phones']['add'] = $this->securityContext->isGranted('ROLE_PHONE_ADD');
$permissions['phones']['edit'] = $this->securityContext->isGranted('ROLE_PHONE_EDIT');
$permissions['phones']['remove'] = $this->securityContext->isGranted('ROLE_PHONE_REMOVE');
return $permissions;
}
示例14: endElement
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name == 'CONFIGURE') {
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
$this->Build->ProjectId = $this->projectid;
$this->Build->ProjectId = $this->projectid;
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $end_time;
$this->Build->SubmitTime = gmdate(FMT_DATETIME);
$this->Build->SetSubProject($this->SubProjectName);
$this->Build->InsertErrors = false;
$this->Build->GetIdFromName($this->SubProjectName);
$this->Build->RemoveIfDone();
if ($this->Build->Id == 0) {
// If the build doesn't exist we add it
add_build($this->Build, $this->scheduleid);
} else {
// Otherwise we make sure that it's up-to-date.
$this->Build->UpdateBuild($this->Build->Id, -1, -1);
}
$GLOBALS['PHP_ERROR_BUILD_ID'] = $this->Build->Id;
$this->Configure->BuildId = $this->Build->Id;
$this->Configure->StartTime = $start_time;
$this->Configure->EndTime = $end_time;
// Insert the configure
if ($this->Configure->Exists()) {
$this->Configure->Delete();
}
$this->Configure->Insert();
// Insert errors from the log file
$this->Configure->ComputeWarnings();
$this->Configure->ComputeErrors();
$this->Build->ComputeConfigureDifferences();
// Record the number of warnings & errors with the build.
$this->Build->SetNumberOfConfigureWarnings($this->Configure->NumberOfWarnings);
$this->Build->SetNumberOfConfigureErrors($this->Configure->NumberOfErrors);
// Record configure duration with the build.
$this->Build->SetConfigureDuration($this->EndTimeStamp - $this->StartTimeStamp);
// Update the tally of warnings & errors in the parent build,
// if applicable.
$this->Build->UpdateParentConfigureNumbers($this->Configure->NumberOfWarnings, $this->Configure->NumberOfErrors);
} elseif ($name == 'LABEL') {
if (isset($this->Configure)) {
$this->Configure->AddLabel($this->Label);
}
}
}
示例15: endElement
/** End Element */
public function endElement($parser, $name)
{
parent::endElement($parser, $name);
if ($name === 'SITE') {
$start_time = gmdate(FMT_DATETIME, $this->StartTimeStamp);
$end_time = gmdate(FMT_DATETIME, $this->EndTimeStamp);
$this->Build->ProjectId = $this->projectid;
$this->Build->StartTime = $start_time;
$this->Build->EndTime = $end_time;
$this->Build->SubmitTime = gmdate(FMT_DATETIME);
$this->Build->SetSubProject($this->SubProjectName);
$this->Build->GetIdFromName($this->SubProjectName);
$this->Build->RemoveIfDone();
if ($this->Build->Id == 0) {
// If the build doesn't exist we add it.
$this->Build->InsertErrors = false;
add_build($this->Build, $this->scheduleid);
} else {
// Otherwise make sure that it's up-to-date.
$this->Build->UpdateBuild($this->Build->Id, -1, -1);
}
// Record the coverage data that we parsed from this file.
foreach ($this->CoverageFiles as $coverageInfo) {
$coverageFile = $coverageInfo[0];
$coverageFileLog = $coverageInfo[1];
$coverageFile->TrimLastNewline();
$coverageFile->Update($this->Build->Id);
$coverageFileLog->BuildId = $this->Build->Id;
$coverageFileLog->FileId = $coverageFile->Id;
$coverageFileLog->Insert(true);
}
} elseif ($name == 'LINE') {
$this->CurrentCoverageFile->File .= rtrim($this->CurrentLine);
// Cannot be <br/> for backward compatibility.
$this->CurrentCoverageFile->File .= '<br>';
} elseif ($name == 'FILE') {
// Store these objects to be inserted after we're guaranteed
// to have a valid buildid.
$this->CoverageFiles[] = array($this->CurrentCoverageFile, $this->CurrentCoverageFileLog);
} elseif ($name == 'COVERAGELOG') {
if (empty($this->CoverageFiles)) {
// Store these objects to be inserted after we're guaranteed
// to have a valid buildid.
$this->CoverageFiles[] = array(new CoverageFile(), new CoverageFileLog());
}
}
}