{"id":40960168,"url":"https://github.com/torunar/operation-result","last_synced_at":"2026-01-22T05:42:31.476Z","repository":{"id":57072045,"uuid":"422854991","full_name":"torunar/operation-result","owner":"torunar","description":"This package provides a component that can be used to store results (data and errors) of some operation","archived":false,"fork":false,"pushed_at":"2021-11-10T12:40:37.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-28T04:10:00.274Z","etag":null,"topics":["dto","operation-result","return"],"latest_commit_sha":null,"homepage":"","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/torunar.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":"2021-10-30T10:53:38.000Z","updated_at":"2021-11-10T12:40:03.000Z","dependencies_parsed_at":"2022-08-24T14:54:33.641Z","dependency_job_id":null,"html_url":"https://github.com/torunar/operation-result","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/torunar/operation-result","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torunar%2Foperation-result","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torunar%2Foperation-result/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torunar%2Foperation-result/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torunar%2Foperation-result/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/torunar","download_url":"https://codeload.github.com/torunar/operation-result/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torunar%2Foperation-result/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28656551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["dto","operation-result","return"],"created_at":"2026-01-22T05:42:30.552Z","updated_at":"2026-01-22T05:42:31.469Z","avatar_url":"https://github.com/torunar.png","language":"PHP","readme":"# Operation result\n\n# About\n\nThis package provides a component that can be used to store results (data and errors) of some operation: API query, system call, data parsing, etc.\n\nThis package aims to provide **simple tool** that can be used in cases where robust specific operation result classes create unnecessary complexity. \n\n# Installation\n\n```bash\n$ composer require torunar/operation-result\n```\n\n# Usage\n\n```php\n\u003c?php\n\nuse Torunar\\OperationResult\\OperationResult;\n\n$curl = curl_init('https://example.com');\ncurl_setopt(CURLOPT_RETURNTRANSFER, true);\n\n$content = curl_exec($curl);\n$errorCode = curl_errno();\n$errorMessage = curl_error();\ncurl_close($curl);\n\n$operationResult = new OperationResult(true);\nif ($errorCode) {\n    $operationResult-\u003esetIsSuccessful(false);\n    $operationResult-\u003eaddError($errorMessage, $errorCode);\n} else {\n    $operationResult-\u003esetData($content, 'content');\n}\n\n// Check whether operation succeeded\n$operationResult-\u003eisSuccessful();\n\n// Get all data\n$operationResult-\u003egetData();\n\n// Get single data record\n$operationResult-\u003egetData('content');\n\n// Get error messages\n$operationResult-\u003egetErrors();\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorunar%2Foperation-result","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftorunar%2Foperation-result","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorunar%2Foperation-result/lists"}