コード例 #1
0
 /**
  * Set default values for a new file or directory
  *
  * @param string        $path   Path of the file
  * @param FileInterface $file
  * @param DirectoryInterface $parent Parent directory of the file
  */
 protected function setFileDefaults($path, FileInterface $file, DirectoryInterface $parent = null)
 {
     $setIdentifier = $this->identifier ? 'set' . ucfirst($this->identifier) : false;
     $name = $this->getBaseName($path);
     if ($setIdentifier) {
         $file->{$setIdentifier}($name);
     }
     $file->setName($name);
     if ($file instanceof HierarchyInterface && $parent && $parent instanceof DirectoryInterface) {
         $file->setParent($parent);
     }
 }