本文整理汇总了PHP中StringUtils::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtils::isEmpty方法的具体用法?PHP StringUtils::isEmpty怎么用?PHP StringUtils::isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtils
的用法示例。
在下文中一共展示了StringUtils::isEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeConnectorFromFile
public function makeConnectorFromFile($fileName)
{
if (StringUtils::isEmpty($fileName)) {
throw new Exception('Invalid db config file name: ' . $fileName);
}
@(include $fileName);
if (StringUtils::isEmpty($configDbDsn) || StringUtils::isEmpty($configDbUsername) || StringUtils::isEmpty($configDbPassword)) {
throw new Exception('Invalid db config file: ' . $fileName . "\n" . 'Remember that empty db passwords are not allowed!');
}
return new DbConnector($configDbDsn, $configDbUsername, $configDbPassword);
}
示例2: init
protected function init()
{
$requestString = file_get_contents('php://input');
if (StringUtils::isEmpty($requestString)) {
return;
}
$requestData = XMLRPC_parse($requestString);
$methodStrings = explode('.', XMLRPC_getMethodName($requestData));
$this->methodOwner = $methodStrings[0];
$this->methodName = $methodStrings[1];
$this->methodParams = XMLRPC_getParams($requestData);
// TODO: Where to call session_start?
session_start();
$this->session = new PhpHttpSession();
}
示例3: addEntry
public function addEntry($caption, $author, $drawingString)
{
// TODO: Accept Entry object as parameter?
// TODO: Validity checks here or in the server?
if (StringUtils::isEmpty($caption)) {
throw new InvalidParameterException("caption must not be empty.");
}
if (StringUtils::isEmpty($author)) {
throw new InvalidParameterException("author must not be empty.");
}
if (StringUtils::isEmpty($drawingString)) {
throw new InvalidParameterException("drawingString must not be empty.");
}
// TODO: Cache statement?
$statement = $this->dbConn->getPdo()->prepare('INSERT INTO entries ( id, caption, author, drawingString, timestamp ) ' . 'VALUES ( NULL, :caption, :author, :drawingString, UTC_TIMESTAMP );');
$statement->execute(array(':caption' => $caption, ':author' => $author, ':drawingString' => $drawingString));
return $this->dbConn->getPdo()->lastInsertId();
}