当前位置: 首页>>代码示例>>PHP>>正文


PHP Assert::isNotEmpty方法代码示例

本文整理汇总了PHP中Assert::isNotEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP Assert::isNotEmpty方法的具体用法?PHP Assert::isNotEmpty怎么用?PHP Assert::isNotEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Assert的用法示例。


在下文中一共展示了Assert::isNotEmpty方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @param array of string $fields
  */
 function __construct($name, DBTable $table, array $fields)
 {
     Assert::isScalar($name);
     Assert::isNotEmpty($fields, 'constraint cannot be across zero fields');
     $this->name = $name;
     $this->table = $table;
     $this->fields = $fields;
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:11,代码来源:DBConstraint.class.php

示例2: getSelectedValues

 /**
  * Gets the list of imported/default values
  * @return array
  */
 function getSelectedValues()
 {
     Assert::isNotEmpty($this->ids, 'options not yet set');
     $value = $this->getValue();
     if ($value) {
         return array($value);
     } else {
         return array();
     }
 }
开发者ID:phoebus,项目名称:HTML_FormAbstraction,代码行数:14,代码来源:SetFormControl.class.php

示例3: authenticate

 /**
  * Perform the authorisation request
  * @return DbAuth
  */
 public function authenticate()
 {
     $credential = $this->getCredential();
     Assert::isNotEmpty($credential, "You must set a password before authentication");
     $identity = $this->getIdentity();
     Assert::isNotEmpty($identity, "You must set an username before authentication");
     //We first get user from db if its exists
     $criteria = new Criteria(Restriction::is($this->identityColumn, $identity));
     $records = TableGateway::loadMatching($this->table, $criteria);
     if ($records->count() == 0) {
         return false;
     }
     /** @var $user Customer */
     $user = $records->current();
     //Yes we need to reassign this to variable.
     $credentialColumn = $this->credentialColumn;
     $credentialSaltColumn = $this->credentialSaltColumn;
     $slatedCredentialColumn = $this->slatedCredentialColumn;
     //We check if we should use salt checking
     if (!empty($credentialSaltColumn) && !empty($slatedCredentialColumn) && !empty($user->{$credentialSaltColumn}) && !empty($user->{$slatedCredentialColumn})) {
         //Fo salt we check if password is same like credential
         $authenticated = SaltPasswordManager::checkPasswordWithHash($user->{$slatedCredentialColumn}, $user->{$credentialSaltColumn}, $this->credential);
     } else {
         //If don't have salt we must check if we have hashed password
         if ($this->hash) {
             $credential = SaltPasswordManager::generateSimpleHash($this->credential);
         } else {
             $credential = $this->credential;
         }
         //We check if we are authenticated
         $authenticated = $credential == $user->{$credentialColumn};
         /**
          * If we are authenticated and have original password, we can create and add slated password for user and
          * we should do it. It means we are not Auto Login or something.
          */
         if ($authenticated && $this->hash) {
             if (!empty($credentialSaltColumn) && !empty($slatedCredentialColumn)) {
                 list($password, $hash) = SaltPasswordManager::generateSaltedPassword($this->credential);
                 $this->addSalt($user, $password, $hash);
             }
         }
     }
     if (empty($authenticated)) {
         return false;
     }
     return $this->authorisedId = $records->current()->__get($this->identityKey);
 }
开发者ID:Acidburn0zzz,项目名称:xframe-legacy,代码行数:51,代码来源:DbAuth.php

示例4: checkMemberIndependency

 /**
  * @return void
  */
 private function checkMemberIndependency(array $members)
 {
     $thrashed = array_unique($members);
     if (sizeof($thrashed) != sizeof($members)) {
         $duplicates = $this->getDuplicates($members);
         Assert::isNotEmpty($duplicates, 'core error: duplicates not found');
         Assert::isUnreachable('%s %s enumeration constants has the same value %s', join($duplicates, ', '), get_class($this), $members[reset($duplicates)]);
     }
 }
开发者ID:phoebius,项目名称:phoebius,代码行数:12,代码来源:Enumeration.class.php

示例5: getById

 public function getById($id, $expires = Cache::EXPIRES_MEDIUM)
 {
     Assert::isScalar($id);
     Assert::isNotEmpty($id);
     if (isset($this->identityMap[$id])) {
         return $this->identityMap[$id];
     }
     return $this->addObjectToMap(Cache::worker($this)->getById($id, $expires));
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:9,代码来源:GenericDAO.class.php

示例6: __construct

 function __construct($name, $label)
 {
     Assert::isNotEmpty($label, 'label should be specified');
     parent::__construct($name, $label, $label);
 }
开发者ID:phoebus,项目名称:HTML_FormAbstraction,代码行数:5,代码来源:ButtonFormControl.class.php

示例7: toString

 /**
  * @param Model $model
  * @return string
  */
 public function toString($model = null)
 {
     Assert::isNotEmpty($this->callback, 'callback can not be empty!');
     $json = parent::toString($model);
     return $this->callback . '(' . $json . ');';
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:10,代码来源:JsonPView.class.php

示例8: getSelfHref

 /**
  * Gets the text representastion of the requested URL
  *
  * @return string
  */
 function getSelfHref()
 {
     Assert::isNotEmpty($this->trace, 'trace is not set');
     return $this->trace->getWebContext()->getRequest()->getHttpUrl()->getUri();
 }
开发者ID:phoebius,项目名称:ajax-example,代码行数:10,代码来源:UIViewPresentation.class.php

示例9: getTagId

 protected function getTagId()
 {
     Assert::isNotEmpty($this->tagId, sprintf('Your descendant %s should call %s::__construct() to initialize the object', get_class($this), __CLASS__));
     return $this->tagId;
 }
开发者ID:phoebius,项目名称:proof-of-concept,代码行数:5,代码来源:FullCacheTag.class.php


注:本文中的Assert::isNotEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。