Skip to content

Commit

Permalink
Merge pull request #7 from redbitcz/jb-production
Browse files Browse the repository at this point in the history
Detector: Add production mode
  • Loading branch information
jakubboucek authored Oct 18, 2021
2 parents 987d1bb + 722dbd3 commit 08d4bd9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/Detector.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,28 @@ public function isDebugMode(?bool $default = false): ?bool
return $default;
}

/**
* Detect Production mode (opposite to Debug mode) by all method enabled by Detector mode
* Returned value:
* - `false` (force to turn-on debug mode)
* - `true` (force to turn-off debug mode)
* - `null` (unknown/automatic debug mode state)
*/
public function isProductionMode(?bool $default = false): ?bool
{
if (is_bool($default)) {
$default = !$default;
}

$result = $this->isDebugMode($default);

if (is_bool($result)) {
$result = !$result;
}

return $result;
}

/**
* Detect Debug mode by `DebugMode\Enabler` helper
* Returned value:
Expand Down

0 comments on commit 08d4bd9

Please sign in to comment.