本文整理汇总了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);
}
}
}