示例#1
0
 /**
  * @param string|Text $key
  * @return string
  */
 private function extractKey($key)
 {
     if ($key instanceof Text) {
         return $key->toString();
     }
     return $key;
 }
示例#2
0
文件: Path.php 项目: phootwork/file
 /**
  * Checks whether both paths point to the same location
  * 
  * @param Path|string $anotherPath
  * @return boolean true if the do, false if they don't
  */
 public function equals($anotherPath)
 {
     $anotherPath = $anotherPath instanceof Path ? $anotherPath : new Path($anotherPath);
     // do something else, when path's are urls
     $regexp = '/^[a-zA-Z]+:\\/\\//';
     $thisUrl = $this->pathname->match($regexp);
     $anotherUrl = $anotherPath->getPathname()->match($regexp);
     if ($thisUrl ^ $anotherUrl) {
         return false;
     } else {
         if ($thisUrl && $anotherUrl) {
             return $this->pathname->equals($anotherPath->getPathname());
         }
     }
     return realpath($this->pathname->toString()) == realpath($anotherPath->toString());
 }