本文整理汇总了PHP中static::data方法的典型用法代码示例。如果您正苦于以下问题:PHP static::data方法的具体用法?PHP static::data怎么用?PHP static::data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::data方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init()
{
parse_str(file_get_contents("php://input"), static::$data);
static::$data = array_merge($_GET, $_POST);
$met = $_SERVER['REQUEST_METHOD'];
static::$header['method'] = $met;
$path = str_replace('?' . $_SERVER['QUERY_STRING'], '', $_SERVER['REQUEST_URI']);
static::$header['path'] = $path;
$queries = [];
$sQuery = $_SERVER['QUERY_STRING'];
$a = explode('&', $sQuery);
if (count($a) > 0) {
foreach ($a as $b) {
$c = explode('=', $b);
if (is_array($c) && count($c) === 2) {
$d = '';
$v = $c[1];
if (is_numeric($v)) {
$d = 1 * $v;
} else {
if (is_string($v)) {
$d = urldecode($v);
}
}
$queries[$c[0]] = $d;
}
}
}
static::$header['query'] = (object) $queries;
}
示例2: getData
/**
* @return DataGenerator
*/
public static function getData()
{
if (!isset(static::$data)) {
static::$data = new DataGenerator();
}
return static::$data;
}
示例3: grabUnadjUnemploymentData
/**
* Given a State FIPS code and an ending year, returns the (unadjusted) county-level unemployment levels for the previous 10 year period.
* Seasonally adjusted data does not appear to be available at the county level.
*
* @param string stateId
* @param string endYear
* @return string[] $data
*/
public static function grabUnadjUnemploymentData($stateId, $endYear)
{
ini_set('max_execution_time', 0);
static::$data = array();
$codes = FipsCodeGenerator::getFipsList($stateId);
$index = 0;
$tableList = array();
foreach ($codes as $code) {
if (count($tableList) >= 25) {
$results = static::queryAPI($tableList, $endYear);
static::addToData($results);
$tableList = array();
}
$entry = '';
if (substr($code, -3) == '000') {
//the code is a state code
$entry .= static::$tablePrefixes['stateUnadjUnemployRate'];
$entry .= $code;
$entry .= static::$tableSuffixes['stateUnadjUnemployRate'];
} else {
$entry .= static::$tablePrefixes['countyUnadjUnemployRate'];
$entry .= $code;
$entry .= static::$tableSuffixes['countyUnadjUnemployRate'];
}
array_push($tableList, $entry);
//appends the entry to the indexed list
}
$results = static::queryAPI($tableList, $endYear);
static::addToData($results);
ksort(static::$data);
return static::$data;
}
示例4: add
/**
* Add data to pass.
*
* @param array $data
*/
public static function add(array $data)
{
// Filter and merge data
$data = array_filter($data, function ($value) {
return !is_null($value);
});
$data = array_merge_recursive(static::$data, $data);
static::$data = $data;
}
示例5: resolveEmailTemplateByWizardPostData
/**
* @param EmailTemplate static::$emailTemplate
* @param array $postData
* @param string$wizardFormClassName
*/
public static function resolveEmailTemplateByWizardPostData(EmailTemplate $emailTemplate, array $postData, $wizardFormClassName)
{
assert('is_array($postData)');
assert('is_string($wizardFormClassName)');
static::$data = ArrayUtil::getArrayValue($postData, $wizardFormClassName);
static::$emailTemplate = $emailTemplate;
static::resolveMetadataMembers();
static::resolveOwner();
static::resolveFileAttachments();
}
示例6: clear
/**
* Clear a key within the cache data, or call without an argument to clear all the cached data.
*
* @param string $key The key of the cached data
*
* @return void
*/
public static function clear($key = null)
{
if ($key) {
if (isset(static::$data[$key])) {
unset(static::$data[$key]);
}
} else {
static::$data = [];
}
}
示例7: loadGlobalProvider
/**
* loadGlobalProvider
*
* @return Data
*/
public static function loadGlobalProvider()
{
if (static::$data) {
return static::$data;
}
$event = new Event('loadGlobalProvider');
$event['data'] = new Data();
Ioc::getDispatcher()->triggerEvent($event);
return static::$data = $event['data'];
}
示例8: remove
public static function remove($key = null)
{
// reset the entire array
if (is_null($key)) {
return static::$data = array();
}
// unset a single key
unset(static::$data[$key]);
// return the array without the removed key
return static::$data;
}
示例9: _toData
public static function _toData()
{
if (is_null(static::$data)) {
static::_get();
$data = array();
foreach (static::$array['classes'] as $class) {
$data[$class['id']] = $class['name'];
}
static::$data = $data;
}
}
示例10: load
public static function load($config_file = null, $config_data = null)
{
if (!empty($config_file) && Helper::checkFile($config_file) && !($yaml = file_get_contents($config_file))) {
throw new \Exception("Failed to read config file {$config_file}");
}
if (empty($config_data) && !($data = Yaml::parse($yaml))) {
throw new \Exception("Failed to parse config file {$config_file}");
}
static::$data = static::$base = array_merge(static::$data, $data);
self::$cache = array();
}
示例11: get
/**
* Gets a layout.
*
* @param string $name
* @param array $data
* @return string
*/
public static function get(string $name, array $data = []) : string
{
// Merge the data.
static::$data = array_merge_recursive(static::data(), $data);
// Merge validation errors into the view data.
if (!isset(static::$data['errors']) && ($errors = Session::flash('validation_errors'))) {
static::$data['errors'] = $errors;
}
// Get the path to the layout.
$path = path('layouts') . $name . '.layout.php';
// Load.
return Component::load($path, static::data());
}
示例12: Export
/**
* @param array $options
* @return string
* @throws \yii\base\Exception
*/
public static function Export(array $options = [])
{
static::$data = isset($options['data']) ? $options['data'] : [];
static::$fileName = isset($options['fileName']) ? $options['fileName'] : 'file.csv';
if (!isset($options['dirName'])) {
throw new Exception('You must set dirName');
}
static::$dirName = $options['dirName'];
if (static::$dirName[strlen(static::$dirName - 1)] !== '/') {
static::$dirName .= '/';
}
return self::array2csv(static::$data, static::$dirName, static::$fileName);
}
示例13: loadData
protected static function loadData()
{
if (static::$loaded) {
return;
}
static::$data = static::$original = Cache::remember('fluxbb.config', 24 * 60, function () {
$data = DB::table('config')->get();
$cache = array();
foreach ($data as $row) {
$cache[$row->conf_name] = $row->conf_value;
}
return $cache;
});
static::$loaded = true;
}
示例14: get
/**
* @param string $key
* @param mixed $default
* @return mixed
*/
public static function get($key, $default = null)
{
$platform = self::getPlatform();
if (!preg_match('/[a-z-]/', $key)) {
throw new \InvalidArgumentException('Invalid config key:' . $key);
}
$data = static::$data;
if ($platform->hasPersonalConfig()) {
$data = $platform->getConfigByKey('laravelpagseguro');
}
if (is_null($data)) {
$data = (include __DIR__ . '/application-config.php');
static::$data = $data;
}
return array_key_exists($key, $data) ? $data[$key] : $default;
}
示例15: init
public static function init()
{
$config = array('db' => array());
require_once APP . 'config.php';
static::$data = new stdClass();
static::$data->title = $config['default']['title'];
static::$template = $config['default']['template'];
// Database config options
define('DB_HOST', $config['db']['host']);
define('DB_NAME', $config['db']['name']);
define('DB_USER', $config['db']['user']);
define('DB_PASS', base64_decode($config['db']['pass']));
// Path to remove from uri
static::$path = $config['path'];
static::$profiler = $config['profiler']['log'];
static::$profiler_query = $config['profiler']['query'];
static::$status = $config['status'];
}