-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
279 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
/** | ||
* @author [email protected] | ||
* Date: 18/3/29 下午7:51 | ||
*/ | ||
|
||
const JSONNET_PHP_VERSION = 'v1.3.0'; | ||
const JSONNET_PHP_AUTHOR = '[email protected]'; | ||
|
||
const CODE_SUCCESS = 1000; | ||
const CODE_ERROR = 900; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
function jsonnet_get_version() | ||
{ | ||
return JSONNET_PHP_VERSION; | ||
} | ||
|
||
function jsonnet_get_author() | ||
{ | ||
return JSONNET_PHP_AUTHOR; | ||
} | ||
|
||
class JsonNet | ||
{ | ||
public function __construct() | ||
{ | ||
#JsonNet init | ||
} | ||
|
||
public function __destruct() | ||
{ | ||
#JsonNet destroy | ||
} | ||
|
||
/** | ||
* @param $file_path | ||
* | ||
* @return array | ||
* @throws Exception | ||
*/ | ||
static public function evaluateFile($file_path) | ||
{ | ||
throw new Exception('JsonNet::evaluateFile #error', CODE_ERROR); | ||
|
||
return array(); | ||
} | ||
|
||
/** | ||
* @param $snippet_string | ||
* | ||
* @return array | ||
* @throws Exception | ||
*/ | ||
static public function evaluateSnippet($snippet_string) | ||
{ | ||
throw new Exception('JsonNet::evaluateSnippet #error', CODE_ERROR); | ||
|
||
return array(); | ||
} | ||
|
||
/** | ||
* @param $file_path | ||
* | ||
* @return array | ||
* @throws Exception | ||
*/ | ||
static public function fmtFile($file_path) | ||
{ | ||
throw new Exception('JsonNet::fmtFile #error', CODE_ERROR); | ||
|
||
return array(); | ||
} | ||
|
||
/** | ||
* @param $snippet_string | ||
* | ||
* @return array | ||
* @throws Exception | ||
*/ | ||
static public function fmtSnippet($snippet_string) | ||
{ | ||
throw new Exception('JsonNet::fmtSnippet #error', CODE_ERROR); | ||
|
||
return array(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,4 +124,170 @@ or | |
|
||
var_dump(JsonNet::evaluateSnippet($Snippet)); | ||
|
||
``` | ||
|
||
### PHP Re Result | ||
``` | ||
/usr/local/php/php-7.0.6-zts-debug/bin/php --re jsonnet | ||
Extension [ <persistent> extension #40 JsonNet version v1.3.0 ] { | ||
- Constants [2] { | ||
Constant [ string JSONNET_PHP_VERSION ] { v1.3.0 } | ||
Constant [ string JSONNET_PHP_AUTHOR ] { Chitao.Gao [ [email protected] ] } | ||
} | ||
- Functions { | ||
Function [ <internal:JsonNet> function jsonnet_get_version ] { | ||
} | ||
Function [ <internal:JsonNet> function jsonnet_get_author ] { | ||
} | ||
} | ||
- Classes [1] { | ||
Class [ <internal:JsonNet> class JsonNet ] { | ||
- Constants [0] { | ||
} | ||
- Static properties [0] { | ||
} | ||
- Static methods [4] { | ||
Method [ <internal:JsonNet> static public method evaluateFile ] { | ||
- Parameters [1] { | ||
Parameter #0 [ <required> $file_path ] | ||
} | ||
} | ||
Method [ <internal:JsonNet> static public method evaluateSnippet ] { | ||
- Parameters [1] { | ||
Parameter #0 [ <required> $snippet_string ] | ||
} | ||
} | ||
Method [ <internal:JsonNet> static public method fmtFile ] { | ||
- Parameters [1] { | ||
Parameter #0 [ <required> $file_path ] | ||
} | ||
} | ||
Method [ <internal:JsonNet> static public method fmtSnippet ] { | ||
- Parameters [1] { | ||
Parameter #0 [ <required> $snippet_string ] | ||
} | ||
} | ||
} | ||
- Properties [0] { | ||
} | ||
- Methods [2] { | ||
Method [ <internal:JsonNet, ctor> public method __construct ] { | ||
} | ||
Method [ <internal:JsonNet, dtor> public method __destruct ] { | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
###CodeTips | ||
``` | ||
<?php | ||
/** | ||
* @author [email protected] | ||
* Date: 18/3/29 下午7:51 | ||
*/ | ||
const JSONNET_PHP_VERSION = 'v1.3.0'; | ||
const JSONNET_PHP_AUTHOR = '[email protected]'; | ||
const CODE_SUCCESS = 1000; | ||
const CODE_ERROR = 900; | ||
/** | ||
* @return string | ||
*/ | ||
function jsonnet_get_version() | ||
{ | ||
return JSONNET_PHP_VERSION; | ||
} | ||
function jsonnet_get_author() | ||
{ | ||
return JSONNET_PHP_AUTHOR; | ||
} | ||
class JsonNet | ||
{ | ||
public function __construct() | ||
{ | ||
#JsonNet init | ||
} | ||
public function __destruct() | ||
{ | ||
#JsonNet destroy | ||
} | ||
/** | ||
* @param $file_path | ||
* | ||
* @return array | ||
* @throws Exception | ||
*/ | ||
static public function evaluateFile($file_path) | ||
{ | ||
throw new Exception('JsonNet::evaluateFile #error', CODE_ERROR); | ||
return array(); | ||
} | ||
/** | ||
* @param $snippet_string | ||
* | ||
* @return array | ||
* @throws Exception | ||
*/ | ||
static public function evaluateSnippet($snippet_string) | ||
{ | ||
throw new Exception('JsonNet::evaluateSnippet #error', CODE_ERROR); | ||
return array(); | ||
} | ||
/** | ||
* @param $file_path | ||
* | ||
* @return array | ||
* @throws Exception | ||
*/ | ||
static public function fmtFile($file_path) | ||
{ | ||
throw new Exception('JsonNet::fmtFile #error', CODE_ERROR); | ||
return array(); | ||
} | ||
/** | ||
* @param $snippet_string | ||
* | ||
* @return array | ||
* @throws Exception | ||
*/ | ||
static public function fmtSnippet($snippet_string) | ||
{ | ||
throw new Exception('JsonNet::fmtSnippet #error', CODE_ERROR); | ||
return array(); | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters