You are here

protected function QPTPL::tplObject in QueryPath 6

Same name and namespace in other branches
  1. 7.3 QueryPath/Extension/QPTPL.php \QPTPL::tplObject()
  2. 7.2 QueryPath/Extension/QPTPL.php \QPTPL::tplObject()
2 calls to QPTPL::tplObject()
QPTPL::tpl in QueryPath/Extension/QPTPL.php
QPTPL::tplAll in QueryPath/Extension/QPTPL.php

File

QueryPath/Extension/QPTPL.php, line 43

Class

QPTPL

Code

protected function tplObject($tqp, $object, $options = array()) {
  $ref = new ReflectionObject($object);
  $methods = $ref
    ->getMethods();
  foreach ($methods as $method) {
    if (strpos($method
      ->getName(), 'get') === 0) {
      $cssClass = $this
        ->method2class($method
        ->getName());
      if ($tqp
        ->top()
        ->find($cssClass)
        ->size() > 0) {
        $tqp
          ->append($method
          ->invoke($object));
      }
      else {
        $tqp
          ->end();
      }
    }
  }
  return $tqp;
}