Smart.Framework Logo

final class \SmartEnvironment
{ } ::

Class: Smart Environment - provides the methods for the Smart.Framework environment.


class Methods

public static function isAdminArea ( ) {} :: BOOLEAN
@return: {BOOLEAN} if is ADMIN area will return TRUE else will return FALSE
Test if Admin (service) Area
For services running over admin.php / task.php will return TRUE ; for services running over index.php will return FALSE
public static function isTaskArea ( ) {} :: BOOLEAN
@return: {BOOLEAN} if is TASK area will return TRUE else will return FALSE
Test if Task (service) Area (implies also to be isAdminArea() as well)
Task area is an Admin area with some unrestricted features ; it must be restricted by IP to avoid security issues ; it is designed to be used mostly in development but can be used in production by restricting the access to this area using the init setting: SMART_FRAMEWORK_RUNTIME_TASK_ALLOWED_IPS
For services running over task.php will return TRUE ; for services running over admin.php / index.php will return FALSE
public static function ifDevMode ( ) {} :: BOOL
@return: {BOOLEAN} if is Production Environment will return TRUE else will return FALSE (if FALSE it is always considered the Development Environment)
Test if Production Environment as set in init.php by SMART_FRAMEWORK_ENV
Production Environment (SMART_FRAMEWORK_ENV = 'prod') differ from Development Environment (SMART_FRAMEWORK_ENV = 'dev') especially by the fact that Production Environment avoids to display any error (will just log errors and warnings and will not log notices)
Using this method to detect if Production or Development Environment the code can have a dual behaviour Production vs Development
public static function ifDebug ( ) {} :: BOOL
@return: {BOOLEAN} if Debug is ON will return TRUE, else will return FALSE
Test if DEBUG is ON
Debug can be enabled on both: Production or Development Environments, by setting; define('SMART_FRAMEWORK_DEBUG_MODE', true); // init.php
Using Debug in Production Environment must be enabled per one IP only that can have access to that feature to avoid expose sensitive data to the world !!!
Ex: if(myIPIsDetected()) { define('SMART_FRAMEWORK_DEBUG_MODE', true); } // in init.php, for a Production Environment

class Properties


class Constants


Sample code: PHP

<?php

// Usage example:
 
Smart::some_method_of_this_class(...);

// #end php code


documentation generated on: 2023-10-19 23:15:42 +0000


Smart.Framework © 2009-2023 unix-world.org