Friend spotlight!
Whimsical Animations course
Friend spotlight!
NEW Whimsical Animations course
Friend spotlight! NEW Whimsical Animations course
huge discount only this week
Friend spotlight! Want to make your project stand out? NEW Whimsical Animations course huge discount only this week
Adapter

Adapter を PHP で

Adapter 構造に関するデザインパターンの一つで 非互換なオブジェクト同士の協働を可能とします

アダプターは二つのオブジェクト間のラッパーとして機能します 一方のオブジェクトへの呼び出しを捕まえ 二つ目のオブジェクトが認識可能なデータ形式とインターフェースに変換します

複雑度

人気度

使用例 Adapter パターンは PHP コードではよく見かけます 旧来のコードに基づいたシステムでよく使用されます そのような場合 アダプターは旧来のコードを現代のクラスから使用可能にします

見つけ方 アダプターは 異なる抽象クラスまたはインターフェース型のインスタンスを取るコンストラクターの存在により認識できます アダプターは いずれかのメソッドへの呼び出しを受け取ると パラメーターを適切な形式に変換し ラップされたオブジェクトの一つまたは複数のメソッドを呼び出します

他言語での Adapter

Adapter を C# で Adapter を C++ で Adapter を Go で Adapter を Java で Adapter を Python で Adapter を Ruby で Adapter を Rust で Adapter を Swift で Adapter を TypeScript で