PHPPM\Utils::isWindows PHP Method

isWindows() public static method

public static isWindows ( ) : boolean
return boolean
    public static function isWindows()
    {
        return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
    }

Usage Example

コード例 #1
0
 /**
  *
  * @param string $affix
  * @param bool $removeOld
  * @return string
  */
 protected function getSockFile($affix, $removeOld)
 {
     if (Utils::isWindows()) {
         //we have no unix domain sockets support
         return '127.0.0.1';
     }
     //since all commands set setcwd() we can make sure we are in the current application folder
     if ('/' === substr($this->socketPath, 0, 1)) {
         $run = $this->socketPath;
     } else {
         $run = getcwd() . '/' . $this->socketPath;
     }
     if ('/' !== substr($run, -1)) {
         $run .= '/';
     }
     if (!is_dir($run) && !mkdir($run, 0777, true)) {
         throw new \RuntimeException(sprintf('Could not create %s folder.', $run));
     }
     $sock = $run . $affix . '.sock';
     if ($removeOld && file_exists($sock)) {
         unlink($sock);
     }
     return 'unix://' . $sock;
 }
All Usage Examples Of PHPPM\Utils::isWindows