Skip to content
This repository was archived by the owner on Jan 23, 2019. It is now read-only.

Commit 3cbf7a7

Browse files
committed
up
1 parent b1b7022 commit 3cbf7a7

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

src/Components/ViewRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ViewRenderer
3838
protected $suffix = 'php';
3939

4040
/** @var array allowed suffix list */
41-
protected $suffixes = ['php','html'];
41+
protected $suffixes = ['php','tpl','html'];
4242

4343
/**
4444
* in layout file '...<body>{_CONTENT_}</body>...'

src/Utils/Environment.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: Inhere
5+
* Date: 2015/2/27
6+
* Use : ...
7+
* File: Environment.php
8+
*/
9+
10+
namespace Inhere\Library\Utils;
11+
12+
use Inhere\Library\Collections\SimpleCollection;
13+
14+
/**
15+
* 环境信息
16+
* Class Environment
17+
* @package Inhere\LibraryPlus\Utils
18+
*/
19+
class Environment extends SimpleCollection
20+
{
21+
/**
22+
* Create mock environment
23+
* @param array $userData Array of custom environment keys and values
24+
* @return self
25+
*/
26+
public static function mock(array $userData = [])
27+
{
28+
$data = array_merge([
29+
'SERVER_PROTOCOL' => 'HTTP/1.1',
30+
'REQUEST_METHOD' => 'GET',
31+
'SCRIPT_NAME' => '',
32+
'REQUEST_URI' => '',
33+
'QUERY_STRING' => '',
34+
'SERVER_NAME' => 'localhost',
35+
'SERVER_PORT' => 80,
36+
'HTTP_HOST' => 'localhost',
37+
'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
38+
'HTTP_ACCEPT_LANGUAGE' => 'en-US,en;q=0.8',
39+
'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
40+
'HTTP_USER_AGENT' => 'Slim Framework',
41+
'REMOTE_ADDR' => '127.0.0.1',
42+
'REQUEST_TIME' => time(),
43+
'REQUEST_TIME_FLOAT' => microtime(true),
44+
], $userData);
45+
46+
return new static($data);
47+
}
48+
49+
}// end class Environment

0 commit comments

Comments
 (0)