« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 10 of about 59 for Reflection (0.001 sec.)
Reflection::getModifierNames — 修飾子の名前を取得する | PHP 8.3 12182
Reflection::getModifierNames (PHP 5, PHP 7, PHP 8) Reflection::getModifierNames — 修飾子の名前を取得する 説明 public static function Reflection::getModifierNames ( int $modifiers ): array 修飾子の名前を取得します。 パラメータ modifiers 取得 ... する主食師のビットフィールド 戻り値 修飾子の名前の配列を返します。 例 例1 Reflection::getModifierNames() の例 <?php class Testing { final public static function foo () { return; } public function bar () { re ... turn; } } $foo = new ReflectionMethod ( 'Testing' , 'foo' ); echo "Modifiers for method foo():\n" ; echo $foo -> getModifiers () . "\n" ; echo implode ( ' ... ' , Reflection :: getModifierNames ( $foo -> getModifiers ())) . "\n" ; $bar = new ReflectionMethod ( 'Testing' , 'bar' ); echo "Modifier ...
https://man.mtool.work/php/8.3/reflection.getmodifiernames.html
Reflection クラス | PHP 8.3 11613
Reflection クラス (PHP 5, PHP 7, PHP 8) はじめに リフレクションクラスです。 クラス概要 class Reflection { /* メソッド */ public static function export ( Reflector $reflector , bool $return = false ): string public static function getModifie ... rNames ( int $modifiers ): array } 目次 Reflection::export — エクスポートする Reflection::getModifierNames — 修飾子の名前を取得する 他のマニュアルの関連ページ Docker docker ...
https://man.mtool.work/php/8.3/class.reflection.html
拡張 | PHP 8.3 11511
拡張 組み込みクラスの特別なバージョンを作成したい場合 (例えば、エクスポートする際に色づけしたHTMLを作成したり、 メソッドの代わりに簡単にアクセスできるメンバー変数を作成したり、 補助的なメソッドを作成したり) は、クラスを拡張してみましょう。 ... 例1 組み込みクラスを拡張する <?php /** * 独自の Reflection_Method クラス */ class My_Reflection_Method extends ReflectionMethod { public $visibility = array(); public function __con ... struct ( $o , $m ) { parent :: __construct ( $o , $m ); $this -> visibility = Reflection :: getModifierNames ( $this -> getModifiers ()); } } /** * デモクラス #1 * */ class T { protected function x () {} } /** * ... デモクラス #2 * */ class U extends T { function x () {} } // 情報を表示します var_dump (new My_Reflection_Method ( 'U' , 'x' )); ?> 上の例の出力は、 たとえば以下のようになります。 object(My_Reflection_Method)#1 (3) { ["visibilit ...
https://man.mtool.work/php/8.3/reflection.extending.html
ReflectionParameter::getAttributes — アトリビュートを取得する | PHP 8.3 10358
ReflectionParameter::getAttributes (PHP 8) ReflectionParameter::getAttributes — アトリビュートを取得する 説明 public function ReflectionParameter::getAttributes ( ? string $name = null , int $flags = 0 ): array この引数上で宣言されている全て ... のアトリビュートを、 ReflectionAttribute の配列として返します。 パラメータ name 指定したクラス名にマッチするアトリビュートの、 ReflectionAttribute のみを含 ... グ。 デフォルトは 0 です。 この場合、アトリビュートのクラス名が name であるものだけを返します。 他の利用可能なオプションは、 ReflectionAttribute::IS_INSTANCEOF です。 この場合、フィルタリングに instanceof を使います。 戻り値 アトリビュートの配列を、 Reflecti ... [ Attribute ] class Fruit { } #[ Attribute ] class Red { } function fruitBasket ( #[ Fruit ] #[ Red ] string $apple ) { } $reflection = new ReflectionFunction ( 'fruitBasket' ); $parameter = $reflection -> getParameters ()[ 0 ]; $attributes = $parameter -> ...
https://man.mtool.work/php/8.3/reflectionparameter.getattributes.html
ReflectionClass::getConstant — 定義されている定数を取得する | PHP 8.3 10168
ReflectionClass::getConstant (PHP 5, PHP 7, PHP 8) ReflectionClass::getConstant — 定義されている定数を取得する 説明 public function ReflectionClass::getConstant ( string $name ): mixed 定義されている定数を取得します。 パラメータ name 取得す ... します。 そのクラスに定数が見つからなかった場合は、 false を返します。 変更履歴 バージョン 説明 8.5.0 存在しない定数に対して ReflectionClass::getConstant() を呼び出すのは非推奨となりました。 例 例1 ReflectionClass::getConstant() の使い方 <?php class Example ... { const C1 = false ; const C2 = 'I am a constant' ; } $reflection = new ReflectionClass ( 'Example' ); var_dump ( $reflection -> getConstant ( 'C1' )); var_dump ( $reflection -> getConstan ... t ( 'C2' )); var_dump ( $reflection -> getConstant ( 'C3' )); ?> 上の例の出力は以下となります。 bool(false) string(15) "I am a constant" bool(false) 参考 Refl ...
https://man.mtool.work/php/8.3/reflectionclass.getconstant.html
Reflection::export — エクスポートする | PHP 8.3 10066
Reflection::export (PHP 5, PHP 7) Reflection::export — エクスポートする 警告 この関数は PHP 7.4.0 で 非推奨 になり、PHP 8.0.0 で 削除 されました。この関数に頼らないことを強く推奨します。 説明 public static function Reflection::export ( Refl ... です。 戻り値 return パラメータを true に設定すると、エクスポートを文字列で返します。それ以外の場合は null を返します。 参考 Reflection::getModifierNames() - 修飾子の名前を取得する 他のマニュアルの関連ページ Python compression Linux JM exportfs(8) Vim usr_46 ...
https://man.mtool.work/php/8.3/reflection.export.html
基本的な使用法 | PHP 8.3 9001
基本的な使用法 Imagick は、PHP による画像の操作を、 とても簡単なオブジェクト指向インターフェイスで行います。 画像のサムネイルを作成する簡単な例をごらんください。 例1 Imagick によるサムネイルの作成 <?php header ( 'Content-type: image/jpeg' ) ... * 画像の枠線を作成します */ $im -> borderImage (new ImagickPixel ( "white" ), 5 , 5 ); /* 画像をコピーし、反転させます */ $reflection = $im -> clone (); $reflection -> flipImage (); /* 階調を作成します。これを後で鏡像にかぶせます */ $gradient = new Imagick ... (); /* 階調は、画像と枠線をあわせたものより大きくなければなりません */ $gradient -> newPseudoImage ( $reflection -> getImageWidth () + 10 , $reflection -> getImageHeight () + 10 , "gradient:transparent-black" ); /* 階調を合成します */ ... $reflection -> compositeImage ( $gradient , imagick :: COMPOSITE_OVER , 0 , 0 ); /* 不透明度を設定します。ImageMagick 6.2.9 以降が必要 ...
https://man.mtool.work/php/8.3/imagick.examples-1.html
ReflectionMethod::getModifiers — メソッドの修飾子を取得する | PHP 8.3 8812
ReflectionMethod::getModifiers (PHP 5, PHP 7, PHP 8) ReflectionMethod::getModifiers — メソッドの修飾子を取得する 説明 public function ReflectionMethod::getModifiers (): int このメソッドのアクセス修飾子のビットフィールドを返します。 パラメー ... 値を返します。修飾子の一覧は以下のとおりです。 これらの修飾子の実際の意味については 定義済みの定数 に説明があります。 例 例1 ReflectionMethod::getModifiers() の例 <?php class Testing { final public static function foo () { return; } public function bar () { ... return; } } $foo = new ReflectionMethod ( 'Testing' , 'foo' ); echo "Modifiers for method foo():\n" ; echo $foo -> getModifiers () . "\n" ; echo implode ( ' ... ' , Reflection :: getModifierNames ( $foo -> getModifiers ())) . "\n" ; $bar = new ReflectionMethod ( 'Testing' , 'bar' ); echo "Modifier ...
https://man.mtool.work/php/8.3/reflectionmethod.getmodifiers.html
リフレクションAPI を使ってアトリビュートを読み取る | PHP 8.3 8724
リフレクションAPI を使ってアトリビュートを読み取る クラス、メソッド、関数、パラメータ、プロパティ、クラス定数からアトリビュートにアクセスするには、 リフレクション API が提供する getAttributes() メソッドを使用します。 このメソッドは Reflection ... いアトリビュートクラス、型指定ミス、値の不足など、 エラー処理をより詳細に制御できます。 アトリビュートクラスのオブジェクトは ReflectionAttribute::newInstance() を呼び出した後にのみインスタンス化され、その時点で引数の検証が行われます。 例1 リフレクションAPIを ... ( $value ) { $this -> value = $value ; } } #[ MyAttribute ( value : 1234 )] class Thing { } function dumpAttributeData ( $reflection ) { $attributes = $reflection -> getAttributes (); foreach ( $attributes as $attribute ) { var_dump ( $attribute -> getNam ... e ()); var_dump ( $attribute -> getArguments ()); var_dump ( $attribute -> newInstance ()); } } dumpAttributeData (new ReflectionClass ( Thing ::class)); 上の例の出力は以下となります。 string(11) "MyAttribute" array(1) { ["value"]=> int(1234) } object( ...
https://man.mtool.work/php/8.3/language.attributes.reflection.html
ReflectionExtension::__construct — ReflectionExtension を作成する | PHP 8.3 8053
ReflectionExtension::__construct (PHP 5, PHP 7, PHP 8) ReflectionExtension::__construct — ReflectionExtension を作成する 説明 public function ReflectionExtension::__construct ( string $name ) ReflectionExtension オブジェクトを作成します。 パ ... ラメータ name 拡張モジュールの名前。 エラー / 例外 リフレクションする拡張機能が存在しない場合、 ReflectionException がスローされます。 例 例1 ReflectionExtension の例 <?php $ext = new ReflectionExtension ( 'Reflection' ); printf ... (version: %s)' , $ext -> getName (), $ext -> getVersion ()); ?> 上の例の出力は、 たとえば以下のようになります。 Extension: Reflection (version: 8.3.17) 参考 ReflectionExtension::info() - 拡張モジュールの情報を表示する コンストラクタ 他のマニュアルの関連ペー ...
https://man.mtool.work/php/8.3/reflectionextension.construct.html
PREV 1 2 3 4 5 6 NEXT