예제 #1
0
 /**
  * Method that checks if the current instance implementing Serializable interface
  */
 public function testSerializable()
 {
     if ($this instanceof \Serializable) {
         echo get_class($this), ' implements `Serializable` interface now!', PHP_EOL;
         $reflection = new \ReflectionObject($this);
         var_dump($reflection->getInterfaceNames(), $reflection->getTraitNames());
     } else {
         echo get_class($this), ' does not implement `Serializable` interface', PHP_EOL;
     }
 }
예제 #2
0
 /**
  * Method that checks if the current instance implementing Serializable interface
  */
 public function testSerializable()
 {
     if ($this instanceof \Serializable) {
         echo get_class($this), ' implements `Serializable` interface now!', PHP_EOL;
         $reflection = new \ReflectionObject($this);
         echo "List of interfaces:", PHP_EOL;
         foreach ($reflection->getInterfaceNames() as $interfaceName) {
             echo '-> ', $interfaceName, PHP_EOL;
         }
         echo "List of traits:", PHP_EOL;
         foreach ($reflection->getTraitNames() as $traitName) {
             echo '-> ', $traitName, PHP_EOL;
         }
     } else {
         echo get_class($this), ' does not implement `Serializable` interface', PHP_EOL;
     }
 }
예제 #3
0
파일: ump.php 프로젝트: aronduby/dump
 private function _reflectionTraits(\ReflectionObject $reflection)
 {
     $traits = $reflection->getTraitNames();
     if (count($traits)) {
         $name = '<span class="d-information" title="Traits this object uses"></span>&nbsp;';
         $name .= '<span class="d-obj-info">Traits</span>';
         $traits = implode(', ', $traits);
         $this->render($traits, $name);
     }
 }