CakeFest 2024: The Official CakePHP Conference

ReflectionClass::getInterfaces

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getInterfacesインターフェイスを取得する

説明

public ReflectionClass::getInterfaces(): array

インターフェイスを取得します。

パラメータ

この関数にはパラメータはありません。

戻り値

インターフェイスの連想配列を返します。インターフェイス名が連想配列のキー、対応する値が ReflectionClass オブジェクトとなります。

例1 ReflectionClass::getInterfaces() の例

<?php
interface Foo { }

interface
Bar { }

class
Baz implements Foo, Bar { }

$rc1 = new ReflectionClass("Baz");

print_r($rc1->getInterfaces());
?>

上の例の出力は、 たとえば以下のようになります。

Array
(
    [Foo] => ReflectionClass Object
        (
            [name] => Foo
        )

    [Bar] => ReflectionClass Object
        (
            [name] => Bar
        )

)

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top