Esempio n. 1
0
File: Dir.php Progetto: mbcraft/piol
 /**
  * 
  * Checks if this directory is a parent of the provided child.
  * 
  * @param \Mbcraft\Piol\File|\Mbcraft\Piol\Dir $child
  * @return boolean true if the parameter is a direct child of this directory, false otherwise.
  * 
  * @throws IOException if the child is not a valid File or Dir instance.
  * 
  * @api
  */
 public function isParentOf($child)
 {
     if (!$child instanceof __FileSystemElement) {
         throw new IOException("The provided element is not a valid \\Piol\\File or \\Piol\\Dir.");
     }
     $path_p = $this->getFullPath();
     $path_c = $child->getFullPath();
     //for windows dirs
     $parent_path_c = dirname($path_c) . DIRECTORY_SEPARATOR;
     $parent_path_c = str_replace("\\", DS, $parent_path_c);
     return $parent_path_c == $path_p;
 }