本文整理汇总了PHP中get_type函数的典型用法代码示例。如果您正苦于以下问题:PHP get_type函数的具体用法?PHP get_type怎么用?PHP get_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_type函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getTextFromData
protected function getTextFromData($data)
{
if (!is_array($data)) {
throw new \RuntimeException('Wrong type of data to markdownify: ' . get_type($data));
}
return Yaml::dump($data, 3);
}
开发者ID:baddum,项目名称:model418,代码行数:7,代码来源:YamlFileRequest.php
示例2: setResolver
/**
* @param $callable
*
* @throws InvalidResolverException
*/
public function setResolver($callable)
{
if (!is_callable($callable)) {
throw new InvalidResolverException(s('Routing resolver must be a callable, received "%s".', get_type($callable)));
}
$this->resolver = $callable;
}
开发者ID:weew,项目名称:router,代码行数:12,代码来源:RouteResolver.php
示例3: getTextFromData
protected function getTextFromData($data)
{
if (!is_string($data)) {
throw new \RuntimeException('Wrong type of data to markdownify: ' . get_type($data));
}
return (new MarkdownifyExtra())->parseString($data);
}
开发者ID:baddum,项目名称:model418,代码行数:7,代码来源:MarkdownFileRequest.php
示例4: run
public function run(ApplicationInterface $app)
{
$connector = Connector::getInstance();
$connector->setSourcesBasePath(getcwd());
$matcher = new Matcher();
// redirect errors to PhpConsole
\PhpConsole\Handler::getInstance()->start();
$app->getEventsHandler()->bind('*', function (EventInterface $event) use($app, $connector, $matcher) {
/**
* @var $connector \PhpConsole\Connector
*/
if ($connector->isActiveClient()) {
$console = \PhpConsole\Handler::getInstance();
$context = $event->getContext();
$origin = $event->getOrigin();
switch (true) {
case $event->getName() == 'application.workflow.step.run':
$console->debug(sprintf('Starting running step %s', $origin->getName()), 'workflow.step');
break;
case $event->getName() == 'application.workflow.hook.run':
$middleware = $origin->getMiddleware();
$console->debug(sprintf('Running Middleware %s (%s)', $middleware->getReference(), $middleware->getDescription()), 'workflow.hook');
$this->dumpNotifications($console, $middleware->getNotifications());
break;
case $matcher->match(ServicesFactory::EVENT_INSTANCE_BUILT . '.*', $event->getName()):
$console->debug(sprintf('Built service %s (%s)', $context['serviceSpecs']->getId(), is_object($context['instance']) ? get_class($context['instance']) : get_type($context['instance'])), 'services');
break;
case $matcher->match($event->getName(), '*.notify.*'):
$this->dumpNotifications($console, $event->getContext('notifications'));
break;
}
}
});
}
开发者ID:objective-php,项目名称:devtools-package,代码行数:34,代码来源:PhpConsoleListener.php
示例5: transform
/**
* Transforms an array to a csv set of strings
*
* @param array|null $array
* @return string
*/
public function transform($array)
{
if (!is_array($array)) {
throw new TransformationFailedException(sprintf('%s is not an array', get_type($array)));
}
return implode(',', $array);
}
开发者ID:stopfstedt,项目名称:TdnPilotBundle,代码行数:13,代码来源:ArrayToStringTransformer.php
示例6: test_load_file
public function test_load_file()
{
$path = path(__DIR__, '/../configs/array.php');
$driver = new ArrayConfigDriver();
$config = $driver->loadFile($path);
$this->assertTrue(get_type($config) == 'array');
$this->assertEquals(require $path, $config);
}
开发者ID:weew,项目名称:config,代码行数:8,代码来源:ArrayConfigDriverTest.php
示例7: _create
/**
* Creates a new record and adds it to the DB based on the stuff given in $info
* @param info Array|Zend_Config The stuff to put in the DB
* @return $this
*/
protected function _create($info)
{
$info instanceof Zend_Config && ($info = $info->toArray());
if (!is_array($info)) {
throw new Kizano_Exception(sprintf('%s::%s(): Argument $info expected type (string), received `%s\'', __CLASS__, __FUNCTION__, get_type($info)));
}
foreach ($info as $name => $value) {
$this[$name] = $value;
}
return $this->save();
}
开发者ID:aldimol,项目名称:zf-sample,代码行数:16,代码来源:Record.php
示例8: invoke
/**
* @param IDefinition $definition
* @param $command
*
* @return mixed
* @throws InvalidCommandHandlerException
*/
public function invoke(IDefinition $definition, $command)
{
$handler = $definition->getHandler();
if ($this->isValidHandlerClass($handler)) {
$handler = $this->createHandler($handler);
}
if ($this->isValidHandler($handler)) {
return $this->invokeHandler($handler, $command);
}
throw new InvalidCommandHandlerException(s('Handler "%s" must implement method "handle($command)".', is_string($handler) ? $handler : get_type($handler)));
}
开发者ID:weew,项目名称:commander,代码行数:18,代码来源:CommandHandlerInvoker.php
示例9: getImgPath
function getImgPath($galleryFolder, $destination_folder, $imgName)
{
$imgPath = '';
if ($handle = opendir($destination_folder)) {
while (false !== ($file = readdir($handle))) {
if (strpos($file, $imgName) !== false && strpos($file, '_sm') === false) {
$img = $destination_folder . $file;
$imgData = base64_encode(file_get_contents($img));
$imgPath = 'data: ' . get_type($img) . ';base64,' . $imgData;
}
}
closedir($handle);
}
return $imgPath;
}
开发者ID:robinjes,项目名称:BYG_webapplication,代码行数:15,代码来源:get_artworks.php
示例10: files
/**
* Retrieves the attachments of the specified object
*
* @param mixed $object
* @return WebDev\AttachmentBundle\Attachement\File[]
*/
public function files($object)
{
if (!is_object($object)) {
throw new Exception("Can't retrieve the attachments of a " . get_type($object));
}
$class = new ReflectionClass($object);
$files = array();
foreach ($this->reader->getClassAnnotations($class) as $annotation) {
if (!$annotation instanceof FileAttachment) {
continue;
}
$file = new File($annotation, $object, $this);
$files[$file->getName()] = $file;
}
return $files;
}
开发者ID:Josiah,项目名称:AttachmentBundle,代码行数:22,代码来源:AttachmentManager.php
示例11: nameConstant
public static function nameConstant(SpritePackageInterface $package, SpriteImage $sprite)
{
$converter = $package->getConstantsConverter();
if (!empty($converter)) {
if (!is_callable($converter, true)) {
throw new RuntimeException('Variable of type `%s` is not callable', get_type($converter));
}
$params = [$package, $sprite];
$name = call_user_func_array($converter, $params);
} else {
$name = $sprite->name;
}
// Last resort replacements
$name = preg_replace('~^[0-9]+~', '', $name);
return str_replace('-', '_', $name);
}
开发者ID:maslosoft,项目名称:sprite,代码行数:16,代码来源:Namer.php
示例12: invokeRoute
/**
* @param IRoute $route
*
* @return IHttpResponse
* @throws InvalidRouteValue
*/
public function invokeRoute(IRoute $route)
{
$invoker = $this->findInvoker($route);
if ($invoker) {
$response = $invoker->invoke($route, $this->container);
if ($response instanceof IHttpResponseHolder) {
$response = $response->getHttpResponse();
} else {
if ($response instanceof IHttpResponseable) {
$response = $response->toHttpResponse();
}
}
if (!$response instanceof IHttpResponse) {
$response = new HttpResponse(HttpStatusCode::OK, $response);
}
return $response;
}
throw new InvalidRouteValue(s('Could not resolve route value of type %s.', get_type($route->getAction())));
}
开发者ID:weew,项目名称:router-routes-invoker-container-aware,代码行数:25,代码来源:RoutesInvoker.php
示例13: newSubtitle
public static function newSubtitle()
{
if (!isset($_FILES['newsub_file'])) {
return null;
}
$newsub_amt = count($_FILES['newsub_file']['name']);
$folder = 'subtitle/';
$return = array();
for ($i = 0; $i < $newsub_amt; $i++) {
$extension = get_type($_FILES['newsub_file']['name'][$i]);
$name = 'sub_' . strtotime('now') . rand(10000000, 99999999);
if ($_FILES['newsub_file']['tmp_name'][$i] && $extension == 'srt') {
$extension = 'srt';
move_uploaded_file($_FILES['newsub_file']['tmp_name'][$i], UPLOAD_PATH . "{$folder}{$name}.{$extension}");
$return[$i] = UPLOAD_URL . "{$folder}{$name}.{$extension}";
} else {
$return[$i] = null;
}
}
return $return;
}
开发者ID:jassonlazo,项目名称:GamersInvasion-Peliculas,代码行数:21,代码来源:upload.php
示例14: render_value
function render_value($dbc, $db_name, $name, $with_def = false)
{
if (strpos($name, $db_name . ':o') === 0) {
$id = str_replace($db_name . ':o', "", $name);
$query = "select * from def where id ='{$id}'";
$result = mysqli_query($dbc, $query) or die('Error querying database:' . $query);
if ($row = mysqli_fetch_array($result)) {
$pre_label = $row[name];
$def = $row[def];
$result = get_entity_link($id, get_type($dbc, $name) . ': ' . $pre_label, $db_name);
if ($with_def && $def != '') {
$result .= ' <em><small>(' . tcmks_substr($def) . ')' . '</small></em>';
}
} else {
$result = $name;
}
} else {
$result = $name;
}
return $result;
}
开发者ID:sdgdsffdsfff,项目名称:docs-1,代码行数:21,代码来源:graph_helper.php
示例15: encode
/**
* @param $data
* @param int $options
*
* @return string
* @throws InvalidDataTypeException
* @throws JsonEncodeException
*/
public function encode($data, $options = 0)
{
$json = null;
if ($data instanceof IArrayable) {
$json = @json_encode($data->toArray(), $options);
} else {
if ($data instanceof IJsonable) {
$json = $data->toJson($options);
} else {
if (is_array($data) || is_object($data)) {
$json = @json_encode($data, $options);
} else {
throw new InvalidDataTypeException(s('Can not convert data of type "%s" to json.', get_type($data)));
}
}
}
if ($json === false) {
throw new JsonEncodeException(json_last_error_msg(), $data);
}
return $json;
}
开发者ID:weew,项目名称:json-encoder,代码行数:29,代码来源:JsonEncoder.php
示例16: findBoundingKeys
function findBoundingKeys($needle, $haystack)
{
// Make sure we have an array
if (!is_array($haystack)) {
throw new Exception('findBoundingKeys expects $haystack to be an Array, got ' . get_type($haystack));
}
// Make sure we have an array of numbers we can compare
if (max(array_map('is_numeric', $haystack))) {
throw new Exception('findBoundingKeys expects $haystack to be an Array of numeric values');
}
// Sort the array in order from lowest value to highest
asort($haystack);
// Rewind the array so we start from the start
reset($haystack);
// If the needle is lower than the smallest element in $haystack, return the smallest element
if ($needle < min($haystack)) {
return array(key($haystack));
}
// If the needle is higher than the largest value in $haystack, return the last element
if ($needle > max($haystack)) {
end($haystack);
return array(key($haystack));
}
do {
// Get the key/value for the current array index
$current = current($haystack);
$currentkey = key($haystack);
// Advance to the next index and get the key/value for that index
$next = next($haystack);
$nextkey = key($haystack);
// Check if the needle is between the current and next elements
if ($current < $needle && $needle < $next) {
// If it is, return the current & next elements
return array($currentkey, $nextkey);
}
} while (key($haystack) !== FALSE);
// Something went utterly wrong, return FALSE
return FALSE;
}
开发者ID:hemantshekhawat,项目名称:Snippets,代码行数:39,代码来源:findBoundingKeys.php
示例17: dump
print "POST<BR/>\n";
if (!empty($_POST)) {
dump($_POST);
}
}
// $remotes = get_current(); // set auto-refresh if any mobile units
// $interval = intval(get_variable('auto_poll'));
// $refresh = ((($remotes['aprs']) || ($remotes['instam']) || ($remotes['locatea']) || ($remotes['gtrack']) || ($remotes['glat'])) && ($interval>0))? "\t<META HTTP-EQUIV='REFRESH' CONTENT='" . intval($interval*60) . "'>\n": "";
$temp = get_variable('auto_poll');
$poll_val = $temp == 0 ? "none" : $temp;
$id = array_key_exists('id', $_GET) ? $_GET['id'] : NULL;
$result = mysql_query("SELECT * FROM `{$GLOBALS['mysql_prefix']}ticket` WHERE id='{$id}'");
$row = mysql_fetch_assoc($result);
$title = $row['scope'];
$ticket_severity = get_severity($row['severity']);
$ticket_type = get_type($row['in_types_id']);
$ticket_status = get_status($row['status']);
$ticket_updated = format_date_time($row['updated']);
$ticket_addr = "{$row['street']}, {$row['city']} {$row['state']} ";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD><TITLE>Incident Popup - Incident <?php
print $title;
?>
<?php
print $ticket_updated;
?>
</TITLE>
<LINK REL=StyleSheet HREF="stylesheet.php?version=<?php
print time();
开发者ID:sharedgeo,项目名称:TicketsCAD-SharedGeo-Dev,代码行数:31,代码来源:incident_popup_nm.php
示例18: verify_record
$name = $domain;
}
} else {
$name = $_REQUEST['name'];
}
// verify record to be added
$result = verify_record($name, $_REQUEST['type'], $_REQUEST['address'], $_REQUEST['distance'], $_REQUEST['weight'], $_REQUEST['port'], $_REQUEST['ttl']);
if ($result != 'OK') {
// Set values
$q = "select * from records where record_id='" . $_REQUEST['record_id'] . "' and domain_id='" . get_dom_id($domain) . "' and type!='S' limit 1";
$stmt = $pdo->query($q) or die(print_r($pdo->errorInfo()));
$row = $stmt->fetch();
$smarty->assign('record_id', $_REQUEST['record_id']);
$smarty->assign('name', $row['host']);
$smarty->assign('address', $row['val']);
$smarty->assign('type', get_type($row['type']));
$smarty->assign('distance', $row['distance']);
$smarty->assign('weight', $row['weight']);
$smarty->assign('port', $row['port']);
$smarty->assign('ttl', $row['ttl']);
set_msg_err(htmlentities($result, ENT_QUOTES));
$smarty->display('header.tpl');
$smarty->display('edit_record.tpl');
$smarty->display('footer.tpl');
exit;
} else {
// Update record
if ($_REQUEST['type'] == 'AAAA' || $_REQUEST['type'] == 'AAAA+PTR') {
$address = uncompress_ipv6($_REQUEST['address']);
} else {
$address = $_REQUEST['address'];
开发者ID:impelling,项目名称:VegaDNS,代码行数:31,代码来源:records.php
示例19: strtolower
{
global $argv;
return strtolower(trim($argv['1']));
}
function get_type()
{
global $argv;
return strtolower(trim($argv['2']));
}
###################################################################
# Main code
###################################################################
$agi = new AGI();
$exten = agi_get_variable("USER");
$action = get_action();
$type = get_type();
# VM exists?
if (check_for_voicemail_box($exten)) {
# Retrieve Spooler directory
$spool_dir = agi_get_variable('ASTSPOOLDIR');
# Depending on message type
switch ($type) {
case 'temp':
$play = 'vm-rec-temp';
$file = $spool_dir . '/voicemail/default/' . $exten . '/temp';
break;
case 'name':
$play = 'vm-rec-name';
$file = $spool_dir . '/voicemail/default/' . $exten . '/greet';
break;
case 'busy':
开发者ID:jamesrusso,项目名称:Aastra_Scripts,代码行数:31,代码来源:aastra-vm-greetings.php
示例20: defined
<?php
defined('DT_ADMIN') or exit('Access Denied');
$TYPE = get_type('mail', 1);
$menus = array(array('添加邮件', '?moduleid=' . $moduleid . '&file=' . $file . '&action=add'), array('邮件管理', '?moduleid=' . $moduleid . '&file=' . $file), array('订阅列表', '?moduleid=' . $moduleid . '&file=' . $file . '&action=list'), array('订阅分类', 'javascript:Dwidget(\'?file=type&item=' . $file . '\', \'订阅分类\');'));
switch ($action) {
case 'add':
if ($submit) {
$typeid or msg('请选择邮件分类');
$title or msg('请填写邮件标题');
$content or msg('请填写邮件内容');
$content = addslashes(save_remote(save_local(stripslashes($content))));
$db->query("INSERT INTO {$DT_PRE}mail (title,typeid,content,addtime,editor,edittime) VALUES ('{$title}','{$typeid}','{$content}','{$DT_TIME}','{$_username}','{$DT_TIME}')");
dmsg('添加成功', $forward);
} else {
include tpl('mail_add', $module);
}
break;
case 'edit':
$itemid or msg();
if ($submit) {
$typeid or msg('请选择邮件分类');
$title or msg('请填写邮件标题');
$content or msg('请填写邮件内容');
$content = addslashes(save_remote(save_local(stripslashes($content))));
$db->query("UPDATE {$DT_PRE}mail SET title='{$title}',typeid='{$typeid}',content='{$content}',editor='{$_username}',edittime='{$DT_TIME}' WHERE itemid={$itemid}");
dmsg('修改成功', $forward);
} else {
$r = $db->get_one("SELECT * FROM {$DT_PRE}mail WHERE itemid={$itemid}");
$r or msg();
extract($r);
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:mail.inc.php
注:本文中的get_type函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论