Exemple #1
0
 /**
  * invoke before constructor is called
  * @param IConfigure $pObj
  * @param AOP\AJoinPoint $pJoinPoint
  */
 public static function onBeforeConstructor(&$pObj, AOP\AJoinPoint $pJoinPoint)
 {
     if (!$pObj instanceof \Savant\IConfigure) {
         return;
     }
     if (\method_exists($pObj, 'configure')) {
         $pObj->configure($pObj->confSection);
         return;
     }
     $class = \get_class($pObj);
     try {
         $config = $pObj->config = CConfigure::getClassConfig($class, $pObj->confSection);
     } catch (\Savant\EConfigure $e) {
         return;
     }
     foreach ($config->member as $memberElement) {
         try {
             $propObj = new \ReflectionProperty($class, \strtoupper($memberElement->attributes()->name));
             $propObj->setValue($pObj, $memberElement);
         } catch (ReflectionException $e) {
             return;
         }
     }
 }