original_string: private static function instantiate($class, array $configs)
      {
          $reflection = new ReflectionClass($class);
          $constructor = $reflection->getConstructor();
          $arguments = array();
  
          foreach ($constructor->getParameters() as $param) {
              $name = $param->getName();
              if (isset($configs[$name])) {
                  $arguments[] = $configs[$name];
                  continue;
              }
  
              $arguments[] = null;
          }
  
          $broadcaster = $reflection->newInstanceArgs($arguments);
  
          if (!$broadcaster instanceof BroadcasterInterface) {
              throw new RuntimeException(sprintf(
                  'Broadcaster "%s" should implement Borobudur\Broadcasting\Broadcaster\BroadcasterInterface',
                  $class
              ));
          }
  
          return $broadcaster;
      }
code: private static function instantiate($class, array $configs)
      {
          $reflection = new ReflectionClass($class);
          $constructor = $reflection->getConstructor();
          $arguments = array();
  
          foreach ($constructor->getParameters() as $param) {
              $name = $param->getName();
              if (isset($configs[$name])) {
                  $arguments[] = $configs[$name];
                  continue;
              }
  
              $arguments[] = null;
          }
  
          $broadcaster = $reflection->newInstanceArgs($arguments);
  
          if (!$broadcaster instanceof BroadcasterInterface) {
              throw new RuntimeException(sprintf(
                  'Broadcaster "%s" should implement Borobudur\Broadcasting\Broadcaster\BroadcasterInterface',
                  $class
              ));
          }
  
          return $broadcaster;
      }
code_tokens: private static function instantiate ( $ class , array $ configs ) { $ reflection = new ReflectionClass ( $ class ) ; $ constructor = $ reflection -> getConstructor ( ) ; $ arguments = array ( ) ; foreach ( $ constructor -> getParameters ( ) as $ param ) { $ name = $ param -> getName ( ) ; if ( isset ( $ configs [ $ name ] ) ) { $ arguments [ ] = $ configs [ $ name ] ; continue ; } $ arguments [ ] = null ; } $ broadcaster = $ reflection -> newInstanceArgs ( $ arguments ) ; if ( ! $ broadcaster instanceof BroadcasterInterface ) { throw new RuntimeException ( sprintf ( 'Broadcaster "%s" should implement Borobudur\Broadcasting\Broadcaster\BroadcasterInterface' , $ class ) ) ; } return $ broadcaster ; }
docstring: Instantiate broadcaster.
  
  @param string $class
  @param array  $configs
  
  @return BroadcasterInterface
docstring_tokens: Instantiate broadcaster .