本文整理汇总了PHP中FireCake::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP FireCake::getInstance方法的具体用法?PHP FireCake::getInstance怎么用?PHP FireCake::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FireCake
的用法示例。
在下文中一共展示了FireCake::getInstance方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* setUp method
*
* @return void
*/
public function setUp()
{
parent::setUp();
Configure::write('log', false);
$this->firecake = FireCake::getInstance('TestFireCake');
TestFireCake::reset();
}
示例2: startCase
/**
* start Case - switch view paths
*
* @return void
**/
function startCase()
{
$this->_viewPaths = Configure::read('viewPaths');
Configure::write('viewPaths', array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS, APP . 'plugins' . DS . 'debug_kit' . DS . 'views' . DS, ROOT . DS . LIBS . 'view' . DS));
$this->_debug = Configure::read('debug');
$this->firecake =& FireCake::getInstance();
}
示例3: setUp
/**
* setUp
*
* @return void
**/
public function setUp()
{
parent::setUp();
Router::connect('/:controller/:action');
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
Router::parse('/');
$this->Controller = new Controller($this->getMock('CakeRequest'), new CakeResponse());
$this->View = new View($this->Controller);
$this->Toolbar = new ToolbarHelper($this->View, array('output' => 'DebugKit.FirePhpToolbar'));
$this->Toolbar->FirePhpToolbar = new FirePhpToolbarHelper($this->View);
$this->firecake = FireCake::getInstance();
}
示例4: testOutput
/**
* test output switch to firePHP
*
* @return void
*/
public function testOutput()
{
$firecake = FireCake::getInstance('TestFireCake');
Debugger::getInstance('DebugKitDebugger');
Debugger::addFormat('fb', array('callback' => 'DebugKitDebugger::fireError'));
Debugger::output('fb');
set_error_handler('ErrorHandler::handleError');
$foo .= '';
restore_error_handler();
$result = $firecake->sentHeaders;
$this->assertPattern('/GROUP_START/', $result['X-Wf-1-1-1-1']);
$this->assertPattern('/ERROR/', $result['X-Wf-1-1-1-2']);
$this->assertPattern('/GROUP_END/', $result['X-Wf-1-1-1-4']);
Debugger::getInstance('Debugger');
Debugger::output();
}
示例5: jsonEncode
/**
* Encode an object into JSON
*
* @param mixed $object Object or array to json encode
* @param bool $skipEncode
* @internal param bool $doIt
* @static
* @return string
*/
public static function jsonEncode($object, $skipEncode = false)
{
$_this = FireCake::getInstance();
if (!$skipEncode) {
$object = FireCake::stringEncode($object);
}
return json_encode($object);
}
示例6: testOutput
/**
* test _output switch to firePHP
*
* @return void
*/
function testOutput()
{
$firecake =& FireCake::getInstance('TestFireCake');
Debugger::invoke(DebugKitDebugger::getInstance('DebugKitDebugger'));
Debugger::output('fb');
$foo .= '';
$result = $firecake->sentHeaders;
$this->assertPattern('/GROUP_START/', $result['X-Wf-1-1-1-1']);
$this->assertPattern('/ERROR/', $result['X-Wf-1-1-1-2']);
$this->assertPattern('/GROUP_END/', $result['X-Wf-1-1-1-5']);
Debugger::invoke(Debugger::getInstance('Debugger'));
Debugger::output();
}
示例7: reset
/**
* Reset FireCake
*
* @return void
*/
public static function reset()
{
$_this = FireCake::getInstance();
$_this->sentHeaders = array();
$_this->_messageIndex = 1;
}
示例8: stringEncode
/**
* Encode non string objects to string.
* Filter out recursion, so no errors are raised by json_encode or $javascript->object()
*
* @param mixed $object Object or variable to encode to string.
* @param int $objectDepth Current Depth in object chains.
* @param int $arrayDepth Current Depth in array chains.
* @return string|Object
*/
public static function stringEncode($object, $objectDepth = 1, $arrayDepth = 1)
{
$_this = FireCake::getInstance();
$return = array();
if (is_resource($object)) {
return '** ' . (string) $object . '**';
}
if (is_object($object)) {
if ($objectDepth == $_this->options['maxObjectDepth']) {
return '** Max Object Depth (' . $_this->options['maxObjectDepth'] . ') **';
}
foreach ($_this->_encodedObjects as $encoded) {
if ($encoded === $object) {
return '** Recursion (' . get_class($object) . ') **';
}
}
$_this->_encodedObjects[] = $object;
$return['__className'] = $class = get_class($object);
$properties = get_object_vars($object);
foreach ($properties as $name => $property) {
$return[$name] = FireCake::stringEncode($property, 1, $objectDepth + 1);
}
array_pop($_this->_encodedObjects);
}
if (is_array($object)) {
if ($arrayDepth == $_this->options['maxArrayDepth']) {
return '** Max Array Depth (' . $_this->options['maxArrayDepth'] . ') **';
}
foreach ($object as $key => $value) {
$return[$key] = FireCake::stringEncode($value, 1, $arrayDepth + 1);
}
}
if (is_string($object) || is_numeric($object) || is_bool($object) || $object === null) {
return $object;
}
return $return;
}
示例9: testNonNativeEncoding
/**
* test of Non Native JSON encoding.
*
* @return void
*/
public function testNonNativeEncoding()
{
FireCake::setOptions(array('useNativeJsonEncode' => false));
$json = FireCake::jsonEncode(array('one' => 1, 'two' => 2));
$this->assertEqual($json, '{"one":1,"two":2}');
$json = FireCake::jsonEncode(array(1, 2, 3));
$this->assertEqual($json, '[1,2,3]');
$json = FireCake::jsonEncode(FireCake::getInstance());
$this->assertPattern('/"options"\\:\\{"maxObjectDepth"\\:\\d*,/', $json);
}
示例10: jsonEncode
/**
* Encode an object into JSON
*
* @param mixed $object Object or array to json encode
* @param boolean $doIt
* @access public
* @static
* @return string
**/
function jsonEncode($object, $skipEncode = false)
{
$_this = FireCake::getInstance();
if (!$skipEncode) {
$object = FireCake::stringEncode($object);
}
if (function_exists('json_encode') && $_this->options['useNativeJsonEncode']) {
return json_encode($object);
} else {
return FireCake::_jsonEncode($object);
}
}
示例11: _sendHeader
/**
* Send header
*
* @param $name
* @param $value
*/
protected function _sendHeader($name, $value)
{
$_this = FireCake::getInstance();
$_this->sentHeaders[$name] = $value;
}