no message

This commit is contained in:
a-kizaki
2026-10-06 12:10:09 +09:00
commit 9c2090ffa2
156 changed files with 14850 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
<?php
/**
* [Ex05 上級 例外処理 - 実在するAPIへの呼び出し]
*
* 難易度:上級
*
* TODO:
* 1. 関数 callAPI($url) を作成してください。
* - $url が有効なURL形式でない場合は、InvalidArgumentException を投げる。
* - $url を用いて、実在するAPI(例:"https://jsonplaceholder.typicode.com/todos/1")への GET リクエストを行う。
* - API呼び出しに失敗した場合は、RuntimeException を投げる。
* - 正常に呼び出せた場合は、APIからのレスポンス(文字列)を返す。
*
* 2. callAPI() を呼び出す際、try-catch-finally ブロックを使用してください。
* - InvalidArgumentException と RuntimeException を個別にキャッチし、エラーメッセージを出力する。
* - finally ブロックで「API call attempt finished.」というメッセージを必ず出力する。
*
*
*/