当前位置: 首页>>代码示例>>PHP>>正文


PHP Logging::checkRecordingFolderOnWritable方法代码示例

本文整理汇总了PHP中Logging::checkRecordingFolderOnWritable方法的典型用法代码示例。如果您正苦于以下问题:PHP Logging::checkRecordingFolderOnWritable方法的具体用法?PHP Logging::checkRecordingFolderOnWritable怎么用?PHP Logging::checkRecordingFolderOnWritable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Logging的用法示例。


在下文中一共展示了Logging::checkRecordingFolderOnWritable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: startScan

 /**
  * General scanning function
  */
 public function startScan()
 {
     $controllers = array_filter(scandir(WORK_SPACE_FOLDER_PATH . 'controllers'), function ($element) {
         return strstr($element, 'Controller.php', true);
     });
     foreach ($controllers as $controller) {
         require_once WORK_SPACE_FOLDER_PATH . 'controllers' . DS . $controller;
         if (!class_exists(ucfirst($classController = ucfirst(substr($controller, 0, -4))))) {
             crash('The controller "' . $controller . '" does not have necessary class');
         }
         if (!property_exists($classController, 'url')) {
             continue;
         }
         /**
          * Loop across whole actions
          */
         foreach ($classController::$url as $method => $paramsOfAction) {
             $options = array('function' => $method, 'controller' => strtolower(strstr($classController, 'Controller', true)));
             /**
              * Preparing route record
              */
             if (is_array($paramsOfAction)) {
                 if (!isset($paramsOfAction['url']) && !isset($paramsOfAction['patternUrl'])) {
                     crash('The route "' . $method . '" of controller\'s "' . $classController . '" does not have element "url" or "patternUrl"');
                 }
                 $exactlyUrl = isset($paramsOfAction['url']) ? 'url' : 'patternUrl';
                 if (isset($this->collectingOfUrl[$paramsOfAction[$exactlyUrl]])) {
                     crash('Double url or patternUrl "' . $exactlyUrl . '" in controller "' . $classController . '"');
                 }
                 if (isset($paramsOfAction['controller']) || isset($paramsOfAction['function'])) {
                     crash('The route array has invalid key of element: "function", "controller"');
                 }
                 $fUrl = $paramsOfAction[$exactlyUrl];
                 unset($paramsOfAction[$exactlyUrl]);
                 $this->collectingOfUrl[$fUrl] = array_merge($paramsOfAction, $options);
             } else {
                 if (isset($this->collectingOfUrl[$paramsOfAction])) {
                     crash('Double route url "' . $paramsOfAction . '", controller "' . $classController);
                 }
                 $this->collectingOfUrl[$paramsOfAction] = $options;
             }
         }
     }
     Logging::checkRecordingFolderOnWritable();
     $convertedArrayUrlToString = $this->convertingArrayUrlToString();
     /**
      * First saving
      */
     if (!is_file(ROUTER_CACHE_FILE)) {
         $this->saveRouteUrlInFile($convertedArrayUrlToString, true);
     } else {
         /**
          * Compare and if there is need than save
          */
         if (($routeFileContent = file_get_contents(ROUTER_CACHE_FILE)) === false) {
             crash('File "route" can not open to read');
         }
         try {
             if (($functionContext = mb_strstr($routeFileContent, 'getRoute(')) === false) {
                 throw new Exception();
             }
             eval('function ' . str_replace('getRoute', 'getRouteTemp', $functionContext));
             if (!function_exists('getRouteTemp') || getRouteTemp() !== $this->collectingOfUrl) {
                 throw new Exception();
             }
         } catch (Exception $e) {
             $this->saveRouteUrlInFile($convertedArrayUrlToString);
         }
     }
 }
开发者ID:stan-coder,项目名称:online_store,代码行数:73,代码来源:cache.php


注:本文中的Logging::checkRecordingFolderOnWritable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。