當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。