当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::isProduction方法代码示例

本文整理汇总了PHP中Library\Application::isProduction方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::isProduction方法的具体用法?PHP Application::isProduction怎么用?PHP Application::isProduction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Library\Application的用法示例。


在下文中一共展示了Application::isProduction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setPackageData

 /**
  * Set attributes from given package
  *
  * Attributes are populated with values from the given package and
  * hardcoded defaults.
  *
  * @param array $data Package data
  */
 public function setPackageData($data)
 {
     $node = $this->createElement('DOWNLOAD');
     $node->setAttribute('ID', $data['Id']);
     $node->setAttribute('PRI', $data['Priority']);
     $node->setAttribute('ACT', strtoupper($data['DeployAction']));
     $node->setAttribute('DIGEST', $data['Hash']);
     $node->setAttribute('PROTO', 'HTTP');
     $node->setAttribute('FRAGS', $data['NumFragments']);
     $node->setAttribute('DIGEST_ALGO', 'SHA1');
     $node->setAttribute('DIGEST_ENCODE', 'Hexa');
     $node->setAttribute('PATH', $data['DeployAction'] == 'store' ? $data['ActionParam'] : '');
     $node->setAttribute('NAME', $data['DeployAction'] == 'launch' ? $data['ActionParam'] : '');
     $node->setAttribute('COMMAND', $data['DeployAction'] == 'execute' ? $data['ActionParam'] : '');
     $node->setAttribute('NOTIFY_USER', $data['Warn'] ? '1' : '0');
     $node->setAttribute('NOTIFY_TEXT', $this->_escapeMessage($data['WarnMessage']));
     $node->setAttribute('NOTIFY_COUNTDOWN', $data['WarnCountdown']);
     $node->setAttribute('NOTIFY_CAN_ABORT', $data['WarnAllowAbort'] ? '1' : '0');
     $node->setAttribute('NOTIFY_CAN_DELAY', $data['WarnAllowDelay'] ? '1' : '0');
     $node->setAttribute('NEED_DONE_ACTION', $data['PostInstMessage'] ? '1' : '0');
     $node->setAttribute('NEED_DONE_ACTION_TEXT', $this->_escapeMessage($data['PostInstMessage']));
     $node->setAttribute('GARDEFOU', 'rien');
     if ($this->hasChildNodes()) {
         $this->replaceChild($node, $this->firstChild);
     } else {
         $this->appendChild($node);
     }
     if (!\Library\Application::isProduction()) {
         $this->forceValid();
     }
 }
开发者ID:patrickpreuss,项目名称:Braintacle,代码行数:39,代码来源:Metadata.php

示例2: testEnvironment

 /**
  * Tests for environment detection methods
  * 
  * The tests cover getEnvironment(), isProduction(), isDevelopment() and
  * isTest() with all relevant values for the APPLICATION_ENV environment
  * variable.
  */
 public function testEnvironment()
 {
     // Assume that the tests have been invoked with APPLICATION_ENV set to
     // "test". Otherwise the tests might be incomplete.
     $this->assertEquals('test', getenv('APPLICATION_ENV'));
     $this->assertEquals('test', Application::getEnvironment());
     $this->assertFalse(Application::isProduction());
     $this->assertTrue(Application::isDevelopment());
     $this->assertTrue(Application::isTest());
     // Unset APPLICATION_ENV, equivalent to "production"
     putenv('APPLICATION_ENV');
     $this->assertEquals('production', Application::getEnvironment());
     $this->assertTrue(Application::isProduction());
     $this->assertFalse(Application::isDevelopment());
     $this->assertFalse(Application::isTest());
     // Test "development" environment
     putenv('APPLICATION_ENV=development');
     $this->assertEquals('development', Application::getEnvironment());
     $this->assertFalse(Application::isProduction());
     $this->assertTrue(Application::isDevelopment());
     $this->assertFalse(Application::isTest());
     // Test invalid environment. Ensure that the variable is reset to its
     // default in either case.
     putenv('APPLICATION_ENV=invalid');
     try {
         Application::getEnvironment();
     } catch (\DomainException $expected) {
         $invalidEnvironmmentDetected = true;
     }
     // Reset to default.
     putenv('APPLICATION_ENV=test');
     if (!isset($invalidEnvironmmentDetected)) {
         $this->fail('Invalid environment was undetected.');
     }
 }
开发者ID:patrickpreuss,项目名称:Braintacle,代码行数:42,代码来源:ApplicationTest.php

示例3: error_reporting

/**
 * All interaction with the user agent starts with this script.
 *
 * Copyright (C) 2011-2015 Holger Schletz <holger.schletz@web.de>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
// Set up PHP environment. The error configuration is done as early as possible.
error_reporting(-1);
require_once '../module/Library/Application.php';
if (\Library\Application::isProduction()) {
    ini_set('display_errors', false);
    ini_set('display_startup_errors', false);
} else {
    ini_set('display_errors', true);
    ini_set('display_startup_errors', true);
}
\Library\Application::init('Console');
开发者ID:patrickpreuss,项目名称:Braintacle,代码行数:30,代码来源:index.php


注:本文中的Library\Application::isProduction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。