From 193862f0fa14b786dd3a0b70113da21d6daa7dd6 Mon Sep 17 00:00:00 2001 From: pbarroca <pbarroca@afi-sa.fr> Date: Tue, 3 Nov 2015 09:35:17 +0100 Subject: [PATCH] rel #32112 : source format --- cosmogramme/php/classes/classe_cosmopaths.php | 112 +++++++++--------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/cosmogramme/php/classes/classe_cosmopaths.php b/cosmogramme/php/classes/classe_cosmopaths.php index 3f5cf42a0c0..16033bce414 100644 --- a/cosmogramme/php/classes/classe_cosmopaths.php +++ b/cosmogramme/php/classes/classe_cosmopaths.php @@ -20,7 +20,7 @@ */ class CosmoPaths { - protected + protected $_root_dir_name, $_filesystem; @@ -30,84 +30,84 @@ class CosmoPaths { } - public function getBasePath() { - $parts = array_filter(explode('/', $this->getFilePath())); - while ((count($parts)>0) && (end($parts) !== $this->_root_dir_name)) - array_pop($parts); - array_pop($parts); - return ($this->isWindowsPath() ? '' : '/') . implode('/', $parts) . '/'; - } + public function getBasePath() { + $parts = array_filter(explode('/', $this->getFilePath())); + while ((count($parts)>0) && (end($parts) !== $this->_root_dir_name)) + array_pop($parts); + array_pop($parts); + return ($this->isWindowsPath() ? '' : '/') . implode('/', $parts) . '/'; + } - public function isWindowsPath() { - return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; - } + public function isWindowsPath() { + return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; + } - public function setFileSystem($filesystem) { - $this->_filesystem = $filesystem; - } + public function setFileSystem($filesystem) { + $this->_filesystem = $filesystem; + } - public function getFilesystem() { - require_once(realpath(dirname(__FILE__)).'/../../../library/Class/Testing/FileSystem.php'); - return null == $this->_filesystem - ? new Class_Testing_FileSystem() - : $this->_filesystem; - } + public function getFilesystem() { + require_once(realpath(dirname(__FILE__)).'/../../../library/Class/Testing/FileSystem.php'); + return null == $this->_filesystem + ? new Class_Testing_FileSystem() + : $this->_filesystem; + } - public function getConfigPath() { - return $this->getBasePath() . $this->_root_dir_name . '/config.php'; - } + public function getConfigPath() { + return $this->getBasePath() . $this->_root_dir_name . '/config.php'; + } - public function getBokehConfigPath() { - return $this->getBasePath() . 'config.ini'; - } + public function getBokehConfigPath() { + return $this->getBasePath() . 'config.ini'; + } - public function getBaseUrl() { - if (!isset($_SERVER['SCRIPT_NAME'])) - return '/' . $this->getSite(); + public function getBaseUrl() { + if (!isset($_SERVER['SCRIPT_NAME'])) + return '/' . $this->getSite(); - $parts = array_filter(explode('/', $_SERVER['SCRIPT_NAME'])); - while ((count($parts)>0) && (end($parts) !== $this->_root_dir_name)) - array_pop($parts); - array_pop($parts); - return $parts - ? '/' . implode('/', $parts) - : ''; - } + $parts = array_filter(explode('/', $_SERVER['SCRIPT_NAME'])); + while ((count($parts)>0) && (end($parts) !== $this->_root_dir_name)) + array_pop($parts); + array_pop($parts); + return $parts + ? '/' . implode('/', $parts) + : ''; + } - public function getCosmoBaseUrl() { - return $this->getBaseUrl() . '/' . $this->_root_dir_name . '/'; - } + public function getCosmoBaseUrl() { + return $this->getBaseUrl() . '/' . $this->_root_dir_name . '/'; + } - public function getUserfilesPath() { - return $this->getBasePath() . 'userfiles'; - } + public function getUserfilesPath() { + return $this->getBasePath() . 'userfiles'; + } - public function getSite() { - $parts = array_filter(explode('/', $this->getBasePath())); - return array_pop($parts); - } + public function getSite() { + $parts = array_filter(explode('/', $this->getBasePath())); + return array_pop($parts); + } - protected function getFilePath() { - if (isset($_SERVER['SCRIPT_FILENAME']) - && false !== strpos($_SERVER['SCRIPT_FILENAME'], $this->_root_dir_name)) - return $_SERVER['SCRIPT_FILENAME']; + protected function getFilePath() { + if (isset($_SERVER['SCRIPT_FILENAME']) + && false !== strpos($_SERVER['SCRIPT_FILENAME'], $this->_root_dir_name)) + return $_SERVER['SCRIPT_FILENAME']; - $current_path = $this->getFileSystem()->getcwd(); - if (false !== strpos($current_path, $this->_root_dir_name)) - return $current_path; + $current_path = $this->getFileSystem()->getcwd(); + if (false !== strpos($current_path, $this->_root_dir_name)) + return $current_path; - return realpath(dirname(__FILE__)); - } + return realpath(dirname(__FILE__)); + } } ?> \ No newline at end of file -- GitLab