PHP_CompatInfo (Previous) (Next) PHP_CompatInfo::removeListener

View this page in Last updated: Sun, 28 Sep 2008
English | French | German | Japanese | Plain HTML

PHP_CompatInfo::addListener()

PHP_CompatInfo::addListener()  -- Registers a new listener

Description

Registers a new listener with the given criteria

Paramètres

mixed $callback

A PHP callback

chaîne de caractères $nName

(optional) Expected notification name

Valeur retournée

returns void

Valeurs renvoyées

throws no exceptions thrown

Depuis

since version 1.8.0b3 (2008-06-07)

Note

Cette fonction ne peut pas être appelée de façon statique.

Exemple

Attach a simple function that will listen all PHP_CompatInfo events, which write start and end audit results in a flat file defined by a php constant.


<?php
require_once 'PHP/CompatInfo.php';

define('DEST_PCI_LOG''/var/log/pciEvents.log');

function debugNotify(&$auditEvent)
{
    $notifyName $auditEvent->getNotificationName();
    $notifyInfo $auditEvent->getNotificationInfo();

    if ($notifyName == PHP_COMPATINFO_EVENT_AUDITSTARTED) {
        error_log($notifyName.':'PHP_EOL .
                  var_export($notifyInfotrue) . PHP_EOL,
                  3DEST_PCI_LOG);

    } elseif ($notifyName == PHP_COMPATINFO_EVENT_AUDITFINISHED) {
        error_log($notifyName.':'PHP_EOL .
                  var_export($notifyInfotrue) . PHP_EOL,
                  3DEST_PCI_LOG);
    }
}

$cbObserver 'debugNotify';

$pci = new PHP_CompatInfo();
$pci->addListener($cbObserver);
// ...
$source  '';      // <- identify the date source to parse
$options = array(); // <- some parser options

$pci->parseData($source$options);

$pci->removeListener($cbObserver);
?>

PHP_CompatInfo (Previous) (Next) PHP_CompatInfo::removeListener

Download Documentation Last updated: Sun, 28 Sep 2008
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.