Beispiel #1
0
 function prependExtensions($extensions)
 {
     foreach ((array) $extensions as $ext) {
         $this->extensions->unshift(Path::normalizeExtension($ext));
     }
     return $this;
 }
Beispiel #2
0
 protected function getExtensions()
 {
     if (null === $this->extensions) {
         $basename = $this->getBasename();
         # Avoid treating name of a dotfile as extension by
         # ignoring dots at the first offset in the string
         if (!$basename or false === ($pos = strpos($basename, '.', 1))) {
             return array();
         }
         $extensions = explode('.', substr($basename, $pos + 1));
         $this->extensions = array_map(function ($ext) {
             return Path::normalizeExtension($ext);
         }, $extensions);
     }
     return $this->extensions;
 }
Beispiel #3
0
 protected function getExtension()
 {
     return Path::normalizeExtension(pathinfo($this->path, PATHINFO_EXTENSION));
 }
Beispiel #4
0
 /**
  * Returns the content type for the extension, .e.g. "application/javascript"
  * for ".js".
  *
  * @param string $extension
  * @return string
  */
 function contentType($extension)
 {
     return @$this->contentTypes[FileUtils\Path::normalizeExtension($extension)];
 }
Beispiel #5
0
 static function normalizeExtension($extension)
 {
     return Path::normalizeExtension($extension);
 }