本文整理汇总了PHP中isNull函数的典型用法代码示例。如果您正苦于以下问题:PHP isNull函数的具体用法?PHP isNull怎么用?PHP isNull使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isNull函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: loadById
public function loadById($id)
{
if (isNull($object = $this->_mapper->storage()->loadObjectById($id))) {
return $this->_mapper->getDefaultGroup();
}
return $object;
}
开发者ID:evilgeny,项目名称:bob,代码行数:7,代码来源:Facade.class.php
示例2: transfer
function transfer()
{
$query = M('Db')->createQuery('tmp_equipment_export')->what('city_id, user_id, scaner_id, modem_id, laptop_id')->where('`exit` IS NULL OR `exit` = ""');
$request = M('Store')->requestQuery(M('Store')->factoryObject(), $query);
$transfer = 0;
foreach ($request as $object) {
if (!isNull($obHolder = getHolderByUserId($object->user_id))) {
if (!isNull($obEquipment = M('Equipment')->loadById($object->scaner_id))) {
if ($obEquipment->holder_id != $obHolder->id) {
$obEquipment->setHolder($obHolder);
$obEquipment->save();
$transfer++;
}
}
if (!isNull($obEquipment = M('Equipment')->loadById($object->modem_id))) {
if ($obEquipment->holder_id != $obHolder->id) {
$obEquipment->setHolder($obHolder);
$obEquipment->save();
$transfer++;
}
}
if (!isNull($obEquipment = M('Equipment')->loadById($object->laptop_id))) {
if ($obEquipment->holder_id != $obHolder->id) {
$obEquipment->setHolder($obHolder);
$obEquipment->save();
$transfer++;
}
}
}
}
echo "\n\nTRANSFER: {$transfer} enities";
}
开发者ID:evilgeny,项目名称:bob,代码行数:32,代码来源:4.export.php
示例3: _list
protected function _list()
{
if (isNull($this->_list)) {
$this->_list = M('List')->loadById($this->_list_id);
}
return $this->_list;
}
开发者ID:evilgeny,项目名称:bob,代码行数:7,代码来源:Classify.class.php
示例4: me
/**
* Returns logged user or anonymous user.
*
* @return RM_Account_iUser
*/
function me()
{
if (isNull($result = M('Account')->getLoggedUser())) {
$result = M('Account')->getAnonymousUser();
}
return $result;
}
开发者ID:evilgeny,项目名称:bob,代码行数:12,代码来源:tools.php
示例5: _isAddToModeration
protected function _isAddToModeration()
{
$barcode = $this->_object->getBarcode();
if (!M('Purchase')->isInStopList($this->_object->barcode_value) && (isNull($barcode = $this->_object->getBarcode()) || $barcode->attribute_1 != $this->_object->corrected_name)) {
return TRUE;
}
}
开发者ID:evilgeny,项目名称:bob,代码行数:7,代码来源:Ok.class.php
示例6: depth
function depth($input_data, $path = null, $depth = 0)
{
/*
Returns the depth of the node that reaches the input data instance
when ran through the tree, and the associated set of rules.
If a node has any children whose
predicates are all true given the instance, then the instance will
flow through that child. If the node has no children or no
children with all valid predicates, then it outputs the depth of the
node.
*/
if (isNull($path)) {
$path = array();
}
# root node: if predicates are met, depth becomes 1, otherwise is 0
if ($depth == 0) {
if (!$this->predicates->apply($input_data, $this->fields)) {
return array($depth, $path);
}
$depth += 1;
}
if ($this->children != null) {
foreach ($this->children as $child) {
if ($child->predicates->apply($input_data, $this->fields)) {
$array_push($path, $child->predicates->to_rule($this->fields));
return $child->depth($input_data, $path, $depth + 1);
}
}
}
return array($depth, $path);
}
开发者ID:sdesimone,项目名称:bigml-php,代码行数:32,代码来源:anomalytree.php
示例7: loadCategoryByName
public function loadCategoryByName($name)
{
if (!isNull($object = $this->_mapper->loadCategoryByName($name))) {
$this->_mapper->access($object, 'CATEGORY.USE');
}
return $object;
}
开发者ID:evilgeny,项目名称:bob,代码行数:7,代码来源:Facade.class.php
示例8: getCaptionByVarname
public function getCaptionByVarname($name)
{
if (!isNull($value = $this->loadObjectByName($name))) {
return $value->getCaption();
}
return L('list.value.' . $name);
}
开发者ID:evilgeny,项目名称:bob,代码行数:7,代码来源:Facade.class.php
示例9: loadReportById
/**
* Description...
*
* @return void
**/
public function loadReportById($id)
{
if (!isNull($object = $this->_mapper->storage('total')->loadObjectById($id))) {
$this->_mapper->access($object, 'READ');
}
return $object;
}
开发者ID:evilgeny,项目名称:bob,代码行数:12,代码来源:Facade.class.php
示例10: get
/**
* Enter description here...
*
* @return RM_Diagram_Object
*/
protected function get()
{
if (!$this->_diagram && isNull($this->_diagram = M('Diagram')->loadDiagramByName($this->_name))) {
$this->create();
}
return $this->_diagram;
}
开发者ID:evilgeny,项目名称:bob,代码行数:12,代码来源:Diagram.class.php
示例11: getDiagramList
public function getDiagramList()
{
$obData = $this->getData();
$obData->setColumnsForRowDescribe();
$obData->hideColumns(REPDATA_ALL);
$obData->setSharedParams($this->_object->detail()->getFieldNameWithName());
$diagrams = array();
foreach ($this->_object->getValues() as $obValue) {
if (isNull($obDiagram = M('Diagram')->loadDiagramByName($this->getDiagramName($obValue)))) {
$obData->hideColumns(REPDATA_ALL);
$obData->showColumns($obValue->getVarname());
$obDiagram = $this->advancedKpiStrategy()->createDiagramByData($obData, $obValue);
$obDiagram->setPermissionLikeObject($this->_object);
$obDiagram->rowCaptionVariable($this->_object->detail()->getFieldNameWithName());
$obDiagram->yLabelsCallbackFunction(array($obValue, 'callbackForPlotAxis'));
$obDiagram->xLabelsCallbackFunction(array($this->_object->period(), 'getCaptionBySystemValue'));
$obDiagram->prepareFunction(array($obValue, 'callbackForPlot'));
$obDiagram->setAxisCaption(array($obValue, 'getAxisCaption'));
$obDiagram->draw();
$obDiagram->save();
}
$diagrams[] = $obDiagram;
}
return $diagrams;
}
开发者ID:evilgeny,项目名称:bob,代码行数:25,代码来源:Kpi.class.php
示例12: getUserString
public function getUserString($obUser, $description = 'user')
{
$add_str = " (";
$add_str .= !isNull($obUser->getCity()) ? $obUser->getCity()->name : "Unknown City";
$add_str .= ")";
return $description . "=" . $obUser->id() . " " . $obUser->getAddressTo() . $add_str;
}
开发者ID:evilgeny,项目名称:bob,代码行数:7,代码来源:Log.class.php
示例13: installTemplateType
/**
* install template type
* @param string name : template type name
* @param string description : description for template type
* @param array variables : type variables with description
* Example:
* array(
* "nick" => "User nick",
* "email" => "User email (use as login)",
* "password" => "User password",
* "login" => "User login",
* );
* @param array templates : array of templates params
* Example:
* $ar = array();
*
* $ar[] = array(
* "lang" => "rus",
* "file_path" => "/rus/user/",
* "file_name" => "new.php",
* );
*
* $ar[] = array(
* "lang" => "eng",
* "file_path" => "/eng/user/",
* "file_name" => "new.php",
* );
*
*
* @return void
*/
function installTemplateType($name, $description, array $variables, array $templates)
{
if (!isNull($obType = M("MailTemplate")->loadTypeById($name))) {
$obType->delete();
}
$obType = M("MailTemplate")->createType($name);
$obType->description = $description;
$obType->save();
if (!isNull($obType)) {
foreach ($variables as $k => $v) {
// create variable object
$ob = $obType->createVariable($k);
// init variable properties
$ob->description = $v;
// save variable
if (!$ob->save()) {
print_r($ob->validator()->getErrors());
}
}
}
if (!isNull($obType)) {
foreach ($templates as $v) {
// create template object
$ob = $obType->createTemplate();
// init template object properties
foreach ($v as $k => $s) {
$ob->{$k} = $s;
}
// save template object
if (!$ob->save()) {
print_r($ob->validator()->getErrors());
}
}
}
}
开发者ID:evilgeny,项目名称:bob,代码行数:66,代码来源:shortcuts.php
示例14: getInstance
public static function getInstance()
{
if (isNull(static::$instance)) {
static::$instance = new static();
}
return static::$instance;
}
开发者ID:trismegiste,项目名称:phpunit-assert-solid,代码行数:7,代码来源:Case6.php
示例15: validateContainerName
protected function validateContainerName($container)
{
if (isNull($this->helper)) {
$this->helper = new ContainerHelper();
}
return $this->helper->containerExists($container);
}
开发者ID:vinodpanicker,项目名称:drupalci_testbot,代码行数:7,代码来源:ContainerBase.php
示例16: getAccount
/**
* Returns user's account by user id
*
* @param int $userId
* @return RM_Points_Account
*/
public function getAccount($userId)
{
if (isNull($obUser = M('User')->loadUserById($userId))) {
throw new RM_Base_Exception_Internal("Unable to load user by id: `{$userId}'");
}
return $this->_mapper->loadAccountByUserOrCreate($obUser);
}
开发者ID:evilgeny,项目名称:bob,代码行数:13,代码来源:Event.class.php
示例17: addFlavoursToBarcode
public function addFlavoursToBarcode(RM_Barcode_Object $obBarcode, $flavour_names, $flavour_type, &$error)
{
$result = FALSE;
if ($flavour_names) {
if (!in_array($flavour_type, M('Gpc')->flavour_types())) {
$error = 'gpc.wrong_flavour_type';
} else {
foreach ($obBarcode->getFlavours() as $obFlavour) {
$obFlavour->removeBarcode($obBarcode, $flavour_type);
}
foreach ($flavour_names as $flavour_name) {
if (!trim($flavour_name)) {
continue;
}
if (isNull($obFlavour = M('Gpc')->loadFlavourByName(trim($flavour_name)))) {
$error = 'gpc.no_such_flavours';
} else {
$obFlavour->addBarcode($obBarcode, $flavour_type);
$result = TRUE;
}
}
}
}
return $result;
}
开发者ID:evilgeny,项目名称:bob,代码行数:25,代码来源:Main.class.php
示例18: createNote
/**
* Returns admin note object
*
* @param array data
* @param RM_Account_iUser obWriter
* @return RM_AdminNote_Object
*/
public function createNote($data = array(), RM_Account_iUser $obWriter)
{
if (!@$data['type'] && !@$data['type_no_action'] && !@$data['body']) {
$res = new RM_Base_Result();
$res->error('at_least_one_field');
throw new RM_Validator_Exception($res);
}
if (isNull($obUser = M('User')->loadUserById(@$data['user_id']))) {
$res = new RM_Base_Result();
$res->error('no_such_user');
throw new RM_Validator_Exception($res);
}
$arr = array();
$arr['writer_id'] = $obWriter->id();
$arr['user_id'] = $obUser->id();
if (@$data['type']) {
$arr['type'] = (int) $data['type'];
}
if (@$data['type_no_action']) {
$arr['type_no_action'] = (int) $data['type_no_action'];
}
if (@$data['body']) {
$arr['body'] = $data['body'];
}
//$arr['is_done'] = 1;
$arr['posted'] = M('Tools')->date()->dbDateTime();
return $this->_mapper->_storage('adminNote')->createObject($arr);
}
开发者ID:evilgeny,项目名称:bob,代码行数:35,代码来源:Facade.class.php
示例19: object
/**
* Returns shop
*
* @return RM_Shop_Object
*/
protected function object()
{
if (isNull($this->_shop)) {
$this->_shop = $this->_mapper->loadShopById($this->shop_id);
}
return $this->_shop;
}
开发者ID:evilgeny,项目名称:bob,代码行数:12,代码来源:Downtime.class.php
示例20: _reportQuery
/**
* Enter description here...
*
* @return RM_Db_Query
*/
protected function _reportQuery()
{
if (isNull($this->_query)) {
$this->_query = $query;
}
return $this->_query;
}
开发者ID:evilgeny,项目名称:bob,代码行数:12,代码来源:OrderControl.class.php
注:本文中的isNull函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论