-
Notifications
You must be signed in to change notification settings - Fork 0
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
9 changed files
with
185 additions
and
0 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
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,37 @@ | ||
<?php | ||
|
||
namespace Func\Ext; | ||
|
||
class Test | ||
{ | ||
public $name = []; | ||
public static $cache = []; | ||
public static $arg = []; | ||
public static $args = []; | ||
|
||
public function __construct($name = null) | ||
{ | ||
$this->name = func_get_args(); | ||
} | ||
|
||
public static function _get($name) | ||
{ | ||
self::$arg[$name] = func_get_args(); | ||
return self::$cache[$name]; | ||
} | ||
|
||
public function set($name) | ||
{ | ||
$arg = func_get_args(); | ||
self::$cache[$name] = $arg; | ||
} | ||
|
||
public function __debugInfo() | ||
{ | ||
return [ | ||
'name' => $this->name, | ||
'cache' => self::$cache, | ||
'arg' => self::$arg, | ||
]; | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace Func; | ||
|
||
class Filesystem | ||
{ | ||
public function __construct() | ||
{ | ||
|
||
} | ||
} | ||
|
||
function path_info($url_path = null , $options = null) | ||
{ | ||
$url_path = $url_path ? : $_SERVER['REQUEST_URI']; | ||
$url_path = parse_url($url_path, PHP_URL_PATH); | ||
return pathinfo($url_path, $options); | ||
} |
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,20 @@ | ||
<?php | ||
|
||
use Func as f; | ||
|
||
new \Func\Arr; | ||
|
||
function array_diff_kv($arr = [], $other = [], $ignore = [], $null = false) | ||
{ | ||
return f\array_diff_kv($arr, $other, $ignore, $null); | ||
} | ||
|
||
function arr_fixed_assoc(array &$array, $reset = false) | ||
{ | ||
return f\arr_fixed_assoc($array, $reset); | ||
} | ||
|
||
function arr_reset_values(array &$array, $set = [], $reset = false) | ||
{ | ||
return f\arr_reset_values($array, $set, $reset); | ||
} |
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,10 @@ | ||
<?php | ||
|
||
use Func as f; | ||
|
||
new \Func\Filesystem; | ||
|
||
function path_info($url_path = null , $options = null) | ||
{ | ||
return f\path_info($url_path, $options); | ||
} |
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,10 @@ | ||
<?php | ||
|
||
use Func as f; | ||
|
||
new \Func\PCRE; | ||
|
||
function str_match($pattern, $subject, $value = null, $type = false) | ||
{ | ||
return f\str_match($pattern, $subject, $value, $type); | ||
} |
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,10 @@ | ||
<?php | ||
|
||
use Func as f; | ||
|
||
new \Func\Str; | ||
|
||
function unicode_decode($str, $type = null) | ||
{ | ||
return f\unicode_decode($str, $type); | ||
} |
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,15 @@ | ||
<?php | ||
|
||
use Func as f; | ||
|
||
new \Func\Variable; | ||
|
||
function _isset($arr, $key = '', $value = null) | ||
{ | ||
return f\_isset($arr, $key, $value); | ||
} | ||
|
||
function _unset($arr, $keys = []) | ||
{ | ||
return f\_unset($arr, $keys); | ||
} |
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,33 @@ | ||
<?php | ||
|
||
|
||
$_NAMES = array( | ||
'' => 'index', | ||
'index', | ||
); | ||
|
||
|
||
$Composer = require __DIR__ . '/../../../../vendor/autoload.php'; | ||
$functions = [ | ||
'_isset' => ['', [], '', null], | ||
#'\Func\array_diff_kv' => ['', [], [], [], false], | ||
'str_match' => ['', '//', '', null, false], | ||
#'\Func\Arr\arr_fixed_assoc' => ['', [], false], | ||
#'arr_reset_values', | ||
]; | ||
func($functions, ['variable', 'arr', 'pcre', 'Filesystem']); | ||
|
||
|
||
|
||
|
||
arr_fixed_assoc($_NAMES, true); | ||
arr_reset_values($_NAMES, ['prefix' => __DIR__ . '/../example/', 'suffix' => '.php'], true); | ||
$basename = \Func\path_info(0, PATHINFO_BASENAME); | ||
#print_r([__LINE__, get_defined_functions()['user'], get_included_files(), $_NAMES, $basename, $_NAMES[$basename]]); | ||
if (array_key_exists($basename, $_NAMES) && include $_NAMES[$basename]) { | ||
// | ||
} else { | ||
include $_NAMES['']; | ||
} | ||
/**/ | ||
# print_r([__LINE__, get_defined_constants(), get_defined_vars()]); |