本文整理汇总了PHP中is_null函数的典型用法代码示例。如果您正苦于以下问题:PHP is_null函数的具体用法?PHP is_null怎么用?PHP is_null使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_null函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_fields
public function get_fields()
{
if (is_null($this->fields)) {
$this->fields = $this->build_fields();
}
return $this->fields;
}
开发者ID:sabdev1,项目名称:ljcdevsab,代码行数:7,代码来源:class-form-fields.php
示例2: __construct
public function __construct(\SimpleXMLElement $xml = null)
{
parent::__construct($xml);
if (is_null($xml)) {
return;
}
}
开发者ID:klvtz,项目名称:kaltura-client53,代码行数:7,代码来源:ContentResource.php
示例3: format_time
public function format_time($timestamp, $date_only = false, $date_format = null, $time_format = null, $time_only = false, $no_text = false)
{
global $forum_date_formats, $forum_time_formats;
if ($timestamp == '') {
return __('Never');
}
$diff = ($this->feather->user->timezone + $this->feather->user->dst) * 3600;
$timestamp += $diff;
$now = time();
if (is_null($date_format)) {
$date_format = $forum_date_formats[$this->feather->user->date_format];
}
if (is_null($time_format)) {
$time_format = $forum_time_formats[$this->feather->user->time_format];
}
$date = gmdate($date_format, $timestamp);
$today = gmdate($date_format, $now + $diff);
$yesterday = gmdate($date_format, $now + $diff - 86400);
if (!$no_text) {
if ($date == $today) {
$date = __('Today');
} elseif ($date == $yesterday) {
$date = __('Yesterday');
}
}
if ($date_only) {
return $date;
} elseif ($time_only) {
return gmdate($time_format, $timestamp);
} else {
return $date . ' ' . gmdate($time_format, $timestamp);
}
}
开发者ID:bohwaz,项目名称:featherbb,代码行数:33,代码来源:Utils.php
示例4: getRouteParameters
/**
* @return array $routeParameters
*/
protected function getRouteParameters() : array
{
if (is_null(self::$routeParameters)) {
self::$routeParameters = $this->getController()->getRouteParameters();
}
return self::$routeParameters;
}
开发者ID:geolysis,项目名称:gz3-base,代码行数:10,代码来源:ServiceTrait.php
示例5: string
/**
* Format the string response, default is to just return the string.
*
* @param $value
* @param $format
*
* @return formatted string
*/
public static function string($value, $format = null)
{
if (is_null($format)) {
$format = '%s';
}
return sprintf($format, $value);
}
开发者ID:raphaelfranca,项目名称:revisionable,代码行数:15,代码来源:FieldFormatter.php
示例6: get_instance
/**
* Main WP_Currencies instance.
*
* Ensures only one instance of WP_Currencies is loaded.
*
* @since 1.4.0
*
* @return WP_Currencies
*/
public static function get_instance()
{
if (is_null(self::$_instance)) {
self::$_instance = new self();
}
return self::$_instance;
}
开发者ID:nekojira,项目名称:wp-currencies,代码行数:16,代码来源:wp-currencies.php
示例7: errorMessage
/**
* Return a textual error message for a Doctrine error code
*
* @param int|array integer error code,
* null to get the current error code-message map,
* or an array with a new error code-message map
*
* @return string error message
*/
public function errorMessage($value = null)
{
if (is_null($value)) {
return self::$_errorMessages;
}
return isset(self::$_errorMessages[$value]) ? self::$_errorMessages[$value] : self::$_errorMessages[Doctrine_Core::ERR];
}
开发者ID:seven07ve,项目名称:vendorepuestos,代码行数:16,代码来源:Exception.php
示例8: getPath
public function getPath($categoryId, $accountId, $delimiter = ' > ')
{
$account = Mage::helper('M2ePro/Component_Ebay')->getCachedObject('Account', $accountId);
$categories = $account->getChildObject()->getEbayStoreCategories();
$pathData = array();
while (true) {
$currentCategory = NULL;
foreach ($categories as $category) {
if ($category['category_id'] == $categoryId) {
$currentCategory = $category;
break;
}
}
if (is_null($currentCategory)) {
break;
}
$pathData[] = $currentCategory['title'];
if ($currentCategory['parent_id'] == 0) {
break;
}
$categoryId = $currentCategory['parent_id'];
}
array_reverse($pathData);
return implode($delimiter, $pathData);
}
开发者ID:giuseppemorelli,项目名称:magento-extension,代码行数:25,代码来源:Store.php
示例9: getMage2StoreId
public static function getMage2StoreId($mage1StoreId)
{
$id = NULL;
if (isset($mage1StoreId)) {
if (is_null($mage1StoreId)) {
$id = 'NULL';
} else {
$cacheId = "store_id2_{$mage1StoreId}";
$val = Yii::app()->cache->get($cacheId);
if (!$val) {
$store1 = Mage1Store::model()->find("store_id = {$mage1StoreId}");
if ($store1) {
$store2 = Mage2Store::model()->find("code = '{$store1->code}'");
if ($store2) {
$id = $store2->store_id;
}
} else {
$id = $mage1StoreId;
}
//save to cache for later
Yii::app()->cache->set($cacheId, $id, 86400);
// one day
} else {
$id = $val;
}
}
}
return $id;
}
开发者ID:ubertheme,项目名称:module-ubdatamigration,代码行数:29,代码来源:MigrateSteps.php
示例10: testSystemMethodSignature
public function testSystemMethodSignature()
{
$request = $this->encodeRequest('system.methodSignature', array('system.listMethods'));
$result = $this->server->setPayload($request)->serve();
$decoded = $this->decodeResponse($result);
$decoded = (array) $decoded;
$this->assertCount(1, $decoded);
$this->assertEquals('array', $decoded[0]);
$request = $this->encodeRequest('system.methodSignature', array('system.methodSignature'));
$result = $this->server->setPayload($request)->serve();
$decoded = $this->decodeResponse($result);
$decoded = (array) $decoded;
$this->assertCount(2, $decoded);
$this->assertEquals('array', $decoded[0]);
$this->assertEquals('string', $decoded[1]);
$method = \Comodojo\RpcServer\RpcMethod::create("test.sum", function ($params) {
$a = $params->get('a');
$b = $params->get('b');
return is_null($a) || is_null($b) ? 42 : intval($a) + intval($b);
})->setDescription("Sum two integers")->setReturnType('int')->addParameter('int', 'a')->addParameter('int', 'b')->addSignature()->setReturnType('int');
$result = $this->server->methods()->add($method);
$request = $this->encodeRequest('system.methodSignature', array('test.sum'));
$result = $this->server->setPayload($request)->serve();
$decoded = $this->decodeResponse($result);
$decoded = (array) $decoded;
$this->assertCount(2, $decoded);
$this->assertInternalType('array', $decoded[0]);
$this->assertInternalType('array', $decoded[1]);
$this->assertCount(3, $decoded[0]);
$this->assertCount(1, $decoded[1]);
}
开发者ID:comodojo,项目名称:rpcserver,代码行数:31,代码来源:CommonCases.php
示例11: getInstance
public static function getInstance($dbSetting = 'default')
{
if (is_null(static::$instance)) {
static::$instance = new static($dbSetting);
}
return static::$instance;
}
开发者ID:foreverphp,项目名称:framework,代码行数:7,代码来源:SQLEngine.php
示例12: handle
/**
* The handler which sets all the values in the dynamic definition.
*
* @param String $class the Controller class name
* @param LaravelSwagger $LS the LaravelSwagger instance.
* @throws DynamicHandlerException
*/
public function handle($class, LaravelSwagger $LS)
{
/**
*************************************
* Default Behaviour *
*************************************
*
* Loops through all of the linked keys
*/
foreach ($this->method->keys() as $key) {
/** @var mixed $value the value associated with the specific key */
$value = ValueContainer::getValue($class, $key);
if (is_string($value)) {
//if its a string of a class
//if it is a model that has been registered.
if (is_subclass_of($value, Model::class) && $LS->hasModel($value)) {
$value = "#/definitions/{$value}";
}
}
//if there is no value then throw an exception
if (is_null($value)) {
throw new DynamicHandlerException("{$key} value is NULL");
}
$this->method->set($key, $value);
}
}
开发者ID:kevupton,项目名称:laravel-swagger,代码行数:33,代码来源:DynamicHandler.php
示例13: __construct
public function __construct($p_id = null)
{
if (!is_null($p_id)) {
$this->m_data['id'] = $p_id;
$this->fetch();
}
}
开发者ID:sourcefabric,项目名称:newscoop,代码行数:7,代码来源:Session.php
示例14: get_instance
static function get_instance()
{
if (is_null(static::$instance)) {
static::$instance = new self();
}
return static::$instance;
}
开发者ID:khromov,项目名称:Splitdown,代码行数:7,代码来源:Splitdown.php
示例15: is
/**
* @param User $user
* @return bool
*/
public function is(User $user = null)
{
if (is_null($user)) {
return false;
}
return $this->username == $user->username;
}
开发者ID:jimmitjoo,项目名称:social-foundation,代码行数:11,代码来源:User.php
示例16: getAll
/**
* @param null $limit
* @return Collection
*/
public function getAll($limit = null)
{
if (is_null($limit)) {
return $this->answer->all();
}
return $this->answer->paginate();
}
开发者ID:Shuvayatra,项目名称:migration-web,代码行数:11,代码来源:AnswerRepository.php
示例17: _checkCountry
private function _checkCountry()
{
//$onepage = $this->getOnepage();
$quote = $this->getOnepage()->getQuote();
$shipping = $quote->getShippingAddress();
$billing = $quote->getBillingAddress();
$default_country = false;
$country_id = $shipping->getCountryId();
$helper = Mage::helper('onestepcheckout/checkout');
$enableGeoIp = Mage::getStoreConfig('onestepcheckout/general/enable_geoip');
if ($enableGeoIp == 1) {
if (!$helper->getGeoIp()->countryCode) {
$countryId = Mage::getStoreConfig('onestepcheckout/general/default_country_id');
} else {
$countryId = $helper->getGeoIp()->countryCode;
}
} else {
$countryId = Mage::getStoreConfig('onestepcheckout/general/default_country_id');
}
if (is_null($countryId)) {
$countryId = Mage::helper('core')->getDefaultCountry();
}
$shipping->setCountryId($countryId)->setCollectShippingRates(true)->save();
$billing->setCountryId($countryId)->save();
$shipping->setSameAsBilling(true)->save();
}
开发者ID:nilshopsahl,项目名称:hasla.local,代码行数:26,代码来源:IndexController.php
示例18: __construct
/**
* Construct new instance of ResourceAssociationType.
*
* @param string $name Name of the association
* @param string $namespaceName NamespaceName of the
* association
* @param ResourceAssociationTypeEnd $end1 First end of the association
* @param ResourceAssociationTypeEnd $end2 Second end of the association
*/
public function __construct($name, $namespaceName, ResourceAssociationTypeEnd $end1, ResourceAssociationTypeEnd $end2)
{
$this->_name = $name;
$this->_fullName = !is_null($namespaceName) ? $namespaceName . '.' . $name : $name;
$this->_end1 = $end1;
$this->_end2 = $end2;
}
开发者ID:i-geo,项目名称:odataphpprod,代码行数:16,代码来源:ResourceAssociationType.php
示例19: load
function load($tpl_view, $body_view = null, $data = null)
{
if (!is_null($body_view)) {
if (file_exists(APPPATH . 'views/' . $tpl_view . '/' . $body_view)) {
$body_view_path = $tpl_view . '/' . $body_view;
} else {
if (file_exists(APPPATH . 'views/' . $tpl_view . '/' . $body_view . '.php')) {
$body_view_path = $tpl_view . '/' . $body_view . '.php';
} else {
if (file_exists(APPPATH . 'views/' . $body_view)) {
$body_view_path = $body_view;
} else {
if (file_exists(APPPATH . 'views/' . $body_view . '.php')) {
$body_view_path = $body_view . '.php';
} else {
show_error('Unable to load the requested file: ' . $tpl_name . '/' . $view_name . '.php');
}
}
}
}
$body = $this->ci->load->view($body_view_path, $data, TRUE);
if (is_null($data)) {
$data = array('body' => $body);
} else {
if (is_array($data)) {
$data['body'] = $body;
} else {
if (is_object($data)) {
$data->body = $body;
}
}
}
}
$this->ci->load->view('templates/' . $tpl_view, $data);
}
开发者ID:rccghmp,项目名称:efollowup,代码行数:35,代码来源:Template.php
示例20: beforeSave
public function beforeSave($object)
{
$defaultShipping = $object->getDefaultShipping();
if (is_null($defaultShipping)) {
$object->unsetDefaultShipping();
}
}
开发者ID:arslbbt,项目名称:mangentovies,代码行数:7,代码来源:Shipping.php
注:本文中的is_null函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论