承接 mouf/utils.composite-exception 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mouf/utils.composite-exception

最新稳定版本:v1.0.0

Composer 安装命令:

composer require mouf/utils.composite-exception

包简介

This project contains a simple PHP exception that can aggregate multiple exceptions in one.

README 文档

README

Latest Stable Version Latest Unstable Version Total Downloads Scrutinizer Code Quality Build Status Coverage Status

Composite exception

This project contains a simple PHP exception that can aggregate multiple exceptions in one. The rationale behind this idea is to allow exceptions to be triggered in loops, and to throw only one at the end of your script:

Installation

You can install this package through Composer:

{
    "require": {
        "mouf/utils.composite-exception": "~1.0"
    }
}

The packages adheres to the SemVer specification, and there will be full backward compatibility between minor versions.

Usage

This package contains a CompositeException class with 2 methods: add(\Throwable $e) and isEmtpy().

Typical usage:

use Mouf\Utils\CompositeException;

$compositeException = new CompositeException();

foreach (...) {
    try {
        // Do stuff
    } catch (\Exception $e) {
        // Add exceptions to the composite exception
        $compositeException->add($e);
    }
}

if (!$compositeException->isEmpty()) {
    // If not empty, let's throw the composite exception.
    throw $compositeException;
}

统计信息

  • 总下载量: 251.59k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-08