Ejemplo n.º 1
0
 /**
  * Builds the target paths array.
  * The 'link' ready to be used as asset url
  * and 'full' suitable for file creation.
  *
  * @param  Symfony\Component\Finder\SplFileInfo|string $file
  *         The file object or the filename
  * @param  string $package The package where the asset belongs to
  * @param  string $type    The assets type
  * @return array           The target paths array
  */
 protected function buildTargetPaths($file, $package, $type)
 {
     if ($file instanceof \Symfony\Component\Finder\SplFileInfo) {
         $pathName = $file->getRelativePathname();
     } else {
         $pathName = $file;
     }
     // replace .less extension by .css
     $pathName = str_ireplace('.less', '.css', $pathName);
     $link = '/' . $this->config->get('asset::public_dir') . '/' . $type . '/';
     // add package segment, if any
     if ($package) {
         $link .= $package . '/';
     }
     $link .= $pathName;
     return array('link' => $link, 'full' => public_path() . $link);
 }
 /**
  * Checks to see if the file exists in filesystem.
  *
  * @since    1.0.0
  * @param    Symfony\Component\Finder\SplFileInfo    $file    The file object         
  * @param    League\Flysystem\Filesystem    $filesystem    The filesystem object         
  * @access   public  
  * @return   boolean   Returns true to indicate file exists or false otherwise
  */
 public function file_exists_in_filesystem($file, $filesystem)
 {
     //Checks if the filesystem object is ftp based or not
     if ($this->is_filesystem_ftp($filesystem)) {
         //Check if the filename is found in filesystem
         return $this->filename_in_filesystem($filesystem, $file->getRelativePathname());
     } else {
         //Use filesystem function to check if file exists
         return $filesystem->has($file->getRelativePathname());
     }
 }