示例#1
0
 protected function reflect($class = null)
 {
     if (!is_null($class) && \Kinesis\Type::exists($class)) {
         $this->_class = new \ReflectionClass($class);
     }
     if ($this->_class instanceof \ReflectionClass) {
         return $this->_class;
     }
     return false;
 }
示例#2
0
 protected function getDefaultCache()
 {
     $cacheClass = $this->Parameters['CacheClass'];
     $cacheParams = $this->Parameters['CacheParameters'];
     if (!is_array($cacheParams)) {
         $cacheParams = array();
     }
     if (is_string($cacheClass) && \Kinesis\Type::exists($cacheClass)) {
         return new $cacheClass($cacheParams);
     }
     return null;
 }
示例#3
0
 /**
  * resolves valid class names and instantiates an object
  * @param array $arguments Accepts a \Kinesis\Parameter or string
  *        and an array of arguments to pass into constructor
  * @return mixed new instance of class 
  */
 protected function execute()
 {
     $arguments = func_get_arg(0);
     $param = $arguments[0];
     if (is_string($param)) {
         if ($this->isMapped()) {
             $className = $this->map($param);
         } else {
             $className = $param;
         }
     } elseif ($param instanceof \Kinesis\Parameter) {
         $className = $this->getClassName($param);
     }
     $class = \Kinesis\Type::reflect($className);
     return $class->newInstanceArgs($arguments[1]);
 }
示例#4
0
 protected function getDefaultDelegate()
 {
     $streamHandler = $this->Parameters['StreamHandler'];
     $streamCallback = $this->Parameters['StreamCallback'];
     if (\Kinesis\Type::exists($streamHandler)) {
         $handler = new $streamHandler($this->Stream);
     }
     $handlers = $this->Parameters['HandlerChain'];
     if (!is_array($handlers)) {
         $handlers = array($handlers);
     }
     if (count($handlers) > 0) {
         foreach ($handlers as $wrapClass) {
             if (\Kinesis\Type::exists($wrapClass)) {
                 $handler = new $wrapClass($handler);
             }
         }
     }
     return new \Core\Delegate($handler, $streamCallback);
 }