-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb9f7e0
commit 1f39034
Showing
6 changed files
with
294 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php declare(strict_types=1); | ||
/** | ||
* System | ||
* | ||
* Usefull class for manipulate system | ||
* | ||
* PHP version 8.1.2 | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2024 Kévin Zarshenas | ||
*/ | ||
namespace CrazyPHP\Library\System; | ||
|
||
/** | ||
* Dependances | ||
*/ | ||
use CrazyPHP\Exception\CrazyException; | ||
|
||
/** | ||
* Terminal | ||
* | ||
* Methods for check terminal | ||
* | ||
* @package kzarshenas/crazyphp | ||
* @author kekefreedog <[email protected]> | ||
* @copyright 2022-2024 Kévin Zarshenas | ||
*/ | ||
class Terminal { | ||
|
||
/** Public Static Methods | Windows | ||
****************************************************** | ||
*/ | ||
|
||
/** | ||
* Is Windows Power Shell | ||
* | ||
* Checks if the script is running in Windows PowerShell. | ||
* | ||
* @return bool Returns true if the script is running in PowerShell, false otherwise. | ||
*/ | ||
public static function isWindowsPowerShell():bool { | ||
|
||
# Check for a common PowerShell environment variable | ||
return getenv('PSModulePath') !== false; | ||
|
||
} | ||
|
||
/** | ||
* Is Windows Command Prompt | ||
* | ||
* Checks if the script is running in Windows Command Prompt. | ||
* | ||
* @return bool Returns true if the script is running in Command Prompt, false otherwise. | ||
*/ | ||
public static function isWindowsCommandPrompt() { | ||
|
||
# Check for the ComSpec environment variable typical in CMD that includes 'cmd.exe' | ||
$comSpec = getenv('ComSpec'); | ||
|
||
# Return check | ||
return $comSpec !== false && strpos(strtolower($comSpec), 'cmd.exe') !== false; | ||
} | ||
|
||
} |
Oops, something went wrong.