Console_Application
[ class tree: Console_Application ] [ index: Console_Application ] [ all elements ]

Source for file Enviroment.php

Documentation is available at Enviroment.php

  1. <?php
  2. /**
  3.  * Console Library
  4.  *
  5.  * LICENSE
  6.  *
  7.  * "THE BEER-WARE LICENSE" (Revision 42):
  8.  * "Sven Strittmatter" <ausserirdisch@sven-space.de> wrote this file.
  9.  * As long as you retain this notice you can do whatever you want with
  10.  * this stuff. If we meet some day, and you think this stuff is worth it,
  11.  * you can buy me a beer in return.
  12.  *
  13.  * $Author$
  14.  * $Revision$
  15.  *
  16.  * @category    Console
  17.  * @package     Console_Application
  18.  * @copyright   Copyright (c) 2009 Sven Strittmatter
  19.  */
  20.  
  21. /**
  22.  * Template method class for CLI commands.
  23.  *
  24.  * @see HelloWorldApplication for an example implementation.
  25.  *
  26.  * @abstract
  27.  * @category   Console
  28.  * @package    Console_Enviroment
  29.  * @copyright  Copyright (c) 2009 Sven Strittmatter
  30.  */
  31.     const OS_WINDOWS 'win';
  32.     const OS_MACOS   'Darwin';
  33.     const OS_LINIX   'linux';
  34.  
  35.     /**
  36.      * @link http://de.php.net/manual/en/function.php-sapi-name.php
  37.      * 
  38.      * @return bool 
  39.      */
  40.     public static function isSapiCli({
  41.         return ('cli' === php_sapi_name());
  42.     }
  43.  
  44.     /**
  45.      * Returns if the php enviromt is of an specific os type.
  46.      *
  47.      * @static
  48.      * @access public
  49.      * @param string $osType One of the OS_* constants
  50.      * @return bool 
  51.      */
  52.     public static function isOs($osType{
  53.         return PHP_OS === $osType;
  54.     }
  55.  
  56.     /**
  57.      * Returns if the php enviroment os is Winows
  58.      *
  59.      * @static
  60.      * @access public
  61.      * @return bool 
  62.      */
  63.     public static function isWindows({
  64. //        return self::isOs(self::OS_WINDOWS);
  65.     }
  66.  
  67.     /**
  68.      * Returns if the php enviroment os is Linux
  69.      *
  70.      * @static
  71.      * @access public
  72.      * @return bool 
  73.      */
  74.     public static function isLinux({
  75. //        return self::isOs(self::OS_Linux);
  76.     }
  77.  
  78.     /**
  79.      * Returns if the php enviroment os is Mac Os
  80.      *
  81.      * @static
  82.      * @access public
  83.      * @return bool 
  84.      */
  85.     public static function isMacOs({
  86.         return self::isOs(self::OS_MACOS);
  87.     }
  88. }

Documentation generated on Mon, 17 Aug 2009 15:52:31 +0200 by phpDocumentor 1.4.2