loadIfExists() 공개 정적인 메소드

Loads a file using require or require_once if the $loadOnce flag is set to true.
public static loadIfExists ( string $path, boolean $loadOnce = true ) : boolean
$path string
$loadOnce boolean
리턴 boolean
예제 #1
0
파일: View.php 프로젝트: letsdrink/ouzo
 private function _loadHelpers()
 {
     $viewHelperPath = Path::join('Helper', 'ViewHelper.php');
     $appHelperPath = Path::join(ROOT_PATH, ApplicationPaths::getHelperPath(), 'ApplicationHelper.php');
     $formHelperPath = Path::join('Helper', 'FormHelper.php');
     $urlHelperPath = Path::join(ROOT_PATH, ApplicationPaths::getHelperPath(), 'UrlHelper.php');
     $this->_requireOnce($viewHelperPath);
     Files::loadIfExists($appHelperPath);
     $this->_requireOnce($formHelperPath);
     Files::loadIfExists($urlHelperPath);
 }
예제 #2
0
 /**
  * @return void
  */
 private function includeRoutes()
 {
     $routesPath = Path::join(ROOT_PATH, 'config', 'routes.php');
     Files::loadIfExists($routesPath);
 }
예제 #3
0
 private function _loadViewHelper()
 {
     $helperPath = Path::join(ROOT_PATH, ApplicationPaths::getViewPath(), $this->_viewName . '.helper.php');
     Files::loadIfExists($helperPath);
 }
예제 #4
0
<?php

use Ouzo\Utilities\Clock;
use Ouzo\Utilities\Files;
use Ouzo\Utilities\Path;
error_reporting(E_ALL);
putenv('environment=test');
define('ROOT_PATH', realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
require 'vendor/autoload.php';
Files::loadIfExists(Path::join(ROOT_PATH, 'config', 'error_codes.php'));
Files::loadIfExists(Path::join(ROOT_PATH, 'config', 'routes.php'));
Clock::freeze();