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


PHP Errors::getErrors方法代码示例

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


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

示例1: addErrorObject

 /**
  * Add errors from Errors object
  * @param Errors $object
  * @param bool $saveKey
  * @return $this
  */
 public function addErrorObject(Errors $object, $saveKey = false)
 {
     $errors = $object->getErrors(true);
     foreach ($errors as $key => $error) {
         $this->addError($error['name'], $saveKey ? $key : '', $error['data']);
     }
     return $this;
 }
开发者ID:vvasystem,项目名称:errorstrait,代码行数:14,代码来源:Errors.php

示例2: showResults

 private function showResults()
 {
     if (Errors::hasErrors()) {
         $this->response['status'] = FALSE;
         $this->response['errors'] = Errors::getErrors();
         unset($this->response['results']);
     }
     echo json_encode($this->response);
     exit;
 }
开发者ID:alexber127,项目名称:StCms-v3.0,代码行数:10,代码来源:Ajax.php

示例3: testWithOneFactory

 /**
  * Base testing
  */
 public function testWithOneFactory()
 {
     $errors = new Errors();
     $errors->addFactory(new FirstErrorFactory());
     $errors->addFactory(new SecondErrorFactory());
     $codes = $errors->getErrors();
     $this->assertEquals([1 => 'Error #1', 2 => 'Error #2', 11 => 'Error #11', 12 => 'Error #12'], $codes);
     $exceptions = $errors->getExceptions();
     $this->assertEquals(['InvalidArgumentException' => 1, 'RuntimeException' => 2, 'LogicException' => 11], $exceptions);
     // Success check reserved diapasons
     $errors->checkReservedCodes();
     // Success check has exception
     $this->assertTrue($errors->hasException(new \RuntimeException()));
     $this->assertFalse($errors->hasException(new \OutOfRangeException()));
     // Success get code by exception
     $this->assertEquals(11, $errors->getExceptionCode(new \LogicException()));
 }
开发者ID:Gtvar,项目名称:FivePercent-Error,代码行数:20,代码来源:ErrorsTest.php

示例4: chain

 /**
  * Combines the errors from the Errors object passed into this object
  *
  * @param Errors $errors An errors object to combine with this.
  *
  * @return this updated with all errors from both objects
  */
 public function chain(Errors $errors)
 {
     $this->addErrors($errors->getErrors());
     return $this;
 }
开发者ID:wb-crowdfusion,项目名称:crowdfusion,代码行数:12,代码来源:Errors.php

示例5: Errors

//Was the datafile fetched successfully
$errors = new Errors();
if ($res === -2) {
    $errors->addError(new Error(2, sprintf($siteContext->getLocale('errDamagedDatasource'), $stier->getOption('name_of_service'))));
} elseif (!$res or $res === 0) {
    $errors->addError(new Error(2, sprintf($siteContext->getLocale('errDatasourceInaccessible'), $stier->getOption('name_of_service'))));
}
if ($errors->isOccured()) {
    require_once "lib/SiteGenerator/SiteGenerator.php";
    require_once "lib/StatGenerator.php";
    $sg = SiteGenerator::getGenerator($ind['type'], $siteContext);
    $headline = $sg->newElement("headline");
    $headline->setHeadline($siteContext->getLocale('errAnErrorOccured'));
    $headline->setSize(1);
    $sg->addElement($headline);
    $errorList = $errors->getErrors();
    foreach ($errorList as $error) {
        $text = $sg->newElement("text");
        $text->setText($error->getMessage());
        $sg->addElement($text);
    }
    echo $sg->getSite();
    exit;
}
//Do a password check
if (strlen($datafil->getLine(57)) > 0) {
    $pwds = explode("::", $datafil->getLine(57));
    //Is a valid password given?
    if (strlen($ind['brugerkodeord']) === 0 or !in_array($ind['brugerkodeord'], $pwds) and $ind['brugerkodeord'] !== $datafil->getLine(6)) {
        require_once "lib/SiteGenerator/SiteGenerator.php";
        require_once "lib/StatGenerator.php";
开发者ID:simonmikkelsen,项目名称:zipstat,代码行数:31,代码来源:stats.php

示例6: foreach

<?php

if (Errors::hasErrors()) {
    ?>
    <div class="callout callout-danger">
        <?php 
    foreach (Errors::getErrors() as $error) {
        ?>
            <p class="small"> - <?php 
        echo $error;
        ?>
</p>
        <?php 
    }
    ?>
    </div>
<?php 
}
开发者ID:alexber127,项目名称:StCms-v3.0,代码行数:18,代码来源:errors.php


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