{"id":18929460,"url":"https://github.com/thecodingmachine/utils.composite-exception","last_synced_at":"2025-04-15T15:31:00.674Z","repository":{"id":57020159,"uuid":"42117319","full_name":"thecodingmachine/utils.composite-exception","owner":"thecodingmachine","description":"A utility exception class that can aggregates several exceptions into one. Useful for aggregating exceptions triggered in loops.","archived":false,"fork":false,"pushed_at":"2018-02-28T10:23:32.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"1.0","last_synced_at":"2025-04-01T18:02:14.936Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thecodingmachine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-08T14:26:02.000Z","updated_at":"2020-07-27T14:49:34.000Z","dependencies_parsed_at":"2022-08-22T20:31:18.417Z","dependency_job_id":null,"html_url":"https://github.com/thecodingmachine/utils.composite-exception","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Futils.composite-exception","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Futils.composite-exception/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Futils.composite-exception/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodingmachine%2Futils.composite-exception/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodingmachine","download_url":"https://codeload.github.com/thecodingmachine/utils.composite-exception/tar.gz/refs/heads/1.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248351901,"owners_count":21089360,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T11:32:51.673Z","updated_at":"2025-04-15T15:31:00.403Z","avatar_url":"https://github.com/thecodingmachine.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Latest Stable Version](https://poser.pugx.org/mouf/utils.composite-exception/version)](https://packagist.org/packages/mouf/utils.composite-exception)\n[![Latest Unstable Version](https://poser.pugx.org/mouf/utils.composite-exception/v/unstable)](//packagist.org/packages/mouf/utils.composite-exception)\n[![Total Downloads](https://poser.pugx.org/mouf/utils.composite-exception/downloads)](https://packagist.org/packages/mouf/utils.composite-exception)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/thecodingmachine/utils.composite-exception/badges/quality-score.png?b=1.0)](https://scrutinizer-ci.com/g/thecodingmachine/utils.composite-exception/?branch=1.0)\n[![Build Status](https://travis-ci.org/thecodingmachine/utils.composite-exception.svg?branch=1.0)](https://travis-ci.org/thecodingmachine/utils.composite-exception)\n[![Coverage Status](https://coveralls.io/repos/thecodingmachine/utils.composite-exception/badge.svg?branch=1.0\u0026service=github)](https://coveralls.io/github/thecodingmachine/utils.composite-exception?branch=1.0)\n\n# Composite exception\n\nThis project contains a simple PHP exception that can aggregate multiple exceptions in one.\nThe rationale behind this idea is to allow exceptions to be triggered in loops, and to throw only one at the end of your script:\n\n## Installation\n\nYou can install this package through Composer:\n\n```json\n{\n    \"require\": {\n        \"mouf/utils.composite-exception\": \"~1.0\"\n    }\n}\n```\n\nThe packages adheres to the [SemVer](http://semver.org/) specification, and there will be full backward compatibility\nbetween minor versions.\n\n## Usage\n\nThis package contains a `CompositeException` class with 2 methods: `add(\\Throwable $e)` and `isEmtpy()`.\n\nTypical usage:\n\n```php\nuse Mouf\\Utils\\CompositeException;\n\n$compositeException = new CompositeException();\n\nforeach (...) {\n    try {\n        // Do stuff\n    } catch (\\Exception $e) {\n        // Add exceptions to the composite exception\n        $compositeException-\u003eadd($e);\n    }\n}\n\nif (!$compositeException-\u003eisEmpty()) {\n    // If not empty, let's throw the composite exception.\n    throw $compositeException;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Futils.composite-exception","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodingmachine%2Futils.composite-exception","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodingmachine%2Futils.composite-exception/lists"}