Download presentation
Presentation is loading. Please wait.
Published byNorma Greer Modified over 9 years ago
1
РНР. Уровень 4. Проектирование и разработка сложных веб-проектов на РНР 5 Reflection
2
Темы модуля Reflection Лабораторная работа
3
Reflection class Reflection interface Reflector class ReflectionFunction implements Reflector class ReflectionParameter implements Reflector class ReflectionMethod extends ReflectionFunction class ReflectionClass implements Reflector class ReflectionObject extends ReflectionClass class ReflectionProperty implements Reflector class ReflectionExtension implements Reflector
4
Class Reflection и Interface Reflector Class Reflection Reflection { public static void export ( Reflector $reflector [, string $return = false ] ) public static array getModifierNames ( int $modifiers ) } Interface Reflector Reflector { abstract public static string export ( void ) abstract public string __toString ( void ) }
5
ReflectionFunction ReflectionFunction extends ReflectionFunctionAbstract implements Reflector Свойства public $name ; Методы __construct ( string $name ) public static string export ( string $name [, string $return ] ) public mixed invoke ([ string $args ] ) public string __toString ( void )
6
ReflectionFunction: наследованые методы final private void __clone ( void ) public string getDocComment ( void ) public string getFileName ( void ) public string getName ( void ) public int getNumberOfParameters ( void ) public int getNumberOfRequiredParameters ( void ) public array getParameters ( void ) public array getStaticVariables ( void ) public bool isInternal ( void ) public bool isUserDefined ( void ) public bool returnsReference ( void ) abstract public void __toString ( void )
7
ReflectionParameter ReflectionParameter implements Reflector Свойства public $name ; Методы public bool allowsNull ( void ) public ReflectionFunction getDeclaringFunction ( void ) public mixed getDefaultValue ( void ) public string getName ( void ) public int getPosition ( void ) public bool isArray ( void ) public bool isDefaultValueAvailable ( void ) public bool isOptional ( void ) public bool isPassedByReference ( void ) public string __toString ( void )
8
ReflectionMethod ReflectionMethod extends ReflectionFunctionAbstract implements Reflector Константы const integer IS_STATIC = 1; const integer IS_PUBLIC = 256 ; const integer IS_PROTECTED = 512 ; const integer IS_PRIVATE = 1024 ; const integer IS_ABSTRACT = 2 ; const integer IS_FINAL = 4 ; Свойства public $name; public $class;
9
ReflectionMethod: методы public ReflectionClass getDeclaringClass ( void ) public int getModifiers ( void ) public mixed invoke ( object $object, string $args ) public bool isAbstract ( void ) public bool isConstructor ( void ) public bool isDestructor ( void ) public bool isFinal ( void ) public bool isPrivate ( void ) public bool isProtected ( void ) public bool isPublic ( void ) public bool isStatic ( void )
10
ReflectionClass ReflectionClass implements Reflector Константы const integer IS_FINAL = 64; Свойства public $name; Методы final private void __clone ( void ) __construct ( string $argument ) public static string export ( mixed $argument [, bool $return = false ] ) public mixed getConstant ( string $name ) public array getConstants ( void )
11
ReflectionClass: методы public ReflectionExtension getExtension ( void ) public string getExtensionName ( void ) public array getInterfaces ( void ) public array getMethods ([ string $filter ] ) public int getModifiers ( void ) public string getName ( void ) public object getParentClass ( void ) public array getProperties ([ int $filter ] ) public array getStaticProperties ( void ) public mixed getStaticPropertyValue ( string $name [, string $default ] ) public bool hasConstant ( string $name ) public bool hasMethod ( string $name ) public bool hasProperty ( string $name ) public bool implementsInterface ( string $interface ) public bool isAbstract ( void ) public bool isFinal ( void )
12
ReflectionObject ReflectionObject extends ReflectionClass implements Reflector Константы const integer IS_FINAL = 64; Свойства Методы __construct ( object $argument ) public static string export ( string $argument [, bool $return ] ) Наследованые методы
13
ReflectionProperty ReflectionProperty implements Reflector Константы const integer IS_STATIC = 1; const integer IS_PUBLIC = 256; const integer IS_PROTECTED = 512; const integer IS_PRIVATE = 1024; Свойства public $name; public $class;
14
ReflectionProperty: методы final private void __clone ( void ) __construct ( mixed $class, string $name ) public static string export ( mixed $class, string $name [, bool $return ] ) public ReflectionClass getDeclaringClass ( void ) public string getDocComment ( void ) public int getModifiers ( void ) public string getName ( void ) public mixed getValue ([ string $object ] ) public bool isDefault ( void ) public bool isPrivate ( void ) public bool isProtected ( void ) public bool isPublic ( void ) public bool isStatic ( void ) public void setAccessible ( bool $accessible ) public void setValue ( object $object, mixed $value ) public string __toString ( void )
15
ReflectionExtension ReflectionExtension implements Reflector Свойства public $name ; Методы public static string export ( string $name [, string $return = false ] ) public array getClasses ( void ) public array getClassNames ( void ) public array getConstants ( void ) public array getDependencies ( void ) public array getFunctions ( void ) public array getINIEntries ( void ) public string getName ( void ) public string getVersion ( void ) public string info ( void ) public string __toString ( void )
16
Лабораторная работа Файл reflection\index.php 1 1 Ознакомьтесь с ВВОДНЫМИ ДАННЫМИ 2 2 Уясните ЗАДАНИЕ 3 3 Использование Reflection Выполните задания 1-3 4 4
17
Выводы Reflection
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.