Exemplo n.º 1
0
 /**
  * Get all implemented interfaces.
  *
  * @return ReflectionClass[] An associative `array` of interfaces, with keys as interface names and
  * the array values as `ReflectionClass` objects.
  */
 public function getInterfaces()
 {
     $interfaces = array();
     foreach (parent::getInterfaces() as $name => $interface) {
         $interfaces[$name] = new ReflectionClass($interface);
     }
     return $interfaces;
 }
Exemplo n.º 2
0
 /**
  * Test if the `getInterfaces` method returns a list with all implemented interfaces.
  */
 public function testGetInterfaces()
 {
     $className = self::FIXTURE_NS . '\\ClassWithInterfaces';
     $object = new ReflectionObject(new $className());
     $interfaces = $object->getInterfaces();
     $this->assertArrayHasKey(self::FIXTURE_NS . '\\Foo', $interfaces);
     $this->assertArrayHasKey(self::FIXTURE_NS . '\\Bar', $interfaces);
     $this->assertInstanceOf('com\\mohiva\\common\\lang\\ReflectionClass', $interfaces[self::FIXTURE_NS . '\\Foo']);
     $this->assertInstanceOf('com\\mohiva\\common\\lang\\ReflectionClass', $interfaces[self::FIXTURE_NS . '\\Bar']);
 }