Hoa central
RealdomClass.php
Go to the documentation of this file.
1 <?php
2 
37 namespace Hoa\Realdom;
38 
39 use Hoa\Math;
40 use Hoa\Praspel;
41 
50 class RealdomClass extends Realdom
51 {
57  const NAME = 'class';
58 
64  protected $_arguments = …;
65 
71  protected $_object = null;
72 
73 
74 
80  protected function construct()
81  {
82  if (!isset($this[0])) {
83  throw new Exception\MissingArgument('Argument missing.', 0);
84  }
85 
86  return;
87  }
88 
95  protected function _predicate($q)
96  {
97  return
98  is_object($q) &&
99  is_a($q, $this[0]->getConstantValue());
100  }
101 
108  protected function _sample(Math\Sampler $sampler)
109  {
110  $className = $this[0]->getConstantValue();
111  $handler = new Praspel\Preambler\Handler(
112  xcallable($className, '__construct')
113  );
114  $preambler = new Praspel\Preambler\EncapsulationShunter();
115  $preambler($handler);
116  $callback = $handler->__getCallable()->getValidCallback();
117 
118  return $callback[0];
119  }
120 }
_sample(Math\Sampler $sampler)