Exemple #1
0
 /**
  * @param $baseDir must end with a directory separator (slash or backslash)
  * @param $skipNames names (not paths) of files and directories to skip, e.g. '.svn'. 
  * If not given, all files and directories will be included.
  * @param $paths array of strings, paths of files to use, relative to base dir,
  * using forward slashes. If not given, all files and directories will be included.
  */
 public function __construct($baseDir, $skipNames = null, $paths = null)
 {
     PhpUtil::assertString($baseDir, 'base dir');
     $baseDir = str_replace('\\', '/', realpath($baseDir));
     if (!is_dir($baseDir)) {
         throw new \InvalidArgumentException('base dir must be an existing directory, but is ' . $baseDir);
     }
     // make sure that $baseDir ends with /
     if (!StringUtil::endsWith($baseDir, '/')) {
         $baseDir .= '/';
     }
     if ($skipNames !== null) {
         PhpUtil::assertArray($skipNames, 'skip names');
     } else {
         $skipNames = array();
     }
     if ($paths !== null) {
         PhpUtil::assertArray($paths, 'paths');
     }
     $this->baseDir = $baseDir;
     $this->skipNames = $skipNames;
     $this->paths = $paths;
 }
Exemple #2
0
 private function templateMappingPath()
 {
     if ($this->parsedTitle->nsCode() !== LocalConfiguration::templateMappingNsCode) {
         return false;
     }
     $path = $this->parsedTitle->encoded();
     $suffix = LocalConfiguration::templateMappingSuffix;
     if (!StringUtil::endsWith($path, $suffix)) {
         return false;
     }
     return substr($path, 0, -strlen($suffix));
 }