/**
  * hangi class'ın veya php dosyasının controller olarak kullanılacağını belirler
  * 
  * @param string $class
  * @return void
  */
 protected static function init()
 {
     $pageResult = PageController::getPath();
     if ($pageResult['kod'] == 0) {
         $class = $pageResult['runPHPFile'];
         $checkApi = self::checApi();
         if ($checkApi) {
             $class = preg_replace('/controller/', 'mobileController', $class);
         }
         $VALIDATE =& Validate::getInstance();
         #eski sistem controller php dosyasıysa include et
         if ($VALIDATE->checkFileExtension($class, '.php')) {
             //echo $class;
             include $class;
         } else {
             $methodName = '';
             if ($checkApi) {
                 $arr = $_REQUEST;
                 # buradaki p mobil api proxy dosyasının kullandığı page değişkenine tekabul etmekte
                 unset($arr['p']);
             } else {
                 $arr = $_GET;
             }
             foreach ($arr as $key => $value) {
                 if ($key != 'page') {
                     $methodName = $value;
                     break;
                 }
             }
             //echo $class;
             $OBJECT = new $class();
             if ($methodName == '') {
                 echo $OBJECT->index();
             } else {
                 $method = self::getMethodName($arr, $VALIDATE, $methodName);
                 if (method_exists($OBJECT, $method)) {
                     $reflection = new \ReflectionMethod($OBJECT, $method);
                     if ($reflection->isPublic()) {
                         echo $OBJECT->{$method}();
                     } else {
                         echo $OBJECT->index();
                         ErrorLog::errorHandler(E_ERROR, $class . ' classının ' . $method . ' adında ki methodu public değil!', $class, __LINE__, '', false);
                     }
                 } else {
                     echo $OBJECT->index();
                 }
             }
         }
     } else {
         require 'controller/404.php';
     }
 }