Ground Sunlight

Windowsで作る - PHPプログラミングの開発環境

ユーザ用ツール

サイト用ツール


psr:psr13

差分

このページの2つのバージョン間の差分を表示します。

この比較画面にリンクする

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
psr:psr13 [2020/07/20 08:18]
y2sunlight [1.6 発展的リンクオブジェクト]
psr:psr13 [2020/09/01 11:53] (現在)
tanaka [PSR-13: Link definition interfaces]
行 1: 行 1:
-> 編集中 
- 
 ====== PSR-13: Link definition interfaces ====== ====== PSR-13: Link definition interfaces ======
  
  --- //[[http://www.y2sunlight.com|y2sunlight]] 2020-06-23//  --- //[[http://www.y2sunlight.com|y2sunlight]] 2020-06-23//
  
-本章は、若干の補足を加筆してはいるものの単に[[https://www.php-fig.org/psr/|PSRのサイト]]を翻訳したものに過ぎません。英語が堪能な方は原文をご参照下さい。翻訳に当たっては、基本的に機械翻訳を使い、理解できない部分は独断で意訳しております。拙い訳では御座いますが恥を忍んで投稿しておりますので、ご指摘など御座いましたらコメントを頂ければ幸いです。+本章は、若干の補足を加筆してはいるものの単に[[https://www.php-fig.org/psr/|PSRのサイト]]を日本語に翻訳したものに過ぎません。英語が堪能な方は原文をご参照下さい。翻訳に当たっては、基本的に機械翻訳を使い、理解できない部分は独断で意訳しております。拙い訳では御座いますが恥を忍んで投稿しておりますので、ご指摘など御座いましたらコメントを頂ければ幸いです。
  
 関連記事 関連記事
行 20: 行 18:
   * PSR-13: Link definition interfaces - リンク定義インターフェース   * PSR-13: Link definition interfaces - リンク定義インターフェース
   * [[psr:psr14|PSR-14: Event Dispatcher - イベントディスパッチャー]]    * [[psr:psr14|PSR-14: Event Dispatcher - イベントディスパッチャー]] 
-  * [[psr:psr15|PSR-15: HTTP Handlers - HTTPハンドラー]] +  * [[psr:psr15|PSR-15: HTTP Server Request Handlers - HTTPサーバーリクエストハンドラー]]  
 +  * [[psr:psr16|PSR-16: Common Interface for Caching Libraries - キャッシングライブラリのための共通インターフェース]]  
 +  * [[psr:psr17|PSR-17: HTTP Factories - HTTPファクトリー]]  
 +  * [[psr:psr18|PSR-18: HTTP Client - HTTPクライアント]]  
 +  * [[psr:psr19|PSR-19: PHPDoc tags(Draft) - PHPDocタグ]] 
  
 ----- -----
行 125: 行 127:
 The interfaces and classes described are provided as part of the psr/link package. The interfaces and classes described are provided as part of the psr/link package.
  
-説明されているインターフェースとクラスは、[[https://packagist.org/packages/psr/link|psr/link]]パッケージの一部として提供されます。+説明されているインターフェースとクラスは、[[https://packagist.org/packages/psr/link|psr/link]] パッケージの一部として提供されます。
  
 \\ \\
行 139: 行 141:
  
 /** /**
- * A readable link object. 
  * 読み取り可能なリンクオブジェクト。  * 読み取り可能なリンクオブジェクト。
  */  */
行 145: 行 146:
 { {
     /**     /**
-     * Returns the target of the link. 
      * リンクのターゲットを返します。      * リンクのターゲットを返します。
      *      *
-     * The target link must be one of: 
-     * - An absolute URI, as defined by RFC 5988. 
-     * - A relative URI, as defined by RFC 5988. The base of the relative link 
-         is assumed to be known based on context by the client. 
-     * - A URI template as defined by RFC 6570. 
      *      *
      * ターゲットリンクは次のいずれかである必要があります。      * ターゲットリンクは次のいずれかである必要があります。
-     * -RFC 5988で定義されている絶対URI。 +     * - RFC 5988で定義されている絶対URI。 
-     * -RFC 5988で定義されている相対URI。相対リンクのベースは、クライアントによるコンテキストに +     * - RFC 5988で定義されている相対URI。相対リンクのベースは、クライアントによるコンテキストに 
-         基づいて認識されていると想定されています。 +       基づいて認識されていると想定されています。 
-     * -RFC 6570で定義されているURIテンプレート。+     * - RFC 6570で定義されているURIテンプレート。
      *      *
-     * If a URI template is returned, isTemplated() MUST return True. 
      * URIテンプレートが返される場合、isTemplated()はTrueを返さなければなりません (MUST)      * URIテンプレートが返される場合、isTemplated()はTrueを返さなければなりません (MUST)
      *      *
行 168: 行 162:
  
     /**     /**
-     * Returns whether or not this is a templated link. 
      * これがテンプレートリンクかどうかを返します。      * これがテンプレートリンクかどうかを返します。
      *      *
      * @return bool      * @return bool
-       True if this link object is templated, False otherwise. 
        このリンクオブジェクトがテンプレート化されている場合はTrue、そうでない場合はFalse。        このリンクオブジェクトがテンプレート化されている場合はTrue、そうでない場合はFalse。
      */      */
行 178: 行 170:
  
     /**     /**
-     * Returns the relationship type(s) of the link. 
      * リンクの関係タイプを返します。      * リンクの関係タイプを返します。
      *      *
-     * This method returns 0 or more relationship types for a link, expressed +     * このメソッドは、リンクに対し0以上の関係タイプを文字列の配列として返します。
-     * as an array of strings. +
-     * このメソッドは、リンク0以上の関係タイプを文字列の配列として返します。+
      *      *
      * @return string[]      * @return string[]
行 190: 行 179:
  
     /**     /**
-     * Returns a list of attributes that describe the target URI. 
      * ターゲットURIを説明する属性のリストを返します。      * ターゲットURIを説明する属性のリストを返します。
      *      *
      * @return array      * @return array
-       A key-value list of attributes, where the key is a string and the value 
-      is either a PHP primitive or an array of PHP strings. If no values are 
-      found an empty array MUST be returned. 
       属性のKey-Valueリスト。キーは文字列で、値はPHPプリミティブまたはPHP文字列の配列です。        属性のKey-Valueリスト。キーは文字列で、値はPHPプリミティブまたはPHP文字列の配列です。 
       値が見つからない場合は、空の配列を返す必要があります。       値が見つからない場合は、空の配列を返す必要があります。
行 214: 行 199:
  
 /** /**
- An evolvable link value object. + 進化可能なリンク値オブジェクト。
- * 発展的なリンク値オブジェクト。+
  */  */
 interface EvolvableLinkInterface extends LinkInterface interface EvolvableLinkInterface extends LinkInterface
 { {
     /**     /**
-     * Returns an instance with the specified href. 
      * 指定されたhrefを持つインスタンスを返します。      * 指定されたhrefを持つインスタンスを返します。
      *      *
      * @param string $href      * @param string $href
-       The href value to include. It must be one of: 
-         - An absolute URI, as defined by RFC 5988. 
-         - A relative URI, as defined by RFC 5988. The base of the relative link 
-           is assumed to be known based on context by the client. 
-         - A URI template as defined by RFC 6570. 
-         - An object implementing __toString() that produces one of the above 
-           values. 
        含めるhref値。 次のいずれかである必要があります。        含めるhref値。 次のいずれかである必要があります。
-         -RFC 5988で定義されている絶対URI。 +         - RFC 5988で定義されている絶対URI。 
-         -RFC 5988で定義されている相対URI。相対リンクのベースは、クライアントによるコンテキストに +         - RFC 5988で定義されている相対URI。相対リンクのベースは、クライアントによるコンテキストに 
-          基づいて認識されていると想定されています。 +           基づいて認識されていると想定されています。 
-         -RFC 6570で定義されているURIテンプレート。 +         - RFC 6570で定義されているURIテンプレート。 
-         -上記の値の1つを生成する__toString()を実装するオブジェクト。+         - 上記の値の1つを生成する__toString()を実装するオブジェクト。
      *      *
-     * An implementing library SHOULD evaluate a passed object to a string 
-     * immediately rather than waiting for it to be returned later. 
      * 実装ライブラリは、渡されたオブジェクトが後で返されるのを待つのではなく、      * 実装ライブラリは、渡されたオブジェクトが後で返されるのを待つのではなく、
      * すぐに文字列に評価する必要があります( SHOULD )。      * すぐに文字列に評価する必要があります( SHOULD )。
行 248: 行 222:
  
     /**     /**
-     * Returns an instance with the specified relationship included. 
      * 指定された関係を含むインスタンスを返します。      * 指定された関係を含むインスタンスを返します。
      *      *
-     * If the specified rel is already present, this method MUST return +     * 指定されたrelがすでに存在する場合、このメソッドはエラーなしで正常に戻る必要があります 
-     * normally without errors, but without adding the rel a second time. +     但し、もう一度relを追加する必要はありません。
-     * 指定されたrelがすでに存在する場合、このメソッドはエラーなしで正常に戻る必要がありますが、 +
-     * もう一度relを追加する必要はありません。+
      *      *
      * @param string $rel      * @param string $rel
-       The relationship value to add. 
        追加する関係の値。        追加する関係の値。
      * @return static      * @return static
行 264: 行 234:
  
     /**     /**
-     * Returns an instance with the specified relationship excluded. 
      * 指定された関係を除外したインスタンスを返します。      * 指定された関係を除外したインスタンスを返します。
      *      *
-     * If the specified rel is already not present, this method MUST return 
-     * normally without errors. 
      * 指定されたrelが既に存在しない場合、このメソッドはエラーなしで正常に戻る必要があります( MUST )。      * 指定されたrelが既に存在しない場合、このメソッドはエラーなしで正常に戻る必要があります( MUST )。
      *      *
      * @param string $rel      * @param string $rel
-       The relationship value to exclude. 
        除外する関係値        除外する関係値
      * @return static      * @return static
行 279: 行 245:
  
     /**     /**
-     * Returns an instance with the specified attribute added. 
      * 指定された属性が追加されたインスタンスを返します。      * 指定された属性が追加されたインスタンスを返します。
      *      *
-     * If the specified attribute is already present, it will be overwritten 
-     * with the new value. 
      * 指定された属性がすでに存在する場合は、新しい値で上書きされます。      * 指定された属性がすでに存在する場合は、新しい値で上書きされます。
      *      *
      * @param string $attribute      * @param string $attribute
-       The attribute to include. 
        含める属性        含める属性
      * @param string $value      * @param string $value
-       The value of the attribute to set. 
        設定する属性の値        設定する属性の値
      * @return static      * @return static
行 297: 行 258:
  
     /**     /**
-     * Returns an instance with the specified attribute excluded. 
      * 指定された属性を除外したインスタンスを返します。      * 指定された属性を除外したインスタンスを返します。
      *      *
-     * If the specified attribute is not present, this method MUST return 
-     * normally without errors. 
      * 指定された属性が存在しない場合、このメソッドはエラーなしで正常に戻る必要があります( MUST )。      * 指定された属性が存在しない場合、このメソッドはエラーなしで正常に戻る必要があります( MUST )。
      *      *
      * @param string $attribute      * @param string $attribute
-       The attribute to remove. 
        削除する属性        削除する属性
      * @return static      * @return static
行 323: 行 280:
  
 /** /**
- * A link provider object. 
  * リンクプロバイダーオブジェクト  * リンクプロバイダーオブジェクト
  */  */
行 329: 行 285:
 { {
     /**     /**
-     * Returns an iterable of LinkInterface objects. 
      * LinkInterfaceオブジェクトのiterableを返します。      * LinkInterfaceオブジェクトのiterableを返します。
      *      *
-     * The iterable may be an array or any PHP \Traversable object. If no links +     * iterableは、配列または任意のPHP \Traversableオブジェクトです。利用可能なリンクがない場合は、 
-     * are available, an empty array or \Traversable MUST be returned. +     * 空の配列 または \Traversableを返す必要があります( MUST )。
-     * iterableは、配列または任意のPHP \Traversableオブジェクトです。 利用可能なリンクがない場合は、 +
-     * 空の配列または\ Traversableを返す必要があります( MUST )。+
      *      *
      * @return LinkInterface[]|\Traversable      * @return LinkInterface[]|\Traversable
行 342: 行 295:
  
     /**     /**
-     * Returns an iterable of LinkInterface objects that have a specific relationship. 
      * 特定の関係を持つLinkInterfaceオブジェクトのiterableを返します。      * 特定の関係を持つLinkInterfaceオブジェクトのiterableを返します。
      *      *
-     * The iterable may be an array or any PHP \Traversable object. If no links +     * iterableは、配列または任意の PHP \Traversableオブジェクトです。その関係を持つリンクがない場合は、 
-     * with that relationship are available, an empty array or \Traversable MUST be returned. +     空の配列 または \Traversable を返す必要があります。( MUST )
-     * iterableは、配列または任意のPHP \Traversableオブジェクトです。 その関係を持つリンクがない +
-     場合は、空の配列または\Traversableを返す必要があります。+
      *      *
      * @return LinkInterface[]|\Traversable      * @return LinkInterface[]|\Traversable
行 366: 行 316:
  
 /** /**
- An evolvable link provider value object. + 進化可能なリンクプロバイダー値オブジェクト
- * 発展的リンクプロバイダー値オブジェクト+
  */  */
 interface EvolvableLinkProviderInterface extends LinkProviderInterface interface EvolvableLinkProviderInterface extends LinkProviderInterface
 { {
     /**     /**
-     * Returns an instance with the specified link included. 
      * 指定されたリンクを含むインスタンスを返します。      * 指定されたリンクを含むインスタンスを返します。
      *      *
-     * If the specified link is already present, this method MUST return normally 
-     * without errors. The link is present if $link is === identical to a link 
-     * object already in the collection. 
      * 指定されたリンクがすでに存在する場合、このメソッドはエラーなしで正常に戻る必要があります。       * 指定されたリンクがすでに存在する場合、このメソッドはエラーなしで正常に戻る必要があります。 
-     * $linkが===既にコレクションにあるリンクオブジェクトと同一である場合、リンクは存在します。+     * $linkが既にコレクションにあるリンクオブジェクトと同一( ''==='' )な場合、リンクは存在します。
      *      *
      * @param LinkInterface $link      * @param LinkInterface $link
-       A link object that should be included in this collection. 
        このコレクションに含める必要のあるリンクオブジェクト。        このコレクションに含める必要のあるリンクオブジェクト。
      * @return static      * @return static
行 389: 行 333:
  
     /**     /**
-     * Returns an instance with the specified link removed. 
      * 指定されたリンクが削除されたインスタンスを返します。      * 指定されたリンクが削除されたインスタンスを返します。
      *      *
-     * If the specified link is not present, this method MUST return normally 
-     * without errors. The link is present if $link is === identical to a link 
-     * object already in the collection. 
      * 指定されたリンクが存在しない場合、このメソッドはエラーなしで正常に戻る必要があります。       * 指定されたリンクが存在しない場合、このメソッドはエラーなしで正常に戻る必要があります。 
-     * $linkが===既にコレクションにあるリンクオブジェクトと同一である場合、リンクは存在します。+     * $linkが既にコレクションにあるリンクオブジェクトと同一( ''==='' )な場合、リンクは存在します。
      *      *
      * @param LinkInterface $link      * @param LinkInterface $link
-       The link to remove. 
        削除するリンク。        削除するリンク。
      * @return static      * @return static
psr/psr13.1595200705.txt.gz · 最終更新: 2020/07/20 08:18 by y2sunlight