本文整理匯總了PHP中Zend\Stdlib\ErrorHandler::started方法的典型用法代碼示例。如果您正苦於以下問題:PHP ErrorHandler::started方法的具體用法?PHP ErrorHandler::started怎麽用?PHP ErrorHandler::started使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Stdlib\ErrorHandler
的用法示例。
在下文中一共展示了ErrorHandler::started方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: tearDown
public function tearDown()
{
// be sure the error handler has been stopped
if (ErrorHandler::started()) {
ErrorHandler::stop();
$this->fail('ErrorHandler not stopped');
}
}
示例2: testStarted
public function testStarted()
{
$this->assertFalse(ErrorHandler::started());
ErrorHandler::start();
$this->assertTrue(ErrorHandler::started());
ErrorHandler::stop();
$this->assertFalse(ErrorHandler::started());
}
示例3: fromString
/**
* Loads the SOAP message from a string.
*
* @param string $soapData
* @throws SoapException\LoadSoapDataException
*/
public function fromString($soapData)
{
$dom = $this->getDom();
try {
ErrorHandler::start();
$dom->loadXML($soapData);
ErrorHandler::stop(true);
} catch (\Exception $e) {
if (ErrorHandler::started()) {
ErrorHandler::stop();
}
throw new SoapException\LoadSoapDataException($e->getMessage());
}
$rootElement = $dom->documentElement;
if ('envelope' != strtolower($rootElement->localName)) {
throw new SoapException\LoadSoapDataException(sprintf("Invalid root element '%s'", $rootElement->localName));
}
}
示例4: isValid
/**
* {@inheritdoc}
* @see \Saml\Ecp\Response\Validator\ValidatorInterface::isValid()
*/
public function isValid(ResponseInterface $response)
{
$valid = false;
$schemaFile = $this->getOption(self::OPT_SOAP_ENVELOPE_XSD);
if (null === $schemaFile) {
throw new GeneralException\MissingOptionException(self::OPT_SOAP_ENVELOPE_XSD);
}
if (!file_exists($schemaFile)) {
throw new GeneralException\FileNotFoundException($schemaFile);
}
if (!is_file($schemaFile)) {
throw new GeneralException\InvalidFileException(sprintf("Invalid file: '%s'", $schemaFile));
}
if (!is_readable($schemaFile)) {
throw new GeneralException\InvalidFileException(sprintf("File not readable: '%s'", $schemaFile));
}
try {
$soapMessage = $response->getSoapMessage();
} catch (\Exception $e) {
$this->addMessage(sprintf("Error loading SOAP message: [%s] %s", get_class($e), $e->getMessage()));
return false;
}
$dom = $soapMessage->getDom();
try {
ErrorHandler::start();
if ($dom->schemaValidate($schemaFile)) {
$valid = true;
}
ErrorHandler::stop(true);
} catch (\Exception $e) {
$this->addMessage(sprintf("Failed schema validate (schema:%s): [%s] %s", $schemaFile, get_class($e), $e->getMessage()));
}
if (ErrorHandler::started()) {
ErrorHandler::stop();
}
return $valid;
}
示例5: write
/**
* Log a message to this writer.
*
* @param array $event log data event
* @return void
*/
public function write(array $event)
{
foreach ($this->filters as $filter) {
if (!$filter->filter($event)) {
return;
}
}
$errorHandlerStarted = false;
if ($this->convertWriteErrorsToExceptions && !ErrorHandler::started()) {
ErrorHandler::start($this->errorsToExceptionsConversionLevel);
$errorHandlerStarted = true;
}
try {
$this->doWrite($event);
} catch (\Exception $e) {
if ($errorHandlerStarted) {
ErrorHandler::stop();
$errorHandlerStarted = false;
}
throw $e;
}
if ($errorHandlerStarted) {
$error = ErrorHandler::stop();
$errorHandlerStarted = false;
if ($error) {
throw new Exception\RuntimeException("Unable to write", 0, $error);
}
}
}